RFR: 8371178: Preserve fast version of getfield and putfield in AOTCache
Ioi Lam
iklam at openjdk.org
Tue Nov 4 17:33:38 UTC 2025
On Tue, 4 Nov 2025 17:02:21 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:
>> src/hotspot/share/cds/aotMetaspace.cpp line 556:
>>
>>> 554: case ztos:
>>> 555: new_code = Bytecodes::_fast_bgetfield;
>>> 556: break;
>>
>> Why is this `switch` block necessary? Is it possible for `new_code` to be different than `*bcs.bcp()`? If not, it might be easier to initialize `new_code` to `Bytecodes::_illegal` and then do the rewriting only if `new_code` has been updated.
>
>> Why is this switch block necessary? Is it possible for new_code to be different than *bcs.bcp()?
>
> During preimage dumping all the fast bytecodes will be converted to nofast version because the CP entries are not resolved. So in the assembly phase `*bcs.bcp()` would be nofast version. If the CP entry is resolved, we can convert it to fast version. And we determine the type of the fast version using `tos_state` of the resolved field entry. So the `new_code` will be different than the `*bcs.bcp()` in the assembly phase.
> They may be same when dumping dynamic archives, but not when dumping static archive or the final AOTCache.
> Does that help?
I see. Could you add a comment? Maybe the code should be reformatted like this to make it easier to navigate?
case ftos: new_code = Bytecodes::_fast_fgetfield; break;
case dtos: new_code = Bytecodes::_fast_dgetfield; break;
default: ShouldNotReachHere();
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28121#discussion_r2491446913
More information about the hotspot-runtime-dev
mailing list