[lworld] RFR: 8376171: [lworld] Enable storing the hash code in the mark word of value objects [v2]

Tobias Hartmann thartmann at openjdk.org
Mon Jan 26 06:55:22 UTC 2026


On Fri, 23 Jan 2026 15:41:44 GMT, Paul Hübner <phubner at openjdk.org> wrote:

>> Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Use markWord::no_hash
>
> src/hotspot/share/prims/jvm.cpp line 799:
> 
>> 797:       }
>> 798:     }
>> 799:     hash = result.get_jint() & markWord::hash_mask;
> 
> I don't think it's a good idea to do mask ops outside of the markWord, because it gets difficult to find them and maintain them. Can we introduce a helper function inside the markWord to do this for us?

Actually, `markWord::copy_set_hash` just below already does the marking, so we could go with something like this:


// Store hash in the mark word
markWord mark = ho->mark().copy_set_hash(result.get_jint());
ho->set_mark(mark);

return checked_cast<jint>(mark.hash());


What do you think?

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1954#discussion_r2726510944


More information about the valhalla-dev mailing list