RFR: JDK-8298597 : HdrSeq: support for a merge() method

Y. Srinivas Ramakrishna ysr at openjdk.org
Fri Dec 16 03:35:51 UTC 2022


On Thu, 15 Dec 2022 19:33:36 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:

> A merge functionality on stats (distributions) was needed for the remembered set scan that I was using in some companion work. This PR implements a first cut at that, which is sufficient for our first (and only) use case.
> 
> Unfortunately, for expediency, I am deferring work on decaying statistics, as a result of which users that want decaying statistics will get incorrect results.
> 
> In the sort term, before I open this draft for review, I'll:
> 
> - [x] add tests
> - [x] ensure that if a merge action has been taken on a distribution, then any attempt to access a decayed statistic causes an error
> - [x] open a linked ticket to take care of the decayed statistics
> 
> An important goal here was to have an API that would be efficient and correct. The API shape may change when we have considered how to handle decaying statistics.

Will leave these comments here in the draft PR, until the last two steps are completed and the PR opened for formal review.

This PR is open for review.

src/hotspot/share/gc/shenandoah/shenandoahNumberSeq.cpp line 59:

> 57:   if (v > 0) {
> 58:     mag = 0;
> 59:     while (v > 1) {

This is a bug fix that has been independently pushed to tip. You can ignore it and it'll find its way into shenandoah in due course.

src/hotspot/share/gc/shenandoah/shenandoahNumberSeq.hpp line 55:

> 53: 
> 54:   // Merge this HdrSeq into hdr2, optionally clearing this HdrSeq
> 55:   void merge(HdrSeq& hdr2, bool clear_this = true);

The default setting here is based on the way its only current client (RS scan instrumentation) makes use of it, but I am happy to change it if reviewers feel that might be better for API hygiene reasons.

src/hotspot/share/utilities/numberSeq.cpp line 124:

> 122:   // Decaying stats need a bit more thought
> 123:   assert(abs2._alpha == _alpha, "Caution: merge incompatible?");
> 124:   // guarantee(false, "NYI");

This will expand into setting some breadcrumbs in `abs2`, such that any attempt to query a decayed stat from the object will result in an error.

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

PR: https://git.openjdk.org/shenandoah/pull/184


More information about the shenandoah-dev mailing list