Skip to content

Commit 6df34c3

Browse files
committed
8353174: Clean up thread register handling after 32-bit x86 removal
Reviewed-by: cslucas, kvn, vlivanov
1 parent 0f70aae commit 6df34c3

15 files changed

+135
-217
lines changed

src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ void LIR_Assembler::clinit_barrier(ciMethod* method) {
326326
Register klass = rscratch1;
327327

328328
__ mov_metadata(klass, method->holder()->constant_encoding());
329-
__ clinit_barrier(klass, r15_thread, &L_skip_barrier /*L_fast_path*/);
329+
__ clinit_barrier(klass, &L_skip_barrier /*L_fast_path*/);
330330

331331
__ jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub()));
332332

@@ -482,7 +482,7 @@ void LIR_Assembler::return_op(LIR_Opr result, C1SafepointPollStub* code_stub) {
482482

483483
code_stub->set_safepoint_offset(__ offset());
484484
__ relocate(relocInfo::poll_return_type);
485-
__ safepoint_poll(*code_stub->entry(), r15_thread, true /* at_return */, true /* in_nmethod */);
485+
__ safepoint_poll(*code_stub->entry(), true /* at_return */, true /* in_nmethod */);
486486
__ ret(0);
487487
}
488488

src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
6262
}
6363

6464
if (LockingMode == LM_LIGHTWEIGHT) {
65-
const Register thread = r15_thread;
66-
lightweight_lock(disp_hdr, obj, hdr, thread, tmp, slow_case);
65+
lightweight_lock(disp_hdr, obj, hdr, tmp, slow_case);
6766
} else if (LockingMode == LM_LEGACY) {
6867
Label done;
6968
// Load object header
@@ -128,7 +127,7 @@ void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_
128127
verify_oop(obj);
129128

130129
if (LockingMode == LM_LIGHTWEIGHT) {
131-
lightweight_unlock(obj, disp_hdr, r15_thread, hdr, slow_case);
130+
lightweight_unlock(obj, disp_hdr, hdr, slow_case);
132131
} else if (LockingMode == LM_LEGACY) {
133132
// test if object header is pointing to the displaced header, and if so, restore
134133
// the displaced header in the object - if the object header is not pointing to

src/hotspot/cpu/x86/c1_Runtime1_x86.cpp

+10-11
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, int args_size) {
5353
// setup registers
54-
const Register thread = r15_thread; // is callee-saved register (Visual C++ calling conventions)
54+
const Register thread = r15_thread;
5555
assert(!(oop_result1->is_valid() || metadata_result->is_valid()) || oop_result1 != metadata_result, "registers must be different");
5656
assert(oop_result1 != thread && metadata_result != thread, "registers must be different");
5757
assert(args_size >= 0, "illegal args_size");
@@ -66,11 +66,11 @@ int StubAssembler::call_RT(Register oop_result1, Register metadata_result, addre
6666

6767
int call_offset = -1;
6868
if (!align_stack) {
69-
set_last_Java_frame(thread, noreg, rbp, nullptr, rscratch1);
69+
set_last_Java_frame(noreg, rbp, nullptr, rscratch1);
7070
} else {
7171
address the_pc = pc();
7272
call_offset = offset();
73-
set_last_Java_frame(thread, noreg, rbp, the_pc, rscratch1);
73+
set_last_Java_frame(noreg, rbp, the_pc, rscratch1);
7474
andptr(rsp, -(StackAlignmentInBytes)); // Align stack
7575
}
7676

@@ -84,7 +84,7 @@ int StubAssembler::call_RT(Register oop_result1, Register metadata_result, addre
8484
guarantee(thread != rax, "change this code");
8585
push(rax);
8686
{ Label L;
87-
get_thread(rax);
87+
get_thread_slow(rax);
8888
cmpptr(thread, rax);
8989
jcc(Assembler::equal, L);
9090
int3();
@@ -93,7 +93,7 @@ int StubAssembler::call_RT(Register oop_result1, Register metadata_result, addre
9393
}
9494
pop(rax);
9595
#endif
96-
reset_last_Java_frame(thread, true);
96+
reset_last_Java_frame(true);
9797

9898
// check for pending exceptions
9999
{ Label L;
@@ -120,10 +120,10 @@ int StubAssembler::call_RT(Register oop_result1, Register metadata_result, addre
120120
}
121121
// get oop results if there are any and reset the values in the thread
122122
if (oop_result1->is_valid()) {
123-
get_vm_result(oop_result1, thread);
123+
get_vm_result(oop_result1);
124124
}
125125
if (metadata_result->is_valid()) {
126-
get_vm_result_2(metadata_result, thread);
126+
get_vm_result_2(metadata_result);
127127
}
128128

129129
assert(call_offset >= 0, "Should be set");
@@ -715,8 +715,7 @@ OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
715715
const Register thread = r15_thread;
716716
// No need to worry about dummy
717717
__ mov(c_rarg0, thread);
718-
719-
__ set_last_Java_frame(thread, noreg, rbp, nullptr, rscratch1);
718+
__ set_last_Java_frame(noreg, rbp, nullptr, rscratch1);
720719
// do the call
721720
__ call(RuntimeAddress(target));
722721
OopMapSet* oop_maps = new OopMapSet();
@@ -726,15 +725,15 @@ OopMapSet* Runtime1::generate_patching(StubAssembler* sasm, address target) {
726725
guarantee(thread != rax, "change this code");
727726
__ push(rax);
728727
{ Label L;
729-
__ get_thread(rax);
728+
__ get_thread_slow(rax);
730729
__ cmpptr(thread, rax);
731730
__ jcc(Assembler::equal, L);
732731
__ stop("StubAssembler::call_RT: rdi/r15 not callee saved?");
733732
__ bind(L);
734733
}
735734
__ pop(rax);
736735
#endif
737-
__ reset_last_Java_frame(thread, true);
736+
__ reset_last_Java_frame(true);
738737

739738
// check for pending exceptions
740739
{ Label L;

src/hotspot/cpu/x86/downcallLinker_x86_64.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ void DowncallLinker::StubGenerator::generate() {
291291
Assembler::StoreLoad | Assembler::StoreStore));
292292
}
293293

294-
__ safepoint_poll(L_safepoint_poll_slow_path, r15_thread, true /* at_return */, false /* in_nmethod */);
294+
__ safepoint_poll(L_safepoint_poll_slow_path, true /* at_return */, false /* in_nmethod */);
295295
__ cmpl(Address(r15_thread, JavaThread::suspend_flags_offset()), 0);
296296
__ jcc(Assembler::notEqual, L_safepoint_poll_slow_path);
297297

@@ -305,7 +305,7 @@ void DowncallLinker::StubGenerator::generate() {
305305
__ jcc(Assembler::equal, L_reguard);
306306
__ bind(L_after_reguard);
307307

308-
__ reset_last_Java_frame(r15_thread, true);
308+
__ reset_last_Java_frame(true);
309309
__ block_comment("} thread native2java");
310310
}
311311

src/hotspot/cpu/x86/interp_masm_x86.cpp

+9-11
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ void InterpreterMacroAssembler::call_VM_leaf_base(address entry_point,
296296
}
297297

298298
void InterpreterMacroAssembler::call_VM_base(Register oop_result,
299-
Register java_thread,
300299
Register last_java_sp,
301300
address entry_point,
302301
int number_of_arguments,
@@ -319,7 +318,7 @@ void InterpreterMacroAssembler::call_VM_base(Register oop_result,
319318
}
320319
#endif /* ASSERT */
321320
// super call
322-
MacroAssembler::call_VM_base(oop_result, noreg, last_java_sp,
321+
MacroAssembler::call_VM_base(oop_result, last_java_sp,
323322
entry_point, number_of_arguments,
324323
check_exceptions);
325324
// interpreter specific
@@ -379,7 +378,7 @@ void InterpreterMacroAssembler::restore_after_resume(bool is_native) {
379378
}
380379
}
381380

382-
void InterpreterMacroAssembler::check_and_handle_popframe(Register java_thread) {
381+
void InterpreterMacroAssembler::check_and_handle_popframe() {
383382
if (JvmtiExport::can_pop_frame()) {
384383
Label L;
385384
// Initiate popframe handling only if it is not already being
@@ -389,7 +388,7 @@ void InterpreterMacroAssembler::check_and_handle_popframe(Register java_thread)
389388
// This method is only called just after the call into the vm in
390389
// call_VM_base, so the arg registers are available.
391390
Register pop_cond = c_rarg0;
392-
movl(pop_cond, Address(java_thread, JavaThread::popframe_condition_offset()));
391+
movl(pop_cond, Address(r15_thread, JavaThread::popframe_condition_offset()));
393392
testl(pop_cond, JavaThread::popframe_pending_bit);
394393
jcc(Assembler::zero, L);
395394
testl(pop_cond, JavaThread::popframe_processing_bit);
@@ -430,7 +429,7 @@ void InterpreterMacroAssembler::load_earlyret_value(TosState state) {
430429
}
431430

432431

433-
void InterpreterMacroAssembler::check_and_handle_earlyret(Register java_thread) {
432+
void InterpreterMacroAssembler::check_and_handle_earlyret() {
434433
if (JvmtiExport::can_force_early_return()) {
435434
Label L;
436435
Register tmp = c_rarg0;
@@ -810,13 +809,13 @@ void InterpreterMacroAssembler::remove_activation(
810809
// the stack, will call InterpreterRuntime::at_unwind.
811810
Label slow_path;
812811
Label fast_path;
813-
safepoint_poll(slow_path, rthread, true /* at_return */, false /* in_nmethod */);
812+
safepoint_poll(slow_path, true /* at_return */, false /* in_nmethod */);
814813
jmp(fast_path);
815814
bind(slow_path);
816815
push(state);
817-
set_last_Java_frame(rthread, noreg, rbp, (address)pc(), rscratch1);
816+
set_last_Java_frame(noreg, rbp, (address)pc(), rscratch1);
818817
super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::at_unwind), rthread);
819-
reset_last_Java_frame(rthread, true);
818+
reset_last_Java_frame(true);
820819
pop(state);
821820
bind(fast_path);
822821

@@ -1031,8 +1030,7 @@ void InterpreterMacroAssembler::lock_object(Register lock_reg) {
10311030
}
10321031

10331032
if (LockingMode == LM_LIGHTWEIGHT) {
1034-
const Register thread = r15_thread;
1035-
lightweight_lock(lock_reg, obj_reg, swap_reg, thread, tmp_reg, slow_case);
1033+
lightweight_lock(lock_reg, obj_reg, swap_reg, tmp_reg, slow_case);
10361034
} else if (LockingMode == LM_LEGACY) {
10371035
// Load immediate 1 into swap_reg %rax
10381036
movl(swap_reg, 1);
@@ -1141,7 +1139,7 @@ void InterpreterMacroAssembler::unlock_object(Register lock_reg) {
11411139
movptr(Address(lock_reg, BasicObjectLock::obj_offset()), NULL_WORD);
11421140

11431141
if (LockingMode == LM_LIGHTWEIGHT) {
1144-
lightweight_unlock(obj_reg, swap_reg, r15_thread, header_reg, slow_case);
1142+
lightweight_unlock(obj_reg, swap_reg, header_reg, slow_case);
11451143
} else if (LockingMode == LM_LEGACY) {
11461144
// Load the old header from BasicLock structure
11471145
movptr(header_reg, Address(swap_reg,

src/hotspot/cpu/x86/interp_masm_x86.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ class InterpreterMacroAssembler: public MacroAssembler {
4242
protected:
4343

4444
virtual void call_VM_base(Register oop_result,
45-
Register java_thread,
4645
Register last_java_sp,
4746
address entry_point,
4847
int number_of_arguments,
@@ -58,8 +57,8 @@ class InterpreterMacroAssembler: public MacroAssembler {
5857

5958
void jump_to_entry(address entry);
6059

61-
virtual void check_and_handle_popframe(Register java_thread);
62-
virtual void check_and_handle_earlyret(Register java_thread);
60+
virtual void check_and_handle_popframe();
61+
virtual void check_and_handle_earlyret();
6362

6463
void load_earlyret_value(TosState state);
6564

0 commit comments

Comments
 (0)