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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • b45


        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

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

                Created:
                Updated:
                Resolved: