RFR: 8372617: Save and restore stubgen stubs when using an AOT code cache [v3]

Andrew Dinn adinn at openjdk.org
Tue Jan 20 11:58:14 UTC 2026


On Tue, 2 Dec 2025 17:00:49 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:

>> Andrew Dinn has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   asmehra feedback
>
> src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 2184:
> 
>> 2182:     // the normal stub provides a 2nd entry which omits the frame push
>> 2183:     // for use when bailing out from a disjoint copy
>> 2184:     // We need to protect memory accesses in certain cases
> 
> This comment doesn't seem to be applicable here. I don't see an `UnsafeMemoryAccessMark`.

Removed

> src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 2452:
> 
>> 2450:     __ b(RuntimeAddress(long_copy_entry));
>> 2451: 
>> 2452:     // record the stub entry and end plus any no_push entry
> 
> Comment refers to "no_push entry", but there is none here. I guess a result of copy-paste.

Removed

> src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 2739:
> 
>> 2737:     __ ret(lr);
>> 2738: 
>> 2739:     // record the stub entry and end plus any no_push entry
> 
> Same as before, comments refers to "no_push entry".

Removed

> src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp line 799:
> 
>> 797: 
>> 798:   vmovdqu(BYTE_FLIP_MASK, ExternalAddress(pshuffle_byte_flip_mask_addr +  0)); // [PSHUFFLE_BYTE_FLIP_MASK wrt rip]
>> 799:   vmovdqu(SHUF_00BA,      ExternalAddress(pshuffle_byte_flip_mask_addr + 32)); // [_SHUF_00BA wrt rip]
> 
> Now that we have `StubRoutines::x86::pshuffle_byte_flip_mask_00ba_addr()`, I think it should replace `pshuffle_byte_flip_mask_addr + 32`. Makes the usage of these addresses explicit.

In all cases I got rid of the local var (pshuffle_byte_flip_mask) and passed the relevant arch-specific stub entry addresses direct to the asserts and to the assembler methods.

> src/hotspot/cpu/x86/macroAssembler_x86_sha.cpp line 1358:
> 
>> 1356:     assert(pshuffle_byte_flip_mask_addr + 32 == StubRoutines::x86::pshuffle_byte_flip_mask_ymm_lo_addr_sha512(), "sanity");
>> 1357: 
>> 1358:   vmovdqu(BYTE_FLIP_MASK, ExternalAddress(pshuffle_byte_flip_mask_addr +  0)); // PSHUFFLE_BYTE_FLIP_MASK wrt rip
> 
> Indentation is off

Fixed

> src/hotspot/cpu/zero/stubRoutines_zero.cpp line 35:
> 
>> 33: 
>> 34: #if INCLUDE_CDS
>> 35: // nothing to do for xero
> 
> xero->zero

Fixed

> src/hotspot/share/code/aotCodeCache.cpp line 1998:
> 
>> 1996: void AOTCodeAddressTable::set_c1_stubs_complete() {
>> 1997:   assert(!_c1_stubs_complete, "repeated close for c1 stubs!");
>> 1998:   _c2_stubs_complete = true;
> 
> should be setting `_c1_stubs_complete`

Fixed

> src/hotspot/share/code/aotCodeCache.hpp line 245:
> 
>> 243:   ~AOTStubData()    CDS_ONLY({FREE_C_HEAP_ARRAY(StubAddrRange, _ranges);}) NOT_CDS({})
>> 244: 
>> 245:     bool is_open()  CDS_ONLY({ return (_flags & OPEN) != 0; }) NOT_CDS_RETURN_(false);
> 
> extra indentation

Fixed

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28433#discussion_r2708021231
PR Review Comment: https://git.openjdk.org/jdk/pull/28433#discussion_r2708022354
PR Review Comment: https://git.openjdk.org/jdk/pull/28433#discussion_r2708023702
PR Review Comment: https://git.openjdk.org/jdk/pull/28433#discussion_r2708032933
PR Review Comment: https://git.openjdk.org/jdk/pull/28433#discussion_r2708027599
PR Review Comment: https://git.openjdk.org/jdk/pull/28433#discussion_r2708028805
PR Review Comment: https://git.openjdk.org/jdk/pull/28433#discussion_r2708026402
PR Review Comment: https://git.openjdk.org/jdk/pull/28433#discussion_r2708025864


More information about the hotspot-dev mailing list