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

Erik Österlund eosterlund at openjdk.org
Fri Nov 7 10:06:07 UTC 2025


On Fri, 7 Nov 2025 07:18:42 GMT, Axel Boldt-Christmas <aboldtch 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());

While it's true the assert is more loose than it needs to be, if we want the tighter assert here, then we should probably use that tighter assert in all the other places that were loosened too. If we want to do that, could we do that in a follow-up PR instead? I have done pre-integration testing with the object streaming JEP with the changes here, and if we poke around at the asserts again, I'm gonna have to re-run the tests again before integrating.

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

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


More information about the hotspot-gc-dev mailing list