From 616215122ef0e5224c510a9ed7ce3d96d7addf85 Mon Sep 17 00:00:00 2001 From: Axel Boldt-Christmas Date: Mon, 27 Nov 2023 09:06:05 +0000 Subject: 8319700: [AArch64] C2 compilation fails with "Field too big for insn" Backport-of: 3787ff8d1d8dbcaaebb9616c5bc543e2fe21a90c --- src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp | 9 +++++++++ src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.hpp | 2 ++ src/hotspot/cpu/aarch64/gc/z/z_aarch64.ad | 2 +- src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp | 3 +++ src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp | 2 +- 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp index 3a9e5db2ef7..ebaf1829972 100644 --- a/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.cpp @@ -1290,6 +1290,9 @@ static bool aarch64_test_and_branch_reachable(int branch_offset, int target_offs return test_and_branch_to_trampoline_delta < test_and_branch_delta_limit; } +ZLoadBarrierStubC2Aarch64::ZLoadBarrierStubC2Aarch64(const MachNode* node, Address ref_addr, Register ref) + : ZLoadBarrierStubC2(node, ref_addr, ref), _test_and_branch_reachable_entry(), _offset(), _deferred_emit(false), _test_and_branch_reachable(false) {} + ZLoadBarrierStubC2Aarch64::ZLoadBarrierStubC2Aarch64(const MachNode* node, Address ref_addr, Register ref, int offset) : ZLoadBarrierStubC2(node, ref_addr, ref), _test_and_branch_reachable_entry(), _offset(offset), _deferred_emit(false), _test_and_branch_reachable(false) { PhaseOutput* const output = Compile::current()->output(); @@ -1319,6 +1322,12 @@ int ZLoadBarrierStubC2Aarch64::get_stub_size() { return cb.insts_size(); } +ZLoadBarrierStubC2Aarch64* ZLoadBarrierStubC2Aarch64::create(const MachNode* node, Address ref_addr, Register ref) { + ZLoadBarrierStubC2Aarch64* const stub = new (Compile::current()->comp_arena()) ZLoadBarrierStubC2Aarch64(node, ref_addr, ref); + register_stub(stub); + return stub; +} + ZLoadBarrierStubC2Aarch64* ZLoadBarrierStubC2Aarch64::create(const MachNode* node, Address ref_addr, Register ref, int offset) { ZLoadBarrierStubC2Aarch64* const stub = new (Compile::current()->comp_arena()) ZLoadBarrierStubC2Aarch64(node, ref_addr, ref, offset); register_stub(stub); diff --git a/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.hpp index 00714e5c0c0..82334b34ade 100644 --- a/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/gc/z/zBarrierSetAssembler_aarch64.hpp @@ -265,10 +265,12 @@ private: bool _deferred_emit; bool _test_and_branch_reachable; + ZLoadBarrierStubC2Aarch64(const MachNode* node, Address ref_addr, Register ref); ZLoadBarrierStubC2Aarch64(const MachNode* node, Address ref_addr, Register ref, int offset); int get_stub_size(); public: + static ZLoadBarrierStubC2Aarch64* create(const MachNode* node, Address ref_addr, Register ref); static ZLoadBarrierStubC2Aarch64* create(const MachNode* node, Address ref_addr, Register ref, int offset); virtual void emit_code(MacroAssembler& masm); diff --git a/src/hotspot/cpu/aarch64/gc/z/z_aarch64.ad b/src/hotspot/cpu/aarch64/gc/z/z_aarch64.ad index 8c698635ad0..23564a3f23c 100644 --- a/src/hotspot/cpu/aarch64/gc/z/z_aarch64.ad +++ b/src/hotspot/cpu/aarch64/gc/z/z_aarch64.ad @@ -48,7 +48,7 @@ static void z_keep_alive_load_barrier(MacroAssembler& _masm, const MachNode* nod __ relocate(barrier_Relocation::spec(), ZBarrierRelocationFormatMarkBadBeforeMov); __ movzw(tmp, barrier_Relocation::unpatched); __ tst(ref, tmp); - ZLoadBarrierStubC2* const stub = ZLoadBarrierStubC2::create(node, ref_addr, ref); + ZLoadBarrierStubC2Aarch64* const stub = ZLoadBarrierStubC2Aarch64::create(node, ref_addr, ref); __ br(Assembler::NE, *stub->entry()); z_uncolor(_masm, node, ref); __ bind(*stub->continuation()); diff --git a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp index e5fb50a26e4..70b9bd6eaa7 100644 --- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp +++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp @@ -42,6 +42,7 @@ #include "opto/rootnode.hpp" #include "opto/runtime.hpp" #include "opto/type.hpp" +#include "utilities/debug.hpp" #include "utilities/growableArray.hpp" #include "utilities/macros.hpp" @@ -226,6 +227,7 @@ Label* ZBarrierStubC2::continuation() { } ZLoadBarrierStubC2* ZLoadBarrierStubC2::create(const MachNode* node, Address ref_addr, Register ref) { + AARCH64_ONLY(fatal("Should use ZLoadBarrierStubC2Aarch64::create")); ZLoadBarrierStubC2* const stub = new (Compile::current()->comp_arena()) ZLoadBarrierStubC2(node, ref_addr, ref); register_stub(stub); @@ -275,6 +277,7 @@ void ZLoadBarrierStubC2::emit_code(MacroAssembler& masm) { } ZStoreBarrierStubC2* ZStoreBarrierStubC2::create(const MachNode* node, Address ref_addr, Register new_zaddress, Register new_zpointer, bool is_native, bool is_atomic) { + AARCH64_ONLY(fatal("Should use ZStoreBarrierStubC2Aarch64::create")); ZStoreBarrierStubC2* const stub = new (Compile::current()->comp_arena()) ZStoreBarrierStubC2(node, ref_addr, new_zaddress, new_zpointer, is_native, is_atomic); register_stub(stub); diff --git a/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp b/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp index a0f29fbc510..7af70c64096 100644 --- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp +++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp @@ -52,9 +52,9 @@ static void inc_trampoline_stubs_count(); static int trampoline_stubs_count(); static int stubs_start_offset(); -public: ZBarrierStubC2(const MachNode* node); +public: RegMask& live() const; Label* entry(); Label* continuation(); -- cgit v1.2.3