Shenandoah: shenandoahLock related improvments

XMLWordPrintable

    • gc

      To peel off shenandoahLock related improvments from the task https://bugs.openjdk.org/browse/JDK-8373371 to avoid too much unrelated stuff. In JDK-8373371 I need to change the the ShenandoahRebuildLock to be an reentrant lock but based on the spin lock rather than platform monitor(ShenandoahSimpleLock). Instead of add new reentrant lock class with duplicate code like current reentrant lock to extend the class ShenandoahLock, I feel it make sense to do some improvments to get rid of all the duplicate codes in the lock impls, the improvments cover some things related the lock impls in shenandoahLock.hpp(cpp) and the approaches we use them:

      1. make ShenandoahLock(spin lock) and ShenandoahSimpleLock(PlatformMonitor) have same public API(lock/unlock);
      2. templated ShenandoahReentrantLock, we can use either ShenandoahLock or ShenandoahSimpleLock as the base class of ShenandoahReentrantLock;
      3. template based ShenandoahLocker, no need to impl Locker class for each lock with same code
      4. declare lock type aliases(ShenandoahNMethodLock(er)) for NMethod
      5. update rebuild lock to use ShenandoahReentrantLock with spin lock.
      6. strengthen SheandnoahHeapLocker to assert potential dead lock(a thread should never try to acquire SheandnoahHeapLock while it holding the rebuild lock.

            Assignee:
            Xiaolong Peng
            Reporter:
            Xiaolong Peng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: