RFR: 8360936: Test compiler/onSpinWait/TestOnSpinWaitAArch64.java fails after JDK-8359435 [v3]

Aleksey Shipilev shade at openjdk.org
Mon Jul 7 15:43:41 UTC 2025


On Thu, 3 Jul 2025 08:18:56 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> wrote:

>> Test compiler/onSpinWait/TestOnSpinWaitAArch64.java needs debug info to identify a position of spin wait instructions in generated code. The test switched to use `XX:CompileCommand=print` instead of `XX:+PrintAssembly` to have assembly only for a tested Java method. In release builds  `XX:+PrintAssembly` prints out debug info but `XX:CompileCommand=print` does not.
>> 
>> This PR reimplements the test to parse instructions and to check them. The test does not rely on debug info anymore.
>> 
>> Tested on Linux and MacOS with and without hsdis:
>> - Fastdebug: test passed
>> - Slowdebug: test passed.
>> - Release: test passed.
>
> Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Reimplement checking algo without using debug info

test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java line 55:

> 53:     private static String retInst = "ret";
> 54:     private static String neededAddInst = "addsp,sp,#0x20";
> 55:     private static String neededLdpInst = "ldpx29,x30,[sp,#16]";

Move these default inits down to `analyzer.contains("[MachCode]")` block, since it looks like it selects between two options based on `[MachCode]` presence. Something like:


boolean disassembly = analyzer.contains("[MachCode]");
retInst = disassembly ? "ret" : "c0035fd6";
...

test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java line 179:

> 177:           String s = instrReverseIter.previous();
> 178:           instrReverseIter.next();
> 179:             if (instrReverseIter.previous().startsWith(neededAddInst)) {

Multiple issues here:
 - Confusing: what's the use of `s`, did you mean to use it for `startsWith`?
 - Indenting is off

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26072#discussion_r2190397094
PR Review Comment: https://git.openjdk.org/jdk/pull/26072#discussion_r2190415085


More information about the hotspot-compiler-dev mailing list