RFR: 8229839: Break circular dependency between oop.inline.hpp and markWord.inline.hpp

Tony Printezis tprintezis at twitter.com
Mon Aug 19 18:37:59 UTC 2019

Hey Stefan,

This looks good. Would it be helpful to introduce:

inline bool oopDesc::mark_must_be_preserved() const {
  return mark_must_be_preserved(mark_raw());

for the cases where you don’t already have the mark word? But I only saw of
places where that’s the case...


Tony Printezis | @TonyPrintezis | tprintezis at twitter.com

On August 19, 2019 at 10:21:58 AM, Stefan Karlsson (
stefan.karlsson at oracle.com) wrote:

Hi all,

Please review this patch to break the circular dependency between
oop.inline.hpp and markWord.inline.hpp.


The patch removes the call to oopDesc::klass() from markWord.inline.hpp.
This is done by passing in the klass from callers to the different
markWord::must_be_preserved functions.

Some of the paths inside markWord::must_be:preserved don't need the
klass, and calling oopDesc::klass() in those cases would be wasteful. To
prevent this, I changed the code to allow the callers to provide a
KlassProxy that can resolve to a const Klass* when and if a Klass is
needed. I'm not sure if this is needed or not, but I didn't want to
pessimise the code by introducing new calls to oopDesc::klass().

I also took the opportunity to consolidate and remove some code
duplication in must_be_preserved functions. This could of course be
split into a separate patch if that's requested.

Testing done locally. Will run tier123.


More information about the hotspot-gc-dev mailing list