RFR: 8343767: Enumerate StubGen blobs, stubs and entries and generate code from declarations
Vladimir Ivanov
vlivanov at openjdk.org
Wed Nov 20 15:28:29 UTC 2024
On Thu, 14 Nov 2024 14:50:47 GMT, Andrew Dinn <adinn at openjdk.org> wrote:
>> src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp line 427:
>>
>>> 425: address generate_catch_exception() {
>>> 426: StubGenStubId stub_id = StubGenStubId::catch_exception_id;
>>> 427: StubCodeMark mark(this, stub_id);
>>
>> Stylistic suggestion: for such trivial cases, you can simply pass `StubGenStubId` constant as an argument. No need to declare a local for it.
>
> When we come to add save and restore we will need to have the id to do the AOT cache lookup then generate the stub if not found on a production run as well as to write the stub if this is an assembly run. So, I'll leave this a is for then.
>
> Also, at some point I want to add an assert that the stub generator should be 'expecting' this stub which means I will need to pass it this id. A stub generator knows which blob it is writing into (it gets passed the blob id when constructed) and the template macros generate a debug-only method to translate a stub id to the blob (id) named in the stub declaration. So, we can use that to cross-check that the declared blob matches the one the stub gets written to. Quite a few (generic) stubs were being written to different blobs by different arches so it will be good to ensure they end up in the same blob.
>
> That's not 100% the full picture just now because we also have StubGenerator instances responsible for writing the icache flush stub and (on x86 only) vm_version stubs and they have no associated blob id. I'd like to fold those stubs and their associated blobs into the declaration structure too at some point. For now I'll make sure they are associated with blob_id == NO_BLOBID.
Ok, it makes sense. As an idea, `StubCodeMark` can be used to hide some of that logic. (As an example, different marks on MacroAssembler mess with its instances to customize their behavior.)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21957#discussion_r1842780446
More information about the hotspot-dev
mailing list