RFR: 8373480: Optimize multiplication by constant multiplier using LEA instructions [v6]
Emanuel Peter
epeter at openjdk.org
Fri Jan 9 12:36:02 UTC 2026
On Fri, 9 Jan 2026 10:22:23 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:
>> test/hotspot/jtreg/compiler/c2/TestConstantMultiplier.java line 102:
>>
>>> 100: private static void runMultBy#{multiplier}I() {
>>> 101: int multiplicand = RANDOM.nextInt();
>>> 102: Verify.checkEQ(#{multiplier} * multiplicand, testMultBy#{multiplier}I(multiplicand));
>>
>> I think that the `@Run` method also gets compiled, so probably both sides of the verification are compiled. Is that your intention? Probably not, right?
>
> I didn't follow it, I don't intend to invoke Run in StandAlone Mode.
Let me clarify:
- Your `@Run` gets invoked many times, eventually it will compile.
- You invoke the `testMultBy`, and eventually it will get compiled.
- Now, both the multiplication in the test, and the run method are compiled. If there was a bug, it would be the same wrong result in the test and run, verification would pass, and we would not catch the bug.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28759#discussion_r2676027884
More information about the hotspot-dev
mailing list