RFR: 8074101: Add verification that all tasks are actually claimed during roots processing

Kim Barrett kbarrett at openjdk.java.net
Tue Jan 12 15:05:02 UTC 2021


On Tue, 12 Jan 2021 11:13:29 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> The first commit removes some obsolete enum items, while the second commit adds the verification logic. Commit 2 introduces some "empty" task claims for the verification logic, explicitly marked in the comments.
> 
> Test: hotspot_gc

src/hotspot/share/gc/g1/g1RootProcessor.cpp line 66:

> 64:   // already processed in java roots.
> 65:   _process_strong_tasks.try_claim_task(G1RP_PS_CodeCache_oops_do);
> 66: #endif

Rather than these fake claims, consider something like this:

template<typename... Ts>
void all_tasks_completed(uint nworkers, Ts... tags) {
  // Type-check more_skipped are all of the same type as first_skipped.
  T0 typed_skipped[] = { first_skipped, more_skipped... };
  uint skipped[] = { static_cast<uint>(tags)... };
  all_tasks_completed_impl(nworkers, skipped, ARRAY_SIZE(skipped));
}

void all_tasks_completed(uint nworkers) {
  all_tasks_completed_impl(nworkers, nullptr, 0);
}

Usage:

all_tasks_completed(n_workers(),
                    G1RP_PS_CodeCache_oops_do,
                    G1RP_PS_refProcessor_oops_do)

all_tasks_completed_impl can check that all tasks have been claimed except
the skipped ones, which have not been claimed.

There might be better ways to write the variadic all_tasks_completed.  It's
been a while since I've done anything with variadic templates.

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

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



More information about the hotspot-gc-dev mailing list