RFR: 8358546: [premain] AOT code generation should support UseCompactObjectHeaders

Aleksey Shipilev shade at openjdk.org
Fri Jun 6 09:25:06 UTC 2025


On Fri, 6 Jun 2025 04:59:40 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

> COH testing was added to tier3 which we use in premain branch testing. And we noticed that `runtime/cds/appcds/aotCode/` tests crashes during "production" run when UseCompactObjectHeaders is on.
> 
> There were five issues when AOT code is generated with COH:
>  - missing CompressedKlassPointers::base() relocation on x86 in `MacroAssembler::decode_and_move_klass_not_null()`
>  - missing CKP:base() relocation on aarch64 in `MacroAssembler::cmp_klass()` because `decode_klass_not_null_for_aot()` was not called
>  - On aarch64 full AOT encoding/decoding code for compressed klass pointers was generated even when base is NULL. Do special AOT code only when base is not NULL, similar to code on x64.
>  - Record CKP::basse in AOT code cache configuration and check it on load similar to what we do for compressed oops base.
>  - Prototype header value for new allocated object is embedded into C2 generated code as constant. But with COH the prototype also contains encoded class. This class encoding (and prototype header) could be change when CDS store this information in archive. We need to load it in code.
> 
> Tested tier1-3

Looks reasonable.

src/hotspot/share/code/aotCodeCache.cpp line 771:

> 769:   }
> 770: 
> 771:   if ((_compressedKlassBase == nullptr || CompressedKlassPointers::base() == nullptr) && (_compressedKlassBase != CompressedKlassPointers::base())) {

I am guessing we only disable `AOTStubCaching`, and not `AOTCodeCaching` wholesale, because the normal code deals with this properly. Correct?

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

Marked as reviewed by shade (Committer).

PR Review: https://git.openjdk.org/leyden/pull/78#pullrequestreview-2904276876
PR Review Comment: https://git.openjdk.org/leyden/pull/78#discussion_r2131805445


More information about the leyden-dev mailing list