RFR: 8369147: Various issues with new tests added by JDK-8316694

Vladimir Kozlov kvn at openjdk.org
Wed Oct 15 17:17:34 UTC 2025


On Mon, 6 Oct 2025 20:13:46 GMT, Chad Rakoczy <duke at openjdk.org> wrote:

> [JDK-8369147](https://bugs.openjdk.org/browse/JDK-8369147)
> 
> Fixes tests added in [JDK-8316694](https://bugs.openjdk.org/browse/JDK-8316694)
> 
> `DeoptimizeRelocatedNMethod.java` and `RelocateNMethod.java` failed because they attempted to relocate nmethods to the `MethodProfiled` code heap which does not exist when `TieredCompilation` is false. Updated the tests to use `MethodNonProfiled` heap which exists regardless of `TieredCompilation`
> 
> `StressNMethodRelocation.java` runs for 60 seconds and also compiles 1024 methods with C2. This was causing the test to timeout if the compilation took too much time. Increasing the timeout to 5 minutes should give C2 enough time to compile the functions
> 
> `NMethodRelocationTest.java` runs using SerialGC which caused a multiple GC error when trying to run with another GC. Added a requires to force SerialGC

Comments.

test/hotspot/jtreg/compiler/whitebox/DeoptimizeRelocatedNMethod.java line 30:

> 28:  * @library /test/lib /
> 29:  * @modules java.base/jdk.internal.misc java.management
> 30:  * @requires vm.opt.DeoptimizeALot != true & vm.gc.Serial

Suggestion:

@requires vm.gc == "null" | vm.gc == "Serial"

test/hotspot/jtreg/compiler/whitebox/DeoptimizeRelocatedNMethod.java line 42:

> 40:  * @library /test/lib /
> 41:  * @modules java.base/jdk.internal.misc java.management
> 42:  * @requires vm.opt.DeoptimizeALot != true & vm.gc.Parallel

@requires vm.gc == "null" | vm.gc == "Parallel"

test/hotspot/jtreg/compiler/whitebox/DeoptimizeRelocatedNMethod.java line 54:

> 52:  * @library /test/lib /
> 53:  * @modules java.base/jdk.internal.misc java.management
> 54:  * @requires vm.opt.DeoptimizeALot != true & vm.gc.G1

@requires vm.gc == "null" | vm.gc == "G1"

test/hotspot/jtreg/compiler/whitebox/DeoptimizeRelocatedNMethod.java line 66:

> 64:  * @library /test/lib /
> 65:  * @modules java.base/jdk.internal.misc java.management
> 66:  * @requires vm.opt.DeoptimizeALot != true & vm.gc.Shenandoah

@requires vm.gc == "null" | vm.gc == "Shenandoah"

test/hotspot/jtreg/compiler/whitebox/DeoptimizeRelocatedNMethod.java line 78:

> 76:  * @library /test/lib /
> 77:  * @modules java.base/jdk.internal.misc java.management
> 78:  * @requires vm.opt.DeoptimizeALot != true & vm.gc.Z

@requires vm.gc == "null" | vm.gc == "Z"

test/hotspot/jtreg/compiler/whitebox/RelocateNMethod.java line 32:

> 30:  * @modules java.base/jdk.internal.misc java.management
> 31:  *
> 32:  * @requires vm.opt.DeoptimizeALot != true & vm.gc.Serial

Same here as in test/hotspot/jtreg/compiler/whitebox/DeoptimizeRelocatedNMethod.java

test/hotspot/jtreg/compiler/whitebox/StressNMethodRelocation.java line 34:

> 32:  * @build jdk.test.whitebox.WhiteBox
> 33:  * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
> 34:  * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI

I prefer @eastig suggestion to limit run time instead of increase timeout.

test/hotspot/jtreg/compiler/whitebox/StressNMethodRelocation.java line 35:

> 33:  * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
> 34:  * @run main/othervm/timeout=600 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
> 35:  *                   -XX:+SegmentedCodeCache -XX:+TieredCompilation -XX:+UnlockExperimentalVMOptions

I am not sure you need to specify `-XX:+SegmentedCodeCache -XX:+TieredCompilation `  because you require them to be enabled to run test.  Please, test that.

test/hotspot/jtreg/serviceability/jvmti/NMethodRelocation/NMethodRelocationTest.java line 29:

> 27:  * @bug 8316694
> 28:  * @summary Verify that nmethod relocation posts the correct JVMTI events
> 29:  * @requires vm.jvmti & vm.gc.Serial

* @requires vm.gc == "null" | vm.gc == "Serial"

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

PR Review: https://git.openjdk.org/jdk/pull/27659#pullrequestreview-3341481186
PR Review Comment: https://git.openjdk.org/jdk/pull/27659#discussion_r2433367608
PR Review Comment: https://git.openjdk.org/jdk/pull/27659#discussion_r2433368572
PR Review Comment: https://git.openjdk.org/jdk/pull/27659#discussion_r2433369949
PR Review Comment: https://git.openjdk.org/jdk/pull/27659#discussion_r2433371850
PR Review Comment: https://git.openjdk.org/jdk/pull/27659#discussion_r2433373000
PR Review Comment: https://git.openjdk.org/jdk/pull/27659#discussion_r2433374245
PR Review Comment: https://git.openjdk.org/jdk/pull/27659#discussion_r2433383437
PR Review Comment: https://git.openjdk.org/jdk/pull/27659#discussion_r2433386087
PR Review Comment: https://git.openjdk.org/jdk/pull/27659#discussion_r2433376516


More information about the serviceability-dev mailing list