asmtools bug: ldc constant dynamic that returns a long or a double should use ldc2_w instead of ldc

Remi Forax forax at univ-mlv.fr
Sun Sep 2 14:40:52 UTC 2018


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


More information about the valhalla-dev mailing list