RFR: 8306075: Micro-optimize Enum.hashCode [v3]
Chen Liang
liach at openjdk.org
Wed Apr 19 02:17:57 UTC 2023
On Tue, 18 Apr 2023 19:32:42 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> `invokespecial` is used to call instance methods in a non‑virtual manner.
>>
>> --------------------------------------------------------------------------------
>>
>> Using `super.hashCode()` in `java.lang.Enum` produces the bytecode:
>>
>> aload_0;
>> invokespecial java/lang/Object.hashCode:()I;
>
> I see. It does not matter here, because for performance, we largely only care about the distinction between virtual/static cases in C2 intrinsic for hashcode.
Also fyi invokespecial now can be virtual calls (mainly calling private methods in the nest) since introduction of nestmates.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13491#discussion_r1170735370
More information about the core-libs-dev
mailing list