RFR: 8290705: StringConcat::validate_mem_flow asserts with "unexpected user: StoreI" [v2]
Tobias Hartmann
thartmann at openjdk.org
Wed Jul 27 10:47:28 UTC 2022
On Wed, 27 Jul 2022 02:08:43 GMT, Xin Liu <xliu at openjdk.org> wrote:
>> test/hotspot/jtreg/compiler/stringopts/SideEffectBeforeConstructor.jasm line 54:
>>
>>> 52: putstatic Field result:"I";
>>> 53: aload_0;
>>> 54: invokespecial Method java/lang/StringBuffer."<init>":"(Ljava/lang/String;)V";
>>
>> hi, @TobiHartmann ,
>> Is here the reason why you said "javac would not generate such code"?
>> I don't think javac will insert "SideEffectBeforeConstructor::result++" btween new and invokespecial.
>
> I tried that. I don't think there's a way to generate code like that using javac.
> So we fix this bug because somebody may emit weird bytecode sequences using asm?
Yes, I don't think javac would ever put something between new and the invokespecial of the constructor. At least I was not able to trigger that.
> So we fix this bug because somebody may emit weird bytecode sequences using asm?
Yes. The JVM needs to handle **all** valid bytecode, not only bytecode generated by javac. Not only are there other Java compilers but also different languages (like Scala) that compile to bytecode and run on the JVM.
-------------
PR: https://git.openjdk.org/jdk/pull/9589
More information about the hotspot-compiler-dev
mailing list