Skip to content

Commit 95b66d5

Browse files
author
Doug Simon
committed
8351700: Remove code conditional on BarrierSetNMethod being null
Reviewed-by: shade, eosterlund, never
1 parent 84f87dd commit 95b66d5

27 files changed

+69
-166
lines changed

src/hotspot/cpu/aarch64/aarch64.ad

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ void MachPrologNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
17421742
st->print("mov rscratch1, #%d\n\t", framesize - 2 * wordSize);
17431743
st->print("sub sp, sp, rscratch1");
17441744
}
1745-
if (C->stub_function() == nullptr && BarrierSet::barrier_set()->barrier_set_nmethod() != nullptr) {
1745+
if (C->stub_function() == nullptr) {
17461746
st->print("\n\t");
17471747
st->print("ldr rscratch1, [guard]\n\t");
17481748
st->print("dmb ishld\n\t");
@@ -1792,25 +1792,23 @@ void MachPrologNode::emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const {
17921792

17931793
if (C->stub_function() == nullptr) {
17941794
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
1795-
if (BarrierSet::barrier_set()->barrier_set_nmethod() != nullptr) {
1796-
// Dummy labels for just measuring the code size
1797-
Label dummy_slow_path;
1798-
Label dummy_continuation;
1799-
Label dummy_guard;
1800-
Label* slow_path = &dummy_slow_path;
1801-
Label* continuation = &dummy_continuation;
1802-
Label* guard = &dummy_guard;
1803-
if (!Compile::current()->output()->in_scratch_emit_size()) {
1804-
// Use real labels from actual stub when not emitting code for the purpose of measuring its size
1805-
C2EntryBarrierStub* stub = new (Compile::current()->comp_arena()) C2EntryBarrierStub();
1806-
Compile::current()->output()->add_stub(stub);
1807-
slow_path = &stub->entry();
1808-
continuation = &stub->continuation();
1809-
guard = &stub->guard();
1810-
}
1811-
// In the C2 code, we move the non-hot part of nmethod entry barriers out-of-line to a stub.
1812-
bs->nmethod_entry_barrier(masm, slow_path, continuation, guard);
1795+
// Dummy labels for just measuring the code size
1796+
Label dummy_slow_path;
1797+
Label dummy_continuation;
1798+
Label dummy_guard;
1799+
Label* slow_path = &dummy_slow_path;
1800+
Label* continuation = &dummy_continuation;
1801+
Label* guard = &dummy_guard;
1802+
if (!Compile::current()->output()->in_scratch_emit_size()) {
1803+
// Use real labels from actual stub when not emitting code for the purpose of measuring its size
1804+
C2EntryBarrierStub* stub = new (Compile::current()->comp_arena()) C2EntryBarrierStub();
1805+
Compile::current()->output()->add_stub(stub);
1806+
slow_path = &stub->entry();
1807+
continuation = &stub->continuation();
1808+
guard = &stub->guard();
18131809
}
1810+
// In the C2 code, we move the non-hot part of nmethod entry barriers out-of-line to a stub.
1811+
bs->nmethod_entry_barrier(masm, slow_path, continuation, guard);
18141812
}
18151813

18161814
if (VerifyStackAtCalls) {

src/hotspot/cpu/aarch64/gc/shared/barrierSetAssembler_aarch64.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,6 @@ void BarrierSetAssembler::clear_patching_epoch() {
285285
void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm, Label* slow_path, Label* continuation, Label* guard) {
286286
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
287287

288-
if (bs_nm == nullptr) {
289-
return;
290-
}
291-
292288
Label local_guard;
293289
Label skip_barrier;
294290
NMethodPatchingType patching_type = nmethod_patching_type();
@@ -361,11 +357,6 @@ void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm, Label* slo
361357
}
362358

363359
void BarrierSetAssembler::c2i_entry_barrier(MacroAssembler* masm) {
364-
BarrierSetNMethod* bs = BarrierSet::barrier_set()->barrier_set_nmethod();
365-
if (bs == nullptr) {
366-
return;
367-
}
368-
369360
Label bad_call;
370361
__ cbz(rmethod, bad_call);
371362

src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9900,10 +9900,7 @@ class StubGenerator: public StubCodeGenerator {
99009900
// arraycopy stubs used by compilers
99019901
generate_arraycopy_stubs();
99029902

9903-
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
9904-
if (bs_nm != nullptr) {
9905-
StubRoutines::_method_entry_barrier = generate_method_entry_barrier();
9906-
}
9903+
StubRoutines::_method_entry_barrier = generate_method_entry_barrier();
99079904

99089905
StubRoutines::aarch64::_spin_wait = generate_spin_wait();
99099906

src/hotspot/cpu/arm/arm.ad

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ void MachPrologNode::format( PhaseRegAlloc *ra_, outputStream *st ) const {
286286
st->print ("SUB R_SP, R_SP, %zu", framesize);
287287
}
288288

289-
if (C->stub_function() == nullptr && BarrierSet::barrier_set()->barrier_set_nmethod() != nullptr) {
289+
if (C->stub_function() == nullptr) {
290290
st->print("ldr t0, [guard]\n\t");
291291
st->print("ldr t1, [Rthread, #thread_disarmed_guard_value_offset]\n\t");
292292
st->print("cmp t0, t1\n\t");

src/hotspot/cpu/arm/gc/shared/barrierSetAssembler_arm.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,6 @@ void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) {
169169
Register tmp0 = Rtemp;
170170
Register tmp1 = R5; // must be callee-save register
171171

172-
if (bs_nm == nullptr) {
173-
return;
174-
}
175-
176172
// The are no GCs that require memory barrier on arm32 now
177173
#ifdef ASSERT
178174
NMethodPatchingType patching_type = nmethod_patching_type();

src/hotspot/cpu/arm/stubGenerator_arm.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3176,11 +3176,7 @@ class StubGenerator: public StubCodeGenerator {
31763176
// arraycopy stubs used by compilers
31773177
generate_arraycopy_stubs();
31783178

3179-
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
3180-
if (bs_nm != nullptr) {
3181-
StubRoutines::_method_entry_barrier = generate_method_entry_barrier();
3182-
}
3183-
3179+
StubRoutines::_method_entry_barrier = generate_method_entry_barrier();
31843180
}
31853181

31863182
void generate_compiler_stubs() {

src/hotspot/cpu/ppc/gc/shared/barrierSetAssembler_ppc.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,6 @@ void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Re
181181

182182
void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm, Register tmp) {
183183
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
184-
if (bs_nm == nullptr) {
185-
return;
186-
}
187-
188184
assert_different_registers(tmp, R0);
189185

190186
__ block_comment("nmethod_entry_barrier (nmethod_entry_barrier) {");
@@ -215,11 +211,6 @@ void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm, Register t
215211
}
216212

217213
void BarrierSetAssembler::c2i_entry_barrier(MacroAssembler *masm, Register tmp1, Register tmp2, Register tmp3) {
218-
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
219-
if (bs_nm == nullptr) {
220-
return;
221-
}
222-
223214
assert_different_registers(tmp1, tmp2, tmp3);
224215

225216
__ block_comment("c2i_entry_barrier (c2i_entry_barrier) {");

src/hotspot/cpu/ppc/stubGenerator_ppc.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4881,10 +4881,7 @@ void generate_lookup_secondary_supers_table_stub() {
48814881
StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop();
48824882

48834883
// nmethod entry barriers for concurrent class unloading
4884-
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
4885-
if (bs_nm != nullptr) {
4886-
StubRoutines::_method_entry_barrier = generate_method_entry_barrier();
4887-
}
4884+
StubRoutines::_method_entry_barrier = generate_method_entry_barrier();
48884885

48894886
// arraycopy stubs used by compilers
48904887
generate_arraycopy_stubs();

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,6 @@ void BarrierSetAssembler::clear_patching_epoch() {
226226

227227
void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm, Label* slow_path, Label* continuation, Label* guard) {
228228
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
229-
230-
if (bs_nm == nullptr) {
231-
return;
232-
}
233-
234229
Assembler::IncompressibleRegion ir(masm); // Fixed length: see entry_barrier_offset()
235230

236231
Label local_guard;
@@ -320,11 +315,6 @@ void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm, Label* slo
320315
}
321316

322317
void BarrierSetAssembler::c2i_entry_barrier(MacroAssembler* masm) {
323-
BarrierSetNMethod* bs = BarrierSet::barrier_set()->barrier_set_nmethod();
324-
if (bs == nullptr) {
325-
return;
326-
}
327-
328318
Label bad_call;
329319
__ beqz(xmethod, bad_call);
330320

src/hotspot/cpu/riscv/riscv.ad

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ void MachPrologNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
13481348
if (PreserveFramePointer) { st->print("sub fp, sp, #%d\n\t", 2 * wordSize); }
13491349
st->print("sub sp, sp, #%d\n\t", framesize);
13501350

1351-
if (C->stub_function() == nullptr && BarrierSet::barrier_set()->barrier_set_nmethod() != nullptr) {
1351+
if (C->stub_function() == nullptr) {
13521352
st->print("ld t0, [guard]\n\t");
13531353
st->print("membar LoadLoad\n\t");
13541354
st->print("ld t1, [xthread, #thread_disarmed_guard_value_offset]\n\t");
@@ -1398,25 +1398,23 @@ void MachPrologNode::emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const {
13981398

13991399
if (C->stub_function() == nullptr) {
14001400
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
1401-
if (BarrierSet::barrier_set()->barrier_set_nmethod() != nullptr) {
1402-
// Dummy labels for just measuring the code size
1403-
Label dummy_slow_path;
1404-
Label dummy_continuation;
1405-
Label dummy_guard;
1406-
Label* slow_path = &dummy_slow_path;
1407-
Label* continuation = &dummy_continuation;
1408-
Label* guard = &dummy_guard;
1409-
if (!Compile::current()->output()->in_scratch_emit_size()) {
1410-
// Use real labels from actual stub when not emitting code for purpose of measuring its size
1411-
C2EntryBarrierStub* stub = new (Compile::current()->comp_arena()) C2EntryBarrierStub();
1412-
Compile::current()->output()->add_stub(stub);
1413-
slow_path = &stub->entry();
1414-
continuation = &stub->continuation();
1415-
guard = &stub->guard();
1416-
}
1417-
// In the C2 code, we move the non-hot part of nmethod entry barriers out-of-line to a stub.
1418-
bs->nmethod_entry_barrier(masm, slow_path, continuation, guard);
1401+
// Dummy labels for just measuring the code size
1402+
Label dummy_slow_path;
1403+
Label dummy_continuation;
1404+
Label dummy_guard;
1405+
Label* slow_path = &dummy_slow_path;
1406+
Label* continuation = &dummy_continuation;
1407+
Label* guard = &dummy_guard;
1408+
if (!Compile::current()->output()->in_scratch_emit_size()) {
1409+
// Use real labels from actual stub when not emitting code for purpose of measuring its size
1410+
C2EntryBarrierStub* stub = new (Compile::current()->comp_arena()) C2EntryBarrierStub();
1411+
Compile::current()->output()->add_stub(stub);
1412+
slow_path = &stub->entry();
1413+
continuation = &stub->continuation();
1414+
guard = &stub->guard();
14191415
}
1416+
// In the C2 code, we move the non-hot part of nmethod entry barriers out-of-line to a stub.
1417+
bs->nmethod_entry_barrier(masm, slow_path, continuation, guard);
14201418
}
14211419

14221420
if (VerifyStackAtCalls) {

0 commit comments

Comments
 (0)