RFR: 8297036: Generalize C2 stub mechanism [v6]

Fei Yang fyang at openjdk.org
Tue Dec 6 03:46:50 UTC 2022


On Wed, 30 Nov 2022 17:51:31 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> Currently, we have two implementations of out-of-line stubs in C2, one for safepoint poll stubs (C2SafepointPollStubTable in output.hpp) and another for nmmethod entry barriers (C2EntryBarrierStubTable in output.hpp). I will need a few more for Lilliput: One for checking lock-stack size in method prologue, one for handling lock failures (both for fast-locking), and another one for load-klass slow-path. It would be good to generalize the mechanism and consolidate the existing uses on the new general mechanism.
>> 
>> Testing:
>>  - [x] tier1 (x86_64, x86_32, aarch64)
>>  - [x] tier2 (x86_64, x86_32, aarch64)
>>  - [x] tier3 (x86_64, x86_32, aarch64)
>
> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
> 
>   More RISCV fixes

src/hotspot/share/opto/c2_CodeStubs.cpp line 52:

> 50: 
> 51:     DEBUG_ONLY(int actual_size = cb.insts_size() - size_before;)
> 52:     assert(size == actual_size, "Expected stub size (%d) must match actual stub size (%d)", size, actual_size);

Hi, I have the same concern as @vnkozlov here. For AArch64, I see C2SafepointPollStub::emit() calls MacroAssembler::far_jump() and the size of code emitted will depend on entry.target() [1]. I guess it might be better to let C2SafepointPollStub::size() return a maximum possible size and assert here that the actual size <= that maximum value.

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L714

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

PR: https://git.openjdk.org/jdk/pull/11188


More information about the hotspot-compiler-dev mailing list