RFR: 8253037: G1: Improve check for string dedup

Kim Barrett kbarrett at openjdk.java.net
Mon Nov 2 11:08:57 UTC 2020

On Mon, 2 Nov 2020 08:41:17 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Please review this change to G1 evacuation's checking for string
>> deduplication.  The old code would go out of line to the G1StringDedup
>> support code for every object when deduplication is enabled, only to usually
>> discover the object isn't a string.  Instead we now have a simpl inline
>> test for the combination of dedup enabled and object is a string, and only
>> call out to the dedup support code when that's true.  This eliminates some
>> work for every non-string (non-array) object when dedup is enabled.
>> The performance impact seems to be pretty small and hard to measure, since
>> enabling deduplication has other costs that seem to overwhelm the cost
>> here.  I'm hoping to improve that with JDK-8254598.
>> Testing:
>> tier1 on Oracle supported platforms.
>> Performance testing with deduplication enabled.
> src/hotspot/share/gc/g1/g1StringDedup.hpp line 78:
>> 76:   // thread. Before enqueuing, these functions apply the appropriate candidate
>> 77:   // selection policy to filters out non-candidates.
>> 78:   static void enqueue_from_mark(oop obj, uint worker_id);
> As Albert mentioned, it would be nice if the caller of this would also get this optimization as it seems straightforward to implement there as well for consistency.
> While the caller does not get the ```Klass*``` directly, it already reads the mark oop, so getting the ```Klass``` there should be practically free too.

Because of compressed klasses, getting the klass is never completely trivial.  However, since effectively the first thing done by enqueue_from_mark is to test for the obj being a String, hoisting that out to fullgc's mark_object seems reasonable.  And that gives the consistency between the enqueue functions that Albert asked for.  I'll add that to the PR after re-running tests.


PR: https://git.openjdk.java.net/jdk/pull/981

More information about the hotspot-gc-dev mailing list