RFR: 8272609: Add string deduplication support to SerialGC

Kim Barrett kbarrett at openjdk.java.net
Thu Aug 19 05:28:22 UTC 2021


On Wed, 18 Aug 2021 02:24:11 GMT, Denghui Dong <ddong at openjdk.org> wrote:

> Hi team,
> 
> Please help review this change to add string deduplication support to SerialGC.
> 
> Thanks,
> Denghui

The changes mostly look okay.

But it's not obvious that string deduplication support is useful for SerialGC. The kinds of applications SerialGC is often used for don't really benefit from string deduplication. Can someone suggest a good use-case?

One possible benefit is that if Epsilon is the only collector not supporting string deduplication then we might be able to simplify the string deduplication tests, replacing the per-GC test descriptions with just one to require !Epsilon and otherwise use whatever the current GC happens to be.

src/hotspot/share/gc/serial/markSweep.hpp line 116:

> 114:   static SerialOldTracer*                _gc_tracer;
> 115: 
> 116:   static StringDedup::Requests _string_dedup_requests;

Avoid non-local variables with non-trivial / not-constexpr constructors or destructors.  Better would be a pointer to a Requests object that is initially NULL and assigned by an initialization function or per collection, as is done for some of the other nearby variables.  Yes, there are also some variables here that violate this; that's not a reason to add to that collection.  (Note that the Style Guide currently mistakenly refers to "namespace-scoped" rather than "non-local" variables - JDK-8272691.)

src/hotspot/share/gc/shared/stringdedup/stringDedupConfig.cpp line 119:

> 117:   if (!UseStringDeduplication) {
> 118:     return true;
> 119:   } else if (!UseG1GC && !UseShenandoahGC && !UseZGC && !UseSerialGC) {

This will, of course, have a merge conflict with JDK-8267185.

-------------

Changes requested by kbarrett (Reviewer).

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



More information about the hotspot-gc-dev mailing list