Re: AnalyzerAdapter: computed stack incorrect after super-constructor call?
Eugene Kuleshov <[email protected]>
| Newsgroups | gmane.comp.java.objectweb.asm |
|---|---|
| Message-ID | <[email protected]> |
I would have to look at this particular issue closer, but you should
keep in mind that AnalyzerAdapter rely on the stackmap data stored in
the bytecode and that data can be potentially incorrect or even
absent.
Also, in the stackmap data the first frame is omitted and
AnalyzerAdapter is trying to recalculate it from the method signature
(and owner's type). So, for the constructor ("<init>") initial value
of variable 0 is UNINITIALIZED_THIS, but it gets replaced with value
of the "owner" parameter passed to the AnalyzerAdapter constructor
after first INVOKESPECIAL call on variable 0. So, you need to check
that you have a correct "owner" value.
regards,
Eugene
On Thu, Mar 18, 2010 at 11:17 AM, Andreas Sewe
<[email protected]> wrote:
> Hi all,
>
> when working with the AnalyzerAdapter I have encountered a weird situation,
> in which I am not sure whether the AnalyzerAdapter's stack computations are
> incorrect or whether I just misunderstand the "Verification or class files"
> section the JVM spec. (Probably the latter, as my Prolog is a little bit
> rusty.)
>
> So here is the code that puzzles me, interspersed with the stack according
> to the AnalyzerApadater. Its a simple constructor of a class Foo, whose
> immediate superclass is Object:
>
> Foo."<init>":()V:
> []
> aload_0
> [UNINITIALZED_THIS]
> invokespecial java/lang/Object."<init>":()V
> []
> aload_0
> [java/lang/Object]
> bipush 42
> [java/lang/Object, INTEGER]
> putfield Foo.bar:I
> []
> return
> []
>
> What I don't get is why the second aload_0 pushes an Object rather than a
> Foo and how on earth the putfield then passes verification. As far as I
> understand the JVM spec, there is no special treatment of putfield in
> constructors that would explain this.
>
> Can somebody shed some light on this situation?
>
> Best wishes,
>
> Andreas Sewe
>
>
> --
> 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