RFR: 8357396: Refactor nmethod::make_not_entrant to use Enum instead of "const char*" [v2]
Aleksey Shipilev
shade at openjdk.org
Tue Jun 3 08:45:52 UTC 2025
On Tue, 3 Jun 2025 05:40:09 GMT, Cesar Soares Lucas <cslucas at openjdk.org> wrote:
>> Please review this refactor to transform the reasons for making an nmethod not entrant from `const char*` into enum values.
>>
>> Tested on Linux x64 with JTREG tier1-3 in fastdebug and release mode.
>
> Cesar Soares Lucas has updated the pull request incrementally with one additional commit since the last revision:
>
> Address PR feedback: modify emum to be scoped.
Looks conceptually fine. Cosmetics:
src/hotspot/share/code/nmethod.hpp line 498:
> 496:
> 497:
> 498: static const char* NMethodChangeReason_to_string(NMethodChangeReason reason) {
Uh, use a switch:
switch(reason) {
case C1_deoptimize: return "C1 deoptimized";
case C1_codepatch: return "C1 code patch";
...
default:
assert(false, "Unhandled reason");
return "Unknown";
}
src/hotspot/share/jvmci/jvmciEnv.cpp line 1755:
> 1753:
> 1754:
> 1755: void JVMCIEnv::invalidate_nmethod_mirror(JVMCIObject mirror, bool deoptimize, nmethod::NMethodChangeReason statusReason, JVMCI_TRAPS) {
Suggestion:
void JVMCIEnv::invalidate_nmethod_mirror(JVMCIObject mirror, bool deoptimize, nmethod::NMethodChangeReason change_reason, JVMCI_TRAPS) {
src/hotspot/share/jvmci/jvmciEnv.hpp line 465:
> 463: // If `deoptimize` is true, the nmethod is immediately deoptimized.
> 464: // The HotSpotNmethod.address field is zero upon returning.
> 465: void invalidate_nmethod_mirror(JVMCIObject mirror, bool deoptimze, nmethod::NMethodChangeReason statusReason, JVMCI_TRAPS);
Suggestion:
void invalidate_nmethod_mirror(JVMCIObject mirror, bool deoptimize, nmethod::NMethodChangeReason change_reason, JVMCI_TRAPS);
-------------
PR Review: https://git.openjdk.org/jdk/pull/25338#pullrequestreview-2891309126
PR Review Comment: https://git.openjdk.org/jdk/pull/25338#discussion_r2123138594
PR Review Comment: https://git.openjdk.org/jdk/pull/25338#discussion_r2123153641
PR Review Comment: https://git.openjdk.org/jdk/pull/25338#discussion_r2123152309
More information about the hotspot-dev
mailing list