[lworld] RFR: 8373442: [lworld] Fix CDS heap dumping crashes

Coleen Phillimore coleenp at openjdk.org
Wed Dec 10 20:49:48 UTC 2025


On Wed, 10 Dec 2025 19:17:55 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/cds/aotStreamedHeapWriter.cpp line 393:
>> 
>>> 391:   narrowKlass nk = ArchiveBuilder::current()->get_requested_narrow_klass(src_klass);
>>> 392: 
>>> 393:   markWord mw = Arguments::enable_preview() ? src_klass->prototype_header() : markWord::prototype();
>> 
>> Why is `Arguments::enable_preview()` check necessary here but not in aotMappedHeapWriter.cpp‎?
>
> Yes, these should fail too.
> Edit.  No they don't fail because they test Universe::objectArrayKlass() which is a default RefArrayKlass and that class doesn't set any special flattening or other bits in the markWord, so markWord::prototype() is okay there.  But this code is confusing and fragile and should be rewritten.

It should be refactored in mainline now that Valhalla uses Klass::_prototype_header, like COH, we should always use it unconditionally for object allocation.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1784#discussion_r2608160643


More information about the valhalla-dev mailing list