While trying to reproduce JDK-8288970, I hit the following assert when executing runtime/cds/appcds/dynamicArchive/LotsUnloadTest3.java (attached to JDK-8288970):
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/workspace/open/src/hotspot/share/gc/g1/g1RemSet.cpp:1270), pid=310717, tid=310802
# assert(bitmap->get_next_marked_addr(hr->bottom(), hr->end()) == hr->end()) failed: Bitmap should have no mark for region 2
#
# JRE version: Java(TM) SE Runtime Environment (20.0+9) (fastdebug build 20-ea+9-487)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 20-ea+9-487, compiled mode, tiered, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0xe598e2] G1MergeHeapRootsTask::G1ClearBitmapClosure::do_heap_region(HeapRegion*)+0xa2
Stack: [0x00007fae651ec000,0x00007fae652ec000], sp=0x00007fae652eab00, free space=1018k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xe598e2] G1MergeHeapRootsTask::G1ClearBitmapClosure::do_heap_region(HeapRegion*)+0xa2
V [libjvm.so+0xd87843] G1CollectedHeap::par_iterate_regions_array(HeapRegionClosure*, HeapRegionClaimer*, unsigned int const*, unsigned long, unsigned int) const+0xe3
V [libjvm.so+0xe71231] G1MergeHeapRootsTask::work(unsigned int)+0x1e1
V [libjvm.so+0x1be5a00] WorkerThread::run()+0x80
V [libjvm.so+0x1a8ebf0] Thread::call_run()+0x100
V [libjvm.so+0x174c663] thread_native_entry(Thread*)+0x103
The test was executed with:
-Xcomp -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,java.lang.invoke.MethodHandles::* -XX:CompileCommand=compileonly,java.lang.invoke.MethodType::*