RFR: 8343767: Enumerate StubGen blobs, stubs and entries and generate code from declarations

Andrew Dinn adinn at openjdk.org
Wed Nov 20 16:34:28 UTC 2024


On Mon, 11 Nov 2024 11:35:21 GMT, Andrew Dinn <adinn at openjdk.org> wrote:

>> src/hotspot/share/runtime/stubDeclarations.hpp line 738:
>> 
>>> 736:   do_entry(compiler, bigIntegerLeftShiftWorker,                         \
>>> 737:            bigIntegerLeftShiftWorker, bigIntegerLeftShift)              \
>>> 738:   AARCH64_ONLY(                                                         \
>> 
>> It's unfortunate to see platform-specific declarations in `stubDeclarations.hpp`. Any chances to keep them in CPU-specific files (as it is shaped now)?
>
> That's a good question and I believe it is the preferred option.
> 
> It would certainly be possible to include a per-arch file (stubDeclarations_<arch>.hpp) to define a common (per-blob) declaration macro providing the arch-specific declarations.
> 
> e.g. for x86 the arch file would specify:
> 
>     #define STUBGEN_INITIAL_BLOBS_ARCH_DO(do_arch_blob, do_stub, repeat_stub, do_arch_entry) \
>       do_arch_blob(initial, 20000 WINDOWS_ONLY(+1000))                    \
>       do_stub(initial, verify_mxcsr)                                      \
>       do_arch_entry(x86, initial, verify_mxcsr, verify_mxcsr_entry,       \
>                     verify_mxcsr_entry)                                   \
>       . . . 
>     #define STUBGEN_FINAL_BLOBS_ARCH_DO(do_arch_blob, do_stub, repeat_stub, do_arch_entry) \
>       . . .
> 
> The generic macro would then paste this in place of the AARCH64_ONLY(), X86_ONLY() sections e.g.
> 
>     #define STUBGEN_INITIAL_BLOBS_DO(do_blob, end_blob,                     \
>                                      do_stub, repeat_stub,                  \
>                                      do_entry, do_entry_init,               \
>                                      do_arch_blob,                          \
>                                      do_arch_entry, do_arch_entry_init)     \
>       do_blob(initial)                                                      \
>       do_stub(initial, call_stub)                                           \
>       . . . 
>       do_entry(initial, dlibm_tan_cot_huge, dlibm_tan_cot_huge,             \
>                dlibm_tan_cot_huge)                                          \
>       STUBGEN_INITIAL_BLOBS_ARCH_DO(do_arch_blob, do_stub,                  \
>                                     repeat_stub, do_arch_entry)
> 
> I did originally plan to split the declarations like this. However, I ended up putting the arch declarations into the generic file in this draft for two reasons. The primary one was heuristic: I wanted to make it easy to see the declaration structure I was proposing before we committed to it. However, I also had a niggling concern that when it comes to updating the declarations it may be easier if they are all in the one place, right next to the doc comments that explain what the declaration format is and what gets generated from the declarations. My experience of writing a stub some years back tells me that it is important to make it easy for developers who are not fully familiar with the runtime to see how all the pieces fit t...

Latest version has arch declarations in arch-specific files

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21957#discussion_r1850632005


More information about the hotspot-dev mailing list