From 1e5a2780d9cc8e73ce65bdccb98c1808aadd0784 Mon Sep 17 00:00:00 2001 From: Albert Mingkun Yang Date: Thu, 23 May 2024 07:00:10 +0000 Subject: [PATCH] 8332676: Remove unused BarrierSetAssembler::incr_allocated_bytes Reviewed-by: tschatzl, kbarrett --- .../gc/shared/barrierSetAssembler_aarch64.cpp | 15 ------- .../gc/shared/barrierSetAssembler_aarch64.hpp | 5 --- .../arm/gc/shared/barrierSetAssembler_arm.cpp | 40 ------------------- .../arm/gc/shared/barrierSetAssembler_arm.hpp | 6 --- src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp | 2 +- src/hotspot/cpu/ppc/macroAssembler_ppc.cpp | 3 -- src/hotspot/cpu/ppc/macroAssembler_ppc.hpp | 1 - .../gc/shared/barrierSetAssembler_riscv.cpp | 15 ------- .../gc/shared/barrierSetAssembler_riscv.hpp | 5 --- .../cpu/s390/c1_MacroAssembler_s390.cpp | 2 +- .../x86/gc/shared/barrierSetAssembler_x86.cpp | 30 -------------- .../x86/gc/shared/barrierSetAssembler_x86.hpp | 6 --- src/hotspot/share/runtime/thread.hpp | 2 - 13 files changed, 2 insertions(+), 130 deletions(-) diff --git a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp index 6c2b12fc7a8..073d9922355 100644 --- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp @@ -269,21 +269,6 @@ void BarrierSetAssembler::tlab_allocate(MacroAssembler* masm, Register obj, // verify_tlab(); } -void BarrierSetAssembler::incr_allocated_bytes(MacroAssembler* masm, - Register var_size_in_bytes, - int con_size_in_bytes, - Register t1) { - assert(t1->is_valid(), "need temp reg"); - - __ ldr(t1, Address(rthread, in_bytes(JavaThread::allocated_bytes_offset()))); - if (var_size_in_bytes->is_valid()) { - __ add(t1, t1, var_size_in_bytes); - } else { - __ add(t1, t1, con_size_in_bytes); - } - __ str(t1, Address(rthread, in_bytes(JavaThread::allocated_bytes_offset()))); -} - static volatile uint32_t _patching_epoch = 0; address BarrierSetAssembler::patching_epoch_addr() { diff --git a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.hpp index 8dc475e0597..d0e2aa95888 100644 --- a/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.hpp @@ -44,11 +44,6 @@ enum class NMethodPatchingType { }; class BarrierSetAssembler: public CHeapObj { -private: - void incr_allocated_bytes(MacroAssembler* masm, - Register var_size_in_bytes, int con_size_in_bytes, - Register t1 = noreg); - public: virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop, Register src, Register dst, Register count, RegSet saved_regs) {} diff --git a/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp b/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp index a4e7f35ec81..ea19730673c 100644 --- a/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp +++ b/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp @@ -159,46 +159,6 @@ void BarrierSetAssembler::tlab_allocate(MacroAssembler* masm, Register obj, Regi __ str(obj_end, Address(Rthread, JavaThread::tlab_top_offset())); } -void BarrierSetAssembler::incr_allocated_bytes(MacroAssembler* masm, RegisterOrConstant size_in_bytes, Register tmp) { - // Bump total bytes allocated by this thread - Label done; - - // Borrow the Rthread for alloc counter - Register Ralloc = Rthread; - __ add(Ralloc, Ralloc, in_bytes(JavaThread::allocated_bytes_offset())); - __ ldr(tmp, Address(Ralloc)); - __ adds(tmp, tmp, size_in_bytes); - __ str(tmp, Address(Ralloc), cc); - __ b(done, cc); - - // Increment the high word and store single-copy atomically (that is an unlikely scenario on typical embedded systems as it means >4GB has been allocated) - // To do so ldrd/strd instructions used which require an even-odd pair of registers. Such a request could be difficult to satisfy by - // allocating those registers on a higher level, therefore the routine is ready to allocate a pair itself. - Register low, high; - // Select ether R0/R1 or R2/R3 - - if (size_in_bytes.is_register() && (size_in_bytes.as_register() == R0 || size_in_bytes.as_register() == R1)) { - low = R2; - high = R3; - } else { - low = R0; - high = R1; - } - __ push(RegisterSet(low, high)); - - __ ldrd(low, Address(Ralloc)); - __ adds(low, low, size_in_bytes); - __ adc(high, high, 0); - __ strd(low, Address(Ralloc)); - - __ pop(RegisterSet(low, high)); - - __ bind(done); - - // Unborrow the Rthread - __ sub(Rthread, Ralloc, in_bytes(JavaThread::allocated_bytes_offset())); -} - void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) { BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod(); diff --git a/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.hpp b/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.hpp index ae51a054540..60021390ea2 100644 --- a/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.hpp +++ b/src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.hpp @@ -40,12 +40,6 @@ enum class NMethodPatchingType { }; class BarrierSetAssembler: public CHeapObj { -private: - void incr_allocated_bytes(MacroAssembler* masm, - RegisterOrConstant size_in_bytes, - Register tmp -); - public: virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop, Register addr, Register count, int callee_saved_regs) {} diff --git a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp index 219aeaf316d..9da5a2c6580 100644 --- a/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp @@ -183,7 +183,7 @@ void C1_MacroAssembler::try_allocate( Register obj, // result: pointer to object after successful allocation Register var_size_in_bytes, // object size in bytes if unknown at compile time; invalid otherwise int con_size_in_bytes, // object size in bytes if known at compile time - Register t1, // temp register, must be global register for incr_allocated_bytes + Register t1, // temp register Register t2, // temp register Label& slow_case // continuation point if fast allocation fails ) { diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp index 701cd5cf637..000d4510c07 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp @@ -2209,9 +2209,6 @@ void MacroAssembler::tlab_allocate( std(new_top, in_bytes(JavaThread::tlab_top_offset()), R16_thread); //verify_tlab(); not implemented } -void MacroAssembler::incr_allocated_bytes(RegisterOrConstant size_in_bytes, Register t1, Register t2) { - unimplemented("incr_allocated_bytes"); -} address MacroAssembler::emit_trampoline_stub(int destination_toc_offset, int insts_call_instruction_offset, Register Rtoc) { diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp index 92db8a86b42..5a628674da1 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp @@ -626,7 +626,6 @@ class MacroAssembler: public Assembler { Register t1, // temp register Label& slow_case // continuation point if fast allocation fails ); - void incr_allocated_bytes(RegisterOrConstant size_in_bytes, Register t1, Register t2); enum { trampoline_stub_size = 6 * 4 }; address emit_trampoline_stub(int destination_toc_offset, int insts_call_instruction_offset, Register Rtoc = noreg); diff --git a/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp index cbf8de7341d..0f385080977 100644 --- a/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp @@ -211,21 +211,6 @@ void BarrierSetAssembler::tlab_allocate(MacroAssembler* masm, Register obj, } } -void BarrierSetAssembler::incr_allocated_bytes(MacroAssembler* masm, - Register var_size_in_bytes, - int con_size_in_bytes, - Register tmp1) { - assert(tmp1->is_valid(), "need temp reg"); - - __ ld(tmp1, Address(xthread, in_bytes(JavaThread::allocated_bytes_offset()))); - if (var_size_in_bytes->is_valid()) { - __ add(tmp1, tmp1, var_size_in_bytes); - } else { - __ add(tmp1, tmp1, con_size_in_bytes); - } - __ sd(tmp1, Address(xthread, in_bytes(JavaThread::allocated_bytes_offset()))); -} - static volatile uint32_t _patching_epoch = 0; address BarrierSetAssembler::patching_epoch_addr() { diff --git a/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.hpp b/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.hpp index eb0801d237f..c1f51d768df 100644 --- a/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.hpp @@ -45,11 +45,6 @@ enum class NMethodPatchingType { }; class BarrierSetAssembler: public CHeapObj { -private: - void incr_allocated_bytes(MacroAssembler* masm, - Register var_size_in_bytes, int con_size_in_bytes, - Register t1 = noreg); - public: virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, bool is_oop, Register src, Register dst, Register count, RegSet saved_regs) {} diff --git a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp index 604a8336ff9..c35b0923297 100644 --- a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp @@ -164,7 +164,7 @@ void C1_MacroAssembler::try_allocate( Register obj, // result: Pointer to object after successful allocation. Register var_size_in_bytes, // Object size in bytes if unknown at compile time; invalid otherwise. int con_size_in_bytes, // Object size in bytes if known at compile time. - Register t1, // Temp register: Must be global register for incr_allocated_bytes. + Register t1, // Temp register. Label& slow_case // Continuation point if fast allocation fails. ) { if (UseTLAB) { diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp index a6801f594bd..b71b5a2ab47 100644 --- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp @@ -352,36 +352,6 @@ void BarrierSetAssembler::tlab_allocate(MacroAssembler* masm, __ verify_tlab(); } -void BarrierSetAssembler::incr_allocated_bytes(MacroAssembler* masm, Register thread, - Register var_size_in_bytes, - int con_size_in_bytes, - Register t1) { - if (!thread->is_valid()) { -#ifdef _LP64 - thread = r15_thread; -#else - assert(t1->is_valid(), "need temp reg"); - thread = t1; - __ get_thread(thread); -#endif - } - -#ifdef _LP64 - if (var_size_in_bytes->is_valid()) { - __ addq(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), var_size_in_bytes); - } else { - __ addq(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), con_size_in_bytes); - } -#else - if (var_size_in_bytes->is_valid()) { - __ addl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), var_size_in_bytes); - } else { - __ addl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), con_size_in_bytes); - } - __ adcl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())+4), 0); -#endif -} - #ifdef _LP64 void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm, Label* slow_path, Label* continuation) { BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod(); diff --git a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp index a74d5cc7676..81797907aed 100644 --- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp @@ -37,12 +37,6 @@ class Node; class InterpreterMacroAssembler; class BarrierSetAssembler: public CHeapObj { -private: - void incr_allocated_bytes(MacroAssembler* masm, Register thread, - Register var_size_in_bytes, - int con_size_in_bytes, - Register t1); - public: virtual void arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register src, Register dst, Register count) {} diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index d0749b8101d..44c845986f3 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -593,8 +593,6 @@ protected: static ByteSize tlab_top_offset() { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::top_offset(); } static ByteSize tlab_pf_top_offset() { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::pf_top_offset(); } - static ByteSize allocated_bytes_offset() { return byte_offset_of(Thread, _allocated_bytes); } - JFR_ONLY(DEFINE_THREAD_LOCAL_OFFSET_JFR;) public: