On Fri, 27 Mar 2026 12:22:18 GMT, David Holmes <[email protected]> wrote:
>> I don't think it does. The mark word is just another way to query the >> information that we get from by querying the class. >> >> In fact, I have a prototype that completely removes these `functions` from >> the mark word and let all C++ code go through the Klass pointer. This cuts >> down on the complexity and some of the risks of those bits being unstable >> while inflating object monitors. Left are the JIT compilers using those >> bits, and having to navigate around the locking code. > > If the markword logic is going away then sure. I have to query why we > have/had two ways of querying this though? Optimization? My understanding is that this was implemented as optimizations, but things get complicated because of object monitors and displaced mark words, and the optimizations bring conditional branches. I've looked through the C++ code and can't see anything where these optimizations seems to be necessary compared to the overhead of the surrounding code. C2 still uses these mark word bits for creating optimized code. My wish is to make it so that the `oopDesc::is_` functions call into `obj->klass()->is_` functions. If we ever find a place in the C++ code where we get noticeably penalized for decoding the klass pointer, then we place a localized mark-word check optimization there. And then we evaluate if that optimization really gives us the sought after performance benefit that we hoped to get. ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2261#discussion_r3001006178
