--- old/src/hotspot/share/gc/shared/cardGeneration.cpp 2020-08-25 10:03:52.896490369 +0200 +++ new/src/hotspot/share/gc/shared/cardGeneration.cpp 2020-08-25 10:03:52.720487403 +0200 @@ -307,8 +307,13 @@ blk->do_space(space()); } -void CardGeneration::younger_refs_iterate(OopsInGenClosure* blk, uint n_threads) { - blk->set_generation(this); - younger_refs_in_space_iterate(space(), blk, n_threads); - blk->reset_generation(); +void CardGeneration::younger_refs_iterate(OopIterateClosure* blk, uint n_threads) { + // Apply "cl->do_oop" to (the address of) (exactly) all the ref fields in + // "sp" that point into younger generations. + // The iteration is only over objects allocated at the start of the + // iterations; objects allocated as a result of applying the closure are + // not included. + + HeapWord* gen_boundary = reserved().start(); + _rs->younger_refs_in_space_iterate(space(), gen_boundary, blk, n_threads); }