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

Remove unnecessary assertions in ObjectSynchronizer FastHashcode and inflate

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 16
    • 16
    • hotspot
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: