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

Remove static initialization of monitor/mutex instances

XMLWordPrintable

    • b20

        There are a number of Monitor/Mutex instances that are initialized with C++ static initialization statements. This means they execute when the JVM library is loaded and before any JVM initialization of any sort has occurred. This is only viable for trivial initialization that is independent of all other initialization actions that might occur during VM startup.

        Proposed changes to mutex/monitor code requires non-trivial initialization at the OS level, which means we need to remove the static initialization of these mutex/monitor instances. (it will likely also need a new very early os::init function after which mutex/monitor initialization can take place.

        ./share/utilities/decoder.cpp:Mutex* Decoder::_shared_decoder_lock = new Mutex(Mutex::native, ...
        ./share/services/diagnosticFramework.cpp:Mutex* DCmdFactory::_dcmdFactory_lock = new Mutex(Mutex::leaf, ...
        ./share/jfr/periodic/sampling/jfrThreadSampler.cpp:Monitor* JfrThreadSampler::_transition_block_lock = new Monitor(Mutex::leaf, ...
        ./share/runtime/sweeper.cpp:Monitor* NMethodSweeper::_stat_lock = new Monitor(Mutex::special, ...
        ./share/gc/shared/parallelCleaning.cpp:Monitor* CodeCacheUnloadingTask::_lock = new Monitor(Mutex::leaf, ...
        ./share/runtime/threadSMR.cpp:Monitor* ThreadsSMRSupport::_delete_lock =
                                                                                         new Monitor(Monitor::special, "Thread_SMR_delete_lock",

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

                Created:
                Updated:
                Resolved: