Re: Re: Re: Re: Re: Re: Re: Re: Re: Release of ASM4
Rémi Forax <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
On 08/05/2011 07:58 PM, Eugene Kuleshov wrote: > ASM3 will fail to read class. With new API changes Eric and Remi are > working on you will need to make some changes in your adapters. > > Remi, it might be a good idea to write up a migration guide, i.e. > what need to be changed. If I followed your conversation right, > handling of LDC instruction and some classes been renamed. > > regards, > Eugene Sure, I will write a small guide ... To summarize, JDK7 introduces a new bytecode invokedynamic and two new constants: a constant method handle and a constant method type. From the ASM point of view, invokedynamic is a new method in MethodVisitor named visitInvokeDynamicInsn so depending on the transformation you will have to catch it or not. The two new constants are only available when doing a LDC or an invodynamic, for ASM when calling/implementing visitLDCInsn/visitInvokeDynamicInsn a constant method type is a Type that encapulates a method descriptor string and a constant method handle is a new class named Handle. So if you migrate to ASM4, be prepared to implement visitInvokeDynamicInsn and in visitLDCInsn to receive a Type that contains a method descriptor (in the previous version of ASM, a Type received from a visitLDCInsn was only a class name or an array name) or to receive a Handle. Moreover, ASM4 comes in a new package named org.ow2.asm (instead of org.objectweb.asm) so you will have to rename all you imports that import an ASM type. Also as stated before by Eugene, if you want to read a class which is 1.7 compatible you have to use ASM4, ASM3 doesn't recognize invokedynamic correctly (in fact it recognizes a transitional version of invokedynamic that doesn't exist anymore and doesn't recognize the two new constants. To finish, something related to ASM, there is a new restriction enforced by any 1.7 VMs, if you generate a 1.7 compatible bytecode and you have to if you want to use invokedynamic, then your bytecode *must* contain the StackMap frames (you can generate them yourself by callling visitFrame or let ASM do it for you by creating the ClassWriter with the flag ClassWriter.COMPUTE_FRAMES). If you don't generate the StackMap frames, a 1.6 VM will fallback to use the old verifier so the code will run fine, a 1.7 VM will throw a VerifyError. Rémi > > On Fri, Aug 5, 2011 at 1:55 PM, Jess Holle<[email protected]> wrote: >> What will choke? ASM4 even though I don't have any logic hinging on the new >> opcodes, etc? >> >> Or ASM 3 will choke? I'd assume that -- but I'd also assume that I >> shouldn't have to change anything in a simple adapter extension if I don't >> have logic that hinges on any of the new opcodes, etc. >> >> On 8/5/2011 10:57 AM, Eugene Kuleshov wrote: >>> Jess, >>> >>> It will work if processed bytecode don't have any new Java7 >>> features, but ti will choke if it hit any new opcodes or constant >>> stack entries. >>> >>> regards, >>> Eugene >>> >>> On Fri, Aug 5, 2011 at 11:41 AM, Jess Holle<[email protected]> wrote: >>>> I guess I've not tried to move my code to ASM4 yet, but I would have >>>> assumed >>>> that if I'm doing limited transformations whereby I pass most constants, >>>> etc, through, that my visitor/adapter wouldn't have to change at all. >>>> >>>> [I'm essentially just doing "around" advice like AspectJ, but without the >>>> overhead, etc, of AspectJ.] >>>> >>>> On 8/5/2011 10:12 AM, Eugene Kuleshov wrote: >>>>> Jess, >>>>> >>>>> You will have to use ASM4 in order to process Java7 bytecode, even >>>>> if you are not using Java7 features, new bytecode can have new >>>>> constant types not supported by ASM3. >>>>> >>>>> regards, >>>>> Eugene >>>>> >>>>> On Fri, Aug 5, 2011 at 10:02 AM, Jess Holle<[email protected]> wrote: >>>>>> I use ASM 3 with a non-mangled package name -- and use various other >>>>>> packages which use it with a mangled package name. >>>>>> >>>>>> I can do a global replace and recompile easily enough, of course -- >>>>>> it's >>>>>> not >>>>>> like I'm going to straddle ASM 3 and ASM 4 (i.e. trying to support >>>>>> either >>>>>> as >>>>>> a drop-in). >>>>>> >>>>>> That said, since ASM 4 is required for proper Java 7 support, it seems >>>>>> like >>>>>> repackaging now forces an update for anyone not mangling purely to get >>>>>> to >>>>>> Java 7 support. I'm not sure that's entirely a good thing -- but I >>>>>> won't >>>>>> throw a fit about it either. >>>>>> >>>>>> -- >>>>>> Jess Holle >>>>>> >>>>>> On 8/4/2011 10:17 PM, Howard Lewis Ship wrote: >>>>>>> Tapestry uses ASM 3 with a mangled package name as well. >>>>>>> >>>>>>> On Tue, Aug 2, 2011 at 1:47 PM, Charles Oliver Nutter >>>>>>> <[email protected]> wrote: >>>>>>>> On Sat, Jul 30, 2011 at 7:24 AM, Rémi Forax<[email protected]> >>>>>>>> wrote: >>>>>>>>> Hi Eugene, >>>>>>>>> I know that you really want to change the package name >>>>>>>>> but talking with several users at the JVM Summit last week, >>>>>>>>> the idea is not popular. >>>>>>>>> Most of them either manage their dependencies to have only >>>>>>>>> jars that use one version of ASM (maven to the rescue) >>>>>>>>> or they use jarjar. >>>>>>>> Count JRuby among the projects that ships ASM under a mangled package >>>>>>>> name. I don't care what the package is, really. >>>>>>>> >>>>>>>> BiteScript, on the other hand, does have dependencies on ASM's actual >>>>>>>> package name and our mangled name. BiteScript is still used as the >>>>>>>> compiler backend of a few projects. >>>>>>>> >>>>>>>> - Charlie >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> You receive this message as a subscriber of the [email protected] mailing >>>>>>>> list. >>>>>>>> To unsubscribe: mailto:[email protected] >>>>>>>> For general help: mailto:[email protected]?subject=help >>>>>>>> OW2 mailing lists service home page: http://www.ow2.org/wws >>>>>>>> >>>>>>>> >>>>>> -- >>>>>> You receive this message as a subscriber of the [email protected] mailing >>>>>> list. >>>>>> To unsubscribe: mailto:[email protected] >>>>>> For general help: mailto:[email protected]?subject=help >>>>>> OW2 mailing lists service home page: http://www.ow2.org/wws >>>>>> >>>>>> >>
message-footer.txt
(text/plain, 238 B)
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws