On Mon, 17 Apr 2023 12:58:57 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/Enum.java line 175: >> >>> 173: * >>> 174: * @implNote Once initialized, the field value does not change. >>> 175: * Hotspot's identity hash code generation also never returns zero >> >>> Hotspot's identity hash code generation also never returns zero >> >> Isn't that behavior VM-specific? Also, where is it documented? > > Yes, it is implementation-specific, that is why it says "Hotspot's identity > hash code". The relevant code blocks are > https://github.com/openjdk/jdk/blob/cc60f2ff3f16bdb04917e09cb87f09bd544f1f8b/src/hotspot/share/oops/markWord.hpp#L231-L233 > (property) and > https://github.com/openjdk/jdk/blob/cc60f2ff3f16bdb04917e09cb87f09bd544f1f8b/src/hotspot/share/runtime/synchronizer.cpp#L826-L827 > (invariant). It would not break the code functionally if that invariant ever breaks: we would "just" call the (intrinsic) method on zero hash code. That `implNote` only shows that it would not happen with current implementation at all. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13491#discussion_r1168667338