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:53 UTC 2025


On Tue, 3 Jun 2025 08:36:58 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> 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.
>
> 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";
>  }

Also, names: `change_reason_to_string(ChangeReason reason)`. Now that enum is scoped to `nmethod`, there is no need for `NMethod` prefix.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25338#discussion_r2123148319


More information about the hotspot-dev mailing list