RFR: 8250989: Consolidate buffer allocation code for CDS static/dynamic dumping [v2]
Ioi Lam
iklam at openjdk.java.net
Fri Feb 5 23:35:45 UTC 2021
On Fri, 5 Feb 2021 23:21:14 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> src/hotspot/share/memory/archiveBuilder.hpp line 208:
>>
>>> 206:
>>> 207: // For global access.
>>> 208: static ArchiveBuilder* _current;
>>
>> This is kind of a strange concept since ArchiveBuilder is a StackObj. Maybe it should just be static if only one thread uses it at a time?
>
> And can a different thread call current() ? yikes.
ArchiveBuilder has temporarily allocated objects such as `ArchiveBuilder::_ptrmap`. These are easily freed when the ArchiveBuilder falls out of scope. For example, in `DynamicArchive::dump()`.
`current()` should be callable only inside the VM thread, where the dumping operations take place. I'll add an assert for that.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2296
More information about the hotspot-runtime-dev
mailing list