Skip to content

Commit 03b947f

Browse files
committed
Remove nmethod_entry_barrier-related things
1 parent 807513d commit 03b947f

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

src/hotspot/cpu/riscv/gc/shared/barrierSetAssembler_riscv.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,6 @@ void BarrierSetAssembler::incr_allocated_bytes(MacroAssembler* masm,
231231
__ sd(tmp1, Address(xthread, in_bytes(JavaThread::allocated_bytes_offset())));
232232
}
233233

234-
extern int nmethod_barrier_guard_offset();
235-
236234
void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) {
237235
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
238236

@@ -242,7 +240,7 @@ void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) {
242240

243241
// RVC: RISCV's amoswap instructions need an alignment for the memory address it swaps
244242
// when we reach here we may get a 2-byte alignment so need to align it
245-
__ align(4, nmethod_barrier_guard_offset());
243+
__ align(4);
246244

247245
Label skip, guard;
248246
Address thread_disarmed_addr(xthread, in_bytes(bs_nm->thread_disarmed_offset()));

src/hotspot/cpu/riscv/gc/shared/barrierSetNMethod_riscv.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,11 @@
3636
#include "utilities/debug.hpp"
3737

3838
class NativeNMethodBarrier: public NativeInstruction {
39-
public:
40-
enum {
41-
guard_offset = 12 * instruction_size,
42-
barrier_size = guard_offset + 4, // guard_offset + an int32 nmethod guard value
43-
};
44-
45-
private:
4639
address instruction_address() const { return addr_at(0); }
4740

4841
int *guard_addr() {
4942
/* auipc + lwu + fence + lwu + beq + lui + addi + slli + addi + slli + jalr + j */
50-
return reinterpret_cast<int*>(instruction_address() + guard_offset);
43+
return reinterpret_cast<int*>(instruction_address() + 12 * 4);
5144
}
5245

5346
public:
@@ -62,10 +55,6 @@ class NativeNMethodBarrier: public NativeInstruction {
6255
void verify() const;
6356
};
6457

65-
int nmethod_barrier_guard_offset() {
66-
return NativeNMethodBarrier::guard_offset;
67-
}
68-
6958
// Store the instruction bitmask, bits and name for checking the barrier.
7059
struct CheckInsn {
7160
uint32_t mask;
@@ -152,7 +141,7 @@ void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
152141

153142
// see BarrierSetAssembler::nmethod_entry_barrier
154143
// auipc + lwu + fence + lwu + beq + movptr_with_offset(5 instructions) + jalr + j + int32
155-
static const int entry_barrier_offset = - NativeNMethodBarrier::barrier_size;
144+
static const int entry_barrier_offset = -4 * 13;
156145

157146
static NativeNMethodBarrier* native_nmethod_barrier(nmethod* nm) {
158147
address barrier_address = nm->code_begin() + nm->frame_complete_offset() + entry_barrier_offset;

0 commit comments

Comments
 (0)