RFR: 8354887: Preserve runtime blobs in AOT code cache

Ashutosh Mehra asmehra at openjdk.org
Mon May 5 15:14:47 UTC 2025


On Sat, 3 May 2025 23:30:44 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> We need to do something about Compressed Klass base:

I too feel bailing out is too restrictive. In my tests I have seen this happening too frequently to ignore.

> Which blob/stubs decompress/compress klass using the base?

`CompressedKlassPointers::base()` is called by C1 blob for `is_instance_of` [0].

[0] https://github.com/openjdk/jdk/blob/1501a5e41e59162a374cf5b8cfc37faced48a6ed/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp#L1131
https://github.com/openjdk/jdk/blob/1501a5e41e59162a374cf5b8cfc37faced48a6ed/src/hotspot/cpu/x86/macroAssembler_x86.cpp#L5439

> May be we should use Relocation for it.

@vnkozlov How about updating `decode_klass_not_null` like this?


  if (CompressedKlassPointers::base() != nullptr) {
    if (AOTCodeCache::is_on_for_dump()) {
      movptr(tmp, ExternalAddress(CompressedKlassPointers::base_addr()));
    } else {
      mov64(tmp, (int64_t)CompressedKlassPointers::base());
    }
    addq(r, tmp);
  }


and adding `CompressedKlassPointers::base_addr()` to the AOTAddressTable.

> I think we have relocation for CompressedOops::base() so we can patch.

We have relocation for `CompressedOops::base()` only when heap is not yet initialized:


void MacroAssembler::reinit_heapbase() {
  if (UseCompressedOops) {
    if (Universe::heap() != nullptr) {
      if (CompressedOops::base() == nullptr) {
        MacroAssembler::xorptr(r12_heapbase, r12_heapbase);
      } else {
        mov64(r12_heapbase, (int64_t)CompressedOops::base());
      }
    } else {
      movptr(r12_heapbase, ExternalAddress(CompressedOops::base_addr()));
    } 
  } 
}


In premain we do add `CompressedOops::base_addr()` to the AOT Address table. But I don't think we are accessing `CompressedOops::base` in adapters or blobs that we are targeting in mainline. At least I haven't come across the need to have `CompressedOops::base` in the address table. Is that correct @vnkozlov @adinn ?

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

PR Comment: https://git.openjdk.org/jdk/pull/25019#issuecomment-2851321094
PR Comment: https://git.openjdk.org/jdk/pull/25019#issuecomment-2851326869
PR Review Comment: https://git.openjdk.org/jdk/pull/25019#discussion_r2073639605


More information about the hotspot-runtime-dev mailing list