@@ -457,8 +457,8 @@ void MacroAssembler::call_VM_base(Register oop_result,
457457 RuntimeAddress target (StubRoutines::forward_exception_entry ());
458458 relocate (target.rspec (), [&] {
459459 int32_t offset;
460- la (t0 , target.target (), offset);
461- jr (t0 , offset);
460+ la (t1 , target.target (), offset);
461+ jr (t1 , offset);
462462 });
463463 bind (ok);
464464 }
@@ -760,21 +760,21 @@ void MacroAssembler::emit_static_call_stub() {
760760
761761 // Jump to the entry point of the c2i stub.
762762 int32_t offset = 0 ;
763- movptr (t0 , 0 , offset, t1 ); // lui + lui + slli + add
764- jr (t0 , offset);
763+ movptr (t1 , 0 , offset, t0 ); // lui + lui + slli + add
764+ jr (t1 , offset);
765765}
766766
767767void MacroAssembler::call_VM_leaf_base (address entry_point,
768768 int number_of_arguments,
769769 Label *retaddr) {
770770 int32_t offset = 0 ;
771- push_reg (RegSet::of (t0 , xmethod), sp); // push << t0 & xmethod >> to sp
772- mv (t0 , entry_point, offset);
773- jalr (t0 , offset);
771+ push_reg (RegSet::of (t1 , xmethod), sp); // push << t1 & xmethod >> to sp
772+ mv (t1 , entry_point, offset);
773+ jalr (t1 , offset);
774774 if (retaddr != nullptr ) {
775775 bind (*retaddr);
776776 }
777- pop_reg (RegSet::of (t0 , xmethod), sp); // pop << t0 & xmethod >> from sp
777+ pop_reg (RegSet::of (t1 , xmethod), sp); // pop << t1 & xmethod >> from sp
778778}
779779
780780void MacroAssembler::call_VM_leaf (address entry_point, int number_of_arguments) {
@@ -941,6 +941,7 @@ void MacroAssembler::li(Register Rd, int64_t imm) {
941941
942942void MacroAssembler::load_link_jump (const address source, Register temp) {
943943 assert (temp != noreg && temp != x0, " expecting a register" );
944+ assert (temp != x5, " temp register must not be x5." );
944945 assert_cond (source != nullptr );
945946 int64_t distance = source - pc ();
946947 assert (is_simm32 (distance), " Must be" );
@@ -968,7 +969,8 @@ void MacroAssembler::j(const address dest, Register temp) {
968969 if (is_simm21 (distance) && ((distance % 2 ) == 0 )) {
969970 Assembler::jal (x0, distance);
970971 } else {
971- assert (temp != noreg && temp != x0, " expecting a register" );
972+ assert (temp != noreg && temp != x0, " Expecting a register" );
973+ assert (temp != x1 && temp != x5, " temp register must not be x1/x5." );
972974 int32_t offset = 0 ;
973975 la (temp, dest, offset);
974976 jr (temp, offset);
@@ -1006,23 +1008,27 @@ void MacroAssembler::j(Label &lab, Register temp) {
10061008
10071009void MacroAssembler::jr (Register Rd, int32_t offset) {
10081010 assert (Rd != noreg, " expecting a register" );
1011+ assert (Rd != x1 && Rd != x5, " Rd register must not be x1/x5." );
10091012 Assembler::jalr (x0, Rd, offset);
10101013}
10111014
10121015void MacroAssembler::call (const address dest, Register temp) {
10131016 assert_cond (dest != nullptr );
10141017 assert (temp != noreg, " expecting a register" );
1018+ assert (temp != x5, " temp register must not be x5." );
10151019 int32_t offset = 0 ;
10161020 la (temp, dest, offset);
10171021 jalr (temp, offset);
10181022}
10191023
10201024void MacroAssembler::jalr (Register Rs, int32_t offset) {
10211025 assert (Rs != noreg, " expecting a register" );
1026+ assert (Rs != x5, " Rs register must not be x5." );
10221027 Assembler::jalr (x1, Rs, offset);
10231028}
10241029
10251030void MacroAssembler::rt_call (address dest, Register tmp) {
1031+ assert (tmp != x5, " tmp register must not be x5." );
10261032 CodeBlob *cb = CodeCache::find_blob (dest);
10271033 RuntimeAddress target (dest);
10281034 if (cb) {
@@ -1762,7 +1768,7 @@ void MacroAssembler::pop_CPU_state(bool restore_vectors, int vector_size_in_byte
17621768
17631769static int patch_offset_in_jal (address branch, int64_t offset) {
17641770 assert (Assembler::is_simm21 (offset) && ((offset % 2 ) == 0 ),
1765- " offset is too large to be patched in one jal instruction!\n " );
1771+ " offset (%ld) is too large to be patched in one jal instruction!\n " , offset );
17661772 Assembler::patch (branch, 31 , 31 , (offset >> 20 ) & 0x1 ); // offset[20] ==> branch[31]
17671773 Assembler::patch (branch, 30 , 21 , (offset >> 1 ) & 0x3ff ); // offset[10:1] ==> branch[30:21]
17681774 Assembler::patch (branch, 20 , 20 , (offset >> 11 ) & 0x1 ); // offset[11] ==> branch[20]
@@ -3658,6 +3664,7 @@ void MacroAssembler::far_jump(const Address &entry, Register tmp) {
36583664}
36593665
36603666void MacroAssembler::far_call (const Address &entry, Register tmp) {
3667+ assert (tmp != x5, " tmp register must not be x5." );
36613668 assert (CodeCache::find_blob (entry.target ()) != nullptr ,
36623669 " destination of far call not found in code cache" );
36633670 assert (entry.rspec ().type () == relocInfo::external_word_type
@@ -4072,7 +4079,7 @@ void MacroAssembler::verify_secondary_supers_table(Register r_sub_klass,
40724079 Register tmp1,
40734080 Register tmp2,
40744081 Register tmp3) {
4075- assert_different_registers (r_sub_klass, r_super_klass, tmp1, tmp2, tmp3, result, t0);
4082+ assert_different_registers (r_sub_klass, r_super_klass, tmp1, tmp2, tmp3, result, t0, t1 );
40764083
40774084 const Register
40784085 r_array_base = tmp1, // X11
@@ -4139,8 +4146,8 @@ void MacroAssembler::get_thread(Register thread) {
41394146 RegSet::range (x28, x31) + ra - thread;
41404147 push_reg (saved_regs, sp);
41414148
4142- mv (ra , CAST_FROM_FN_PTR (address, Thread::current));
4143- jalr (ra );
4149+ mv (t1 , CAST_FROM_FN_PTR (address, Thread::current));
4150+ jalr (t1 );
41444151 if (thread != c_rarg0) {
41454152 mv (thread, c_rarg0);
41464153 }
@@ -4187,8 +4194,8 @@ void MacroAssembler::reserved_stack_check() {
41874194 // We have already removed our own frame.
41884195 // throw_delayed_StackOverflowError will think that it's been
41894196 // called by our caller.
4190- la (t0 , RuntimeAddress (SharedRuntime::throw_delayed_StackOverflowError_entry ()));
4191- jr (t0 );
4197+ la (t1 , RuntimeAddress (SharedRuntime::throw_delayed_StackOverflowError_entry ()));
4198+ jr (t1 );
41924199 should_not_reach_here ();
41934200
41944201 bind (no_reserved_zone_enabling);
@@ -4299,7 +4306,7 @@ address MacroAssembler::load_and_call(Address entry) {
42994306 }
43004307#endif
43014308 relocate (entry.rspec (), [&] {
4302- load_link_jump (target);
4309+ load_link_jump (target, t1 );
43034310 });
43044311
43054312 postcond (pc () != badAddress);
@@ -4309,7 +4316,7 @@ address MacroAssembler::load_and_call(Address entry) {
43094316address MacroAssembler::ic_call (address entry, jint method_index) {
43104317 RelocationHolder rh = virtual_call_Relocation::spec (pc (), method_index);
43114318 IncompressibleRegion ir (this ); // relocations
4312- movptr (t1 , (address)Universe::non_oop_word (), t0 );
4319+ movptr (t0 , (address)Universe::non_oop_word (), t1 );
43134320 assert_cond (entry != nullptr );
43144321 return reloc_call (Address (entry, rh));
43154322}
@@ -4323,9 +4330,9 @@ int MacroAssembler::ic_check_size() {
43234330int MacroAssembler::ic_check (int end_alignment) {
43244331 IncompressibleRegion ir (this );
43254332 Register receiver = j_rarg0;
4326- Register data = t1 ;
4333+ Register data = t0 ;
43274334
4328- Register tmp1 = t0 ; // t0 always scratch
4335+ Register tmp1 = t1 ; // scratch
43294336 // t2 is saved on call, thus should have been saved before this check.
43304337 // Hence we can clobber it.
43314338 Register tmp2 = t2;
@@ -4423,8 +4430,8 @@ address MacroAssembler::emit_trampoline_stub(int insts_call_instruction_offset,
44234430 // - load the call
44244431 // - call
44254432 Label target;
4426- ld (t0 , target); // auipc + ld
4427- jr (t0 ); // jalr
4433+ ld (t1 , target); // auipc + ld
4434+ jr (t1 ); // jalr
44284435 bind (target);
44294436 assert (offset () - stub_start_offset == MacroAssembler::NativeShortCall::trampoline_data_offset,
44304437 " should be" );
@@ -5148,11 +5155,11 @@ const int MacroAssembler::zero_words_block_size = 8;
51485155// ptr: Address of a buffer to be zeroed.
51495156// cnt: Count in HeapWords.
51505157//
5151- // ptr, cnt, and t0 are clobbered.
5158+ // ptr, cnt, t1, and t0 are clobbered.
51525159address MacroAssembler::zero_words (Register ptr, Register cnt) {
51535160 assert (is_power_of_2 (zero_words_block_size), " adjust this" );
51545161 assert (ptr == x28 && cnt == x29, " mismatch in register usage" );
5155- assert_different_registers (cnt, t0);
5162+ assert_different_registers (cnt, t0, t1 );
51565163
51575164 BLOCK_COMMENT (" zero_words {" );
51585165
@@ -5170,6 +5177,7 @@ address MacroAssembler::zero_words(Register ptr, Register cnt) {
51705177 return nullptr ;
51715178 }
51725179 } else {
5180+ // Clobbers t1
51735181 rt_call (zero_blocks.target ());
51745182 }
51755183 }
0 commit comments