asmtools bug: ldc constant dynamic that returns a long or a double should use ldc2_w instead of ldc
Leonid Kuskov
Leonid.Kuskov at Oracle.com
Tue Sep 4 19:19:12 UTC 2018
Hi Remi,
Many thanks for reporting the issue. I consider that the asmtools
behavior is correct.
The main goal of asmtools is the ability to generate a broken binary
code. asmtools just converts stuff that it processes.
It will be impossible to develop negative test cases if the tool
controls a return type and overwrites a corresponding instruction.
For example, I need to check a negative test cases: how VM will process
pairs ldc2_w:bsm(...)I, ldc_w:bsm(...)D?
Here correction of instructions will hide an expected VM reaction.
Thanks,
Leonid
On 9/2/18 07:40, 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
More information about the valhalla-dev
mailing list