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

Remove unnecessary assertions in ObjectSynchronizer FastHashcode and inflate

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 16
    • Fix Version/s: 16
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b11

      Description

      JDK-6320749 discusses a problem with the assertion originally added to ObjectSynchronizer::FastHashcode,

      assert(!SafepointSynchronize::is_at_safepoint(), "invariant");

      the reasoning for which was stated as:

      "hashCode() can be a heap mutator. Given that, it seems unwise to call hashCode while at a safepoint. Can parallelscavange tolerate the markwords changing at this point? (Are the markwords known intact in this situation?)"

      but a "verify_in_progress" relaxation check was added to address the problem in 6320749, and we have since further added a relaxation for DumpSharedSpaces:

       assert(Universe::verify_in_progress() || DumpSharedSpaces ||
       !SafepointSynchronize::is_at_safepoint(), "invariant");

      The same initial !is-at-safepoint assertion was also added to ObjectSynchronizer::inflate - with the same basic mutation-of-markword rationale. But monitor deflation, which also mutates the markword, has until recently always been performed at a safepoint and ergo markWord mutation at a safepoint must be safe, and thus both assertions can be removed.

      These assertions can be tripped if inflation happens to occur when querying the identity_hash of an object, during a CDS dump safepoint.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dholmes David Holmes
              Reporter:
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: