asmtools bug: ldc constant dynamic that returns a long or a double should use ldc2_w instead of ldc
Lois Foltan
lois.foltan at oracle.com
Tue Sep 4 18:31:02 UTC 2018
On 9/2/2018 10:40 AM, Remi Forax wrote:
> Hi all, hi Leonid,
> while fixing a bug in ASM [1] when a ldc to a condy that returns a long uses the wrong bytecode,
> i've discovered that autotools has the same issue.
>
> The following code should generate a ldc2_w and not a ldc.
>
> public static Method primitiveExample:"()J"
> stack 2 locals 0
> {
> ldc Dynamic REF_invokeStatic
> :jdk11/AllInstructions.bsm
> :"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;)J"
> :_
> :"J" {};
> lreturn;
> }
>
> in case you wonder why we use asmtools, for testing ASM we try to not use bytecodes generated by ASM as source :)
>
> regards,
> Rémi
>
> [1] https://gitlab.ow2.org/asm/asm/issues/317850
Hi Remi,
Since your code looks very much like jasm, for my clarification, by
autotools do you mean the asmtools within the code-tools repo? The test
test/hotspot/jtreg/runtime/CondyLDCTest.java tries to execute
CondyBadLDC.jasm that has the similar instruction sequence as yours
above, an ldc instruction of a condy returning a double.
public static Method D:"()D"
stack 2 locals 0
{
// ldc of a double will yield a VerifyError, should be
an ldc2_w instruction
ldc Dynamic
REF_invokeStatic:CondyBadLDC.intConversion:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;I)Ljava/lang/Object;":D:"D"
i
nt 2147483647;
dreturn;
}
which yields a VerifyError. So my interest in clarification on this.
Thanks,
Lois
More information about the valhalla-dev
mailing list