RFR: Shenandoah string deduplication

Zhengyu Gu zgu at redhat.com
Thu Dec 7 14:06:28 UTC 2017


A minor update: removed creation of unused StringDedupTable_lock:

--- old/src/hotspot/share/runtime/mutexLocker.cpp	2017-12-07 
08:57:03.732839267 -0500
+++ new/src/hotspot/share/runtime/mutexLocker.cpp	2017-12-07 
08:57:03.383839085 -0500
@@ -202,9 +202,6 @@
      def(SATB_Q_FL_lock             , PaddedMutex  , access,      true, 
  Monitor::_safepoint_check_never);
      def(SATB_Q_CBL_mon             , PaddedMonitor, access,      true, 
  Monitor::_safepoint_check_never);
      def(Shared_SATB_Q_lock         , PaddedMutex  , access + 1,  true, 
  Monitor::_safepoint_check_never);
-    // Shenandoah needs (special-1) rank of the lock, because write 
barrier can evacuate objects while
-    // thread holding other locks, such as CodeCache_lock, etc.
-    def(StringDedupTable_lock      , PaddedMutex  , special-1,   true, 
Monitor::_safepoint_check_never);
    }
    def(ParGCRareEvent_lock          , PaddedMutex  , leaf     ,   true, 
  Monitor::_safepoint_check_sometimes);
    def(DerivedPointerTableGC_lock   , PaddedMutex  , leaf,        true, 
  Monitor::_safepoint_check_never);


Webrev: http://cr.openjdk.java.net/~zgu/shenandoah/sh_strdedup/webrev.01/

Thanks,

-Zhengyu



On 12/06/2017 02:48 PM, Roman Kennke wrote:
> Am 06.12.2017 um 18:15 schrieb Zhengyu Gu:
>> The implementation takes different approach from G1's implementation.
>>
>> * It treats string dedup queue/table as weak roots.
>>
>> * It identifies deduplication candidates during concurrent marking and 
>> during full gc, to reduce impact on pause time.
>>
>> * To properly identify the candidates, it manipulates string's age 
>> field concurrently, to prevent from processing string too early or 
>> deduplicating the same string over and over again. While it is 
>> undesirable, it reduces the risk by only manipulating *regular* 
>> strings - when they do not have displaced headers. Locked objects are 
>> relative rare, especially for immutable objects, such as Strings.
>>
>> * Deduplicate routine is implemented lock-free, in case we have to 
>> embed it in barriers.
>>
>> * Reverted all early changes to G1's implementation
>>
>> Webrev: http://cr.openjdk.java.net/~zgu/shenandoah/sh_strdedup/webrev.00/
>>
>> Test:
>>    hotspot_gc_shenandoah (fastdebug and release)
>>    specJBB               (fastdebug and release)
>>
>>
>> Thanks,
>>
>> -Zhengyu
> 
> src/hotspot/share/classfile/stringTable.cpp:
> /me makes a note that this warrants a GC interface
> 
> Other than that, I like it! :-)
> 
> Probably warrants another pair of eyes.
> 
> Roman
> 


More information about the shenandoah-dev mailing list