@@ -49,10 +49,10 @@ void C1_MacroAssembler::float_cmp(bool is_float, int unordered_result,
4949 }
5050}
5151
52- int C1_MacroAssembler::lock_object (Register hdr, Register obj, Register disp_hdr, Label& slow_case) {
52+ int C1_MacroAssembler::lock_object (Register hdr, Register obj, Register disp_hdr, Register temp, Label& slow_case) {
5353 const int aligned_mask = BytesPerWord - 1 ;
5454 const int hdr_offset = oopDesc::mark_offset_in_bytes ();
55- assert_different_registers (hdr, obj, disp_hdr);
55+ assert_different_registers (hdr, obj, disp_hdr, temp, t0, t1 );
5656 int null_check_offset = -1 ;
5757
5858 verify_oop (obj);
@@ -65,15 +65,15 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
6565 if (DiagnoseSyncOnValueBasedClasses != 0 ) {
6666 load_klass (hdr, obj);
6767 lwu (hdr, Address (hdr, Klass::access_flags_offset ()));
68- test_bit (t0 , hdr, exact_log2 (JVM_ACC_IS_VALUE_BASED_CLASS));
69- bnez (t0 , slow_case, true /* is_far */ );
68+ test_bit (temp , hdr, exact_log2 (JVM_ACC_IS_VALUE_BASED_CLASS));
69+ bnez (temp , slow_case, true /* is_far */ );
7070 }
7171
7272 // Load object header
7373 ld (hdr, Address (obj, hdr_offset));
7474
7575 if (LockingMode == LM_LIGHTWEIGHT) {
76- lightweight_lock (obj, hdr, t0 , t1, slow_case);
76+ lightweight_lock (obj, hdr, temp , t1, slow_case);
7777 } else if (LockingMode == LM_LEGACY) {
7878 Label done;
7979 // and mark it as unlocked
@@ -83,8 +83,8 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
8383 // test if object header is still the same (i.e. unlocked), and if so, store the
8484 // displaced header address in the object header - if it is not the same, get the
8585 // object header instead
86- la (t1 , Address (obj, hdr_offset));
87- cmpxchgptr (hdr, disp_hdr, t1, t0 , done, /* fallthough*/ nullptr );
86+ la (temp , Address (obj, hdr_offset));
87+ cmpxchgptr (hdr, disp_hdr, temp, t1 , done, /* fallthough*/ nullptr );
8888 // if the object header was the same, we're done
8989 // if the object header was not the same, it is now in the hdr register
9090 // => test if it is a stack pointer into the same stack (recursive locking), i.e.:
@@ -100,8 +100,8 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
100100 // assuming both the stack pointer and page_size have their least
101101 // significant 2 bits cleared and page_size is a power of 2
102102 sub (hdr, hdr, sp);
103- mv (t0 , aligned_mask - (int )os::vm_page_size ());
104- andr (hdr, hdr, t0 );
103+ mv (temp , aligned_mask - (int )os::vm_page_size ());
104+ andr (hdr, hdr, temp );
105105 // for recursive locking, the result is zero => save it in the displaced header
106106 // location (null in the displaced hdr location indicates recursive locking)
107107 sd (hdr, Address (disp_hdr, 0 ));
@@ -115,10 +115,10 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
115115 return null_check_offset;
116116}
117117
118- void C1_MacroAssembler::unlock_object (Register hdr, Register obj, Register disp_hdr, Label& slow_case) {
118+ void C1_MacroAssembler::unlock_object (Register hdr, Register obj, Register disp_hdr, Register temp, Label& slow_case) {
119119 const int aligned_mask = BytesPerWord - 1 ;
120120 const int hdr_offset = oopDesc::mark_offset_in_bytes ();
121- assert (hdr != obj && hdr != disp_hdr && obj != disp_hdr, " registers must be different " );
121+ assert_different_registers (hdr, obj, disp_hdr, temp, t0, t1 );
122122 Label done;
123123
124124 if (LockingMode != LM_LIGHTWEIGHT) {
@@ -135,18 +135,18 @@ void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_
135135
136136 if (LockingMode == LM_LIGHTWEIGHT) {
137137 ld (hdr, Address (obj, oopDesc::mark_offset_in_bytes ()));
138- test_bit (t0 , hdr, exact_log2 (markWord::monitor_value));
139- bnez (t0 , slow_case, /* is_far */ true );
140- lightweight_unlock (obj, hdr, t0 , t1, slow_case);
138+ test_bit (temp , hdr, exact_log2 (markWord::monitor_value));
139+ bnez (temp , slow_case, /* is_far */ true );
140+ lightweight_unlock (obj, hdr, temp , t1, slow_case);
141141 } else if (LockingMode == LM_LEGACY) {
142142 // test if object header is pointing to the displaced header, and if so, restore
143143 // the displaced header in the object - if the object header is not pointing to
144144 // the displaced header, get the object header instead
145145 // if the object header was not pointing to the displaced header,
146146 // we do unlocking via runtime call
147147 if (hdr_offset) {
148- la (t0 , Address (obj, hdr_offset));
149- cmpxchgptr (disp_hdr, hdr, t0 , t1, done, &slow_case);
148+ la (temp , Address (obj, hdr_offset));
149+ cmpxchgptr (disp_hdr, hdr, temp , t1, done, &slow_case);
150150 } else {
151151 cmpxchgptr (disp_hdr, hdr, obj, t1, done, &slow_case);
152152 }
0 commit comments