RFR: 8359064: Expose reason for marking nmethod non-entrant to JVMCI client [v3]
Doug Simon
dnsimon at openjdk.org
Thu Jun 12 10:58:32 UTC 2025
On Thu, 12 Jun 2025 00:27:55 GMT, Cesar Soares Lucas <cslucas at openjdk.org> wrote:
>> We recently introduced a way to set the reason why a nmethod was being marked as `not entrant`, see [here](https://github.com/openjdk/jdk/pull/23980) and [here](https://github.com/openjdk/jdk/pull/25338).
>>
>> This PR is to expose in the JVMCI interface the reason why the nmethod was flagged as `not entrant`. This will allow JVMCI-based compilers to implement heuristics to handle re-compilations differently based on what happened to earlier versions of a method, for instance, this will likely be used to address this [RFE in Truffle](https://github.com/oracle/graal/issues/11045
>> ).
>>
>> Tested on Linux x86_64, ARM with JTREG tier 1-3.
>
> Cesar Soares Lucas has updated the pull request incrementally with one additional commit since the last revision:
>
> Refactoring: move changes to HotSpotNmethod class; remove enum on Java side; rename field to invalidationReason
src/hotspot/share/jvmci/jvmciEnv.cpp line 1747:
> 1745: }
> 1746: set_InstalledCode_address(installed_code, (jlong) cb);
> 1747: set_HotSpotNmethod_invalidationReason(installed_code, static_cast<int>(nmethod::ChangeReason::unknown));
Remove this - just let the `HotSpotNmethod` constructor do the right thing.
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotNmethod.java line 81:
> 79:
> 80: /**
> 81: * Identify the reason that caused this nmethod to be invalidated.
Update doc to note that the field will be `-1` until the nmethod is invalidated.
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotNmethod.java line 91:
> 89: boolean inOopsTable = !IS_IN_NATIVE_IMAGE && !isDefault;
> 90: this.compileIdSnapshot = inOopsTable ? 0L : compileId;
> 91: this.invalidationReason = 0;
It should be initialized to `-1` as we will never install invalid code.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25706#discussion_r2142352178
PR Review Comment: https://git.openjdk.org/jdk/pull/25706#discussion_r2142348968
PR Review Comment: https://git.openjdk.org/jdk/pull/25706#discussion_r2142347083
More information about the graal-dev
mailing list