RFR: 8371369: Parallel: Relax precondition of PSOldGen::expand_and_allocate

Axel Boldt-Christmas aboldtch at openjdk.org
Fri Nov 7 07:21:01 UTC 2025


On Wed, 5 Nov 2025 19:29:13 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Use more precise precondition for heap/old-gen expansion; the same precondition is also used in its sole caller.
> 
> Test: tie1-5

src/hotspot/share/gc/parallel/psOldGen.cpp line 121:

> 119: 
> 120: HeapWord* PSOldGen::expand_and_allocate(size_t word_size) {
> 121:   assert(Heap_lock->is_locked(), "precondition");

Are these methods fine to call from a non safepoint after we have started the GC? If they are not. We should not loosen the precondition this much.

Suggestion:

  precond(Heap_lock->is_locked());
  precond(!is_init_completed() || SafepointSynchronize::is_at_safepoint());
  precond(!is_init_completed() || Thread::current()->is_VM_thread());

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28162#discussion_r2501948145


More information about the hotspot-gc-dev mailing list