On Thu, 17 Sep 2026 19:36:01 GMT, Frederic Parain <[email protected]> wrote:
>> Chen Liang has updated the pull request with a new target base due to a >> merge or a rebase. The pull request now contains 10 commits: >> >> - Fix copyright date >> - Merge branch 'master' into JDK-8391990 >> - Also, make sure it's set >> - mask through hash code >> - Merge branch 'feature/value-hash-zero' of github.com:liachmodded/jdk into >> feature/value-hash-zero >> - Compiler part >> - Merge branch 'master' of github.com:openjdk/jdk into >> feature/value-hash-zero >> - Use class identity hash code >> - Merge branch 'master' of github.com:openjdk/jdk into >> feature/value-hash-zero >> - Mask zero value object hash > > src/hotspot/share/opto/library_call.cpp line 5744: > >> 5742: IfNode* iff_hash_would_be_zero = >> create_and_map_if(control(), bol_hash_would_be_zero, PROB_FAIR, >> COUNT_UNKNOWN); >> 5743: avoid_zero_hash_region->init_req(1, >> IfTrue(iff_hash_would_be_zero)); >> 5744: Node* class_hashcode_masked = AndI(result_empty, >> hash_mask_con); > > The mask was already applied in `LibraryCallKit::get_hashcode_from_header()`. Yes, you're correct. I guess I turned a bit mask-paranoid... We still mask after the phi on the 3 cases, and in the case 1., the input is result_empty and the mask is needed only in cases 2. and 3., but I still prefer And(Phi(result_empty, result_int, result_long), mask) over Phi(result_empty, And(result_int, mask), And(result_long, mask)) fewer nodes, and it looks more like the Java logic: compute, then mask. > src/hotspot/share/opto/valuetypenode.cpp line 1132: > >> 1130: >> 1131: region->add_req(kit->IfTrue(iff_hash_would_be_zero)); >> 1132: Node* class_hashcode_masked = kit->AndI(klass_hash_con, >> hash_mask_con); > > `klass_hash_con` is a valid hash code from the Java mirror's header, so do we > really need to reapply the mask here? You're right! ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32660#discussion_r4044573982 PR Review Comment: https://git.openjdk.org/jdk/pull/32660#discussion_r4044556877
