RFR: 8329764: G1: Handle null references during verification first [v3]

Albert Mingkun Yang ayang at openjdk.org
Wed Apr 10 07:27:04 UTC 2024


On Tue, 9 Apr 2024 18:54:08 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> this change speeds up the common case (no error, null references),

That's true, but the new logic is kind of surprising -- the threshold is checked after we de-ref the field; I would have expected the threshold controls the field-iteration/de-ref.

> making the VM exit faster after an error would require some way to abort iteration

I've noticed that the current iteration API lacks support for early returns...

In the optimal scenario:


for (field in obj) {
  oop = *field;

  if (oop == null)
    continue;

  if (!is_correct(oop)) {
    ++failure;
    if (failure >= threshold) {
      break;
    }
  }
}


Since threshold is only accessed during failure cases, the impact on performance should be minimal.

(This implementation relies on a new iteration API, and there may be overlooked details necessary for its proper functionality. Feel free to merge the current PR.)

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

PR Comment: https://git.openjdk.org/jdk/pull/18650#issuecomment-2046707744


More information about the hotspot-gc-dev mailing list