RFR: 8362657: Make tables used in AOT assembly phase GC-safe [v2]

Ioi Lam iklam at openjdk.org
Tue Jul 22 06:50:50 UTC 2025


On Tue, 22 Jul 2025 06:11:28 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Ioi Lam has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>> 
>>  - Fixed 32-bit builds
>>  - Merge branch 'premain' into 8362657-make-aot-assembly-tables-gc-safe
>>  - Fixed white spaces
>>  - 8362657: Make tables used in AOT assembly phase GC-safe
>
> src/hotspot/share/cds/heapShared.hpp line 389:
> 
>> 387: 
>> 388:   static CachedOopInfo* get_cached_oop_info(oop orig_obj) {
>> 389:     OopHandle oh(&orig_obj);
> 
> `OopHandle`-s have no destructors, so this leaks?

This only allocates a temporary `OopHandle` on the stack for the purpose of doing a look-up. The storage of this is allocated on the stack (the address of the local variable `obj`). So there's no leak here.


  OopHandle oh(&obj);
  return archived_object_cache()->get(oh) != nullptr;


When an `OopHandle` is stored in the `archived_object_cache()`, we will allocate the storage from `Universe::vm_global()`. This  storage should be freed when the `archived_object_cache()` is deleted, but we currently never delete that table, as we assume the VM will soon exit after AOT assembly is done.

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

PR Review Comment: https://git.openjdk.org/leyden/pull/86#discussion_r2221395063


More information about the leyden-dev mailing list