RFR: 8297036: Generalize C2 stub mechanism

Aleksey Shipilev shade at openjdk.org
Tue Nov 22 17:09:04 UTC 2022


On Wed, 16 Nov 2022 15:03:07 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)

> undefined reference to `vtable for C2SafepointPollStub'

I don't think the newly added [c2_CodeStubs.cpp](https://github.com/openjdk/jdk/pull/11188/files#diff-290de220f9ef00679e975edd8e14fca00873e5d4acc734c81f4893ebaaa1484c) even compiles, because this should fail:


__ assert_alignment(pc());


You probably need to call it `c2_CodeStubs_riscv.cpp`? This might be some weird build system quirk?

Further RISC-V build fixes:


diff --git a/src/hotspot/cpu/riscv/c2_CodeStubs_riscv.cpp b/src/hotspot/cpu/riscv/c2_CodeStubs_riscv.cpp
index bea3f39da31..df38bb5e4d0 100644
--- a/src/hotspot/cpu/riscv/c2_CodeStubs_riscv.cpp
+++ b/src/hotspot/cpu/riscv/c2_CodeStubs_riscv.cpp
@@ -47,7 +47,7 @@ void C2SafepointPollStub::emit(C2_MacroAssembler& masm) {
 }
 
 void C2EntryBarrierStub::emit(C2_MacroAssembler& masm) {
-  IncompressibleRegion ir(&masm); // Fixed length
+  Assembler::IncompressibleRegion ir(&masm); // Fixed length
 
   // make guard value 4-byte aligned so that it can be accessed by atomic instructions on riscv
   int alignment_bytes = __ align(4);
@@ -61,7 +61,7 @@ void C2EntryBarrierStub::emit(C2_MacroAssembler& masm) {
 
   __ bind(guard());
   __ relocate(entry_guard_Relocation::spec());
-  __ assert_alignment(pc());
+  __ assert_alignment(__ pc());
   __ emit_int32(0);  // nmethod guard value
   // make sure the stub with a fixed code size
   if (alignment_bytes == 2) {

PPC64LE seems to build fine with the latest changes.

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

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


More information about the hotspot-compiler-dev mailing list