Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8340396

SA could do better with the Object header _mark field when using Compact Object Headers

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 24
    • hotspot
    • None

      The issue is discussed in the following PR comments:

      https://github.com/openjdk/jdk/pull/20677#discussion_r1731866842

      In summary, the _mark field not only contains bits of interest (and thus should be printed as an int), but also is how you get to the Klass*, thus should be printed as a class name. When not using Compact Object Headers, currently we see this from the clhsdb inspect command:

      hsdb> + inspect 0x00000007cff154b8
      instance of Oop for java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject @ 0x00000007cff154b8 (size = 24)
      _mark: 1
      _metadata._compressed_klass: InstanceKlass for java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject
      firstWaiter: Oop for java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionNode @ 0x00000007cfff5f80
      lastWaiter: Oop for java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionNode @ 0x00000007cfff5f80
      this$0: Oop for java/util/concurrent/locks/ReentrantLock$NonfairSync @ 0x00000007cff15498

      Notice the presence of both the _mark field and also the _metadata._compressed_klass field expanding to the class name. With Compressed Object headers we only see the _mark field:

      _mark: 16294762323640321

      From the PR discussion:

      "Thinking about this a bit more, maybe _mark needs to be a MetadataField rather than CInt. This is a kind of odd situation. Basically we have a CInt field that is more than just simple bits used as flags or small integers. It also gets you to the Klass*. Possibly SA should treat _mark is two separate fields; one that remains a CInt as it currently is and another that treats it as an encoded Klass* like the NarrowKlassField case."

            Unassigned Unassigned
            cjplummer Chris Plummer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: