RFR: 8290464: Optimize ResourceArea zapping on ResourceMark release [v2]

Aleksey Shipilev shade at openjdk.org
Tue Jul 19 14:57:02 UTC 2022


On Tue, 19 Jul 2022 13:36:21 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/hotspot/share/memory/resourceArea.hpp line 140:
>> 
>>> 138:       // up to replaced hwm.
>>> 139:       if (ZapResourceArea) {
>>> 140:         char* limit = have_more_chunks ? _max : replaced_hwm;
>> 
>> I'd feel better if we instead did a range check on _hwm with the chunks boundaries. Zap the whole chunk if replaced hwm falls outside the current chunk.
>> 
>> 
>> limit = (_chunk->contains(replaced_hwm)) ? replaced_hwm : max;
>> 
>> That's at least clearer intent and possibly safer.
>> 
>> Also means you don't need your new "have_more_chunks" variable.
>
> Oh, and an assert would be nice that if we rollback inside the same chunk that the new hwm is smaller than the old one.

Right. See new commit. This passes `tier1`, and I am re-running timing tests now...

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

PR: https://git.openjdk.org/jdk/pull/9543


More information about the hotspot-runtime-dev mailing list