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

Make Mutex::_no_safepoint_check_flag locks verify that this lock never checks for safepoint

    Details

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

      Backports

        Description


        When locking with MutexLockerEx(SOMELOCK, Mutex::_no_safepoint_check_flag) if some other code locks without Mutex::_no_safepoint_check_flag, the JVM will deadlock. The JVM should have some check that prevents you from doing this. From email discussion:

        On 6/17/14, 6:11 AM, Mikael Gerdin wrote:
        > I wish there was a consistency check though. If you take a lock without
        > checking for safepoint, we should give an assertion if you take the same
        > lock and check for safepoint. Not sure if there's an easy way to code
        > it, but I think it would be worth having.

        Can't we use the type system for this?

        Have a
        class NoSafepointCheckMutex which always elides safepoint checks
        and a
        class Mutex which does not allow elision of safepoint checks.

        /Mikael

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mockner Max Ockner (Inactive)
                  Reporter:
                  coleenp Coleen Phillimore
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: