29 #include "c1/c1_Runtime1.hpp" |
29 #include "c1/c1_Runtime1.hpp" |
30 #include "classfile/systemDictionary.hpp" |
30 #include "classfile/systemDictionary.hpp" |
31 #include "gc/shared/collectedHeap.hpp" |
31 #include "gc/shared/collectedHeap.hpp" |
32 #include "interpreter/interpreter.hpp" |
32 #include "interpreter/interpreter.hpp" |
33 #include "oops/arrayOop.hpp" |
33 #include "oops/arrayOop.hpp" |
34 #include "oops/markOop.hpp" |
34 #include "oops/markWord.hpp" |
35 #include "runtime/basicLock.hpp" |
35 #include "runtime/basicLock.hpp" |
36 #include "runtime/biasedLocking.hpp" |
36 #include "runtime/biasedLocking.hpp" |
37 #include "runtime/os.hpp" |
37 #include "runtime/os.hpp" |
38 #include "runtime/sharedRuntime.hpp" |
38 #include "runtime/sharedRuntime.hpp" |
39 #include "runtime/stubRoutines.hpp" |
39 #include "runtime/stubRoutines.hpp" |
108 if (UseBiasedLocking) { |
108 if (UseBiasedLocking) { |
109 biased_locking_enter(CCR0, Roop, Rmark, Rscratch, R0, done, &slow_int); |
109 biased_locking_enter(CCR0, Roop, Rmark, Rscratch, R0, done, &slow_int); |
110 } |
110 } |
111 |
111 |
112 // ... and mark it unlocked. |
112 // ... and mark it unlocked. |
113 ori(Rmark, Rmark, markOopDesc::unlocked_value); |
113 ori(Rmark, Rmark, markWord::unlocked_value); |
114 |
114 |
115 // Save unlocked object header into the displaced header location on the stack. |
115 // Save unlocked object header into the displaced header location on the stack. |
116 std(Rmark, BasicLock::displaced_header_offset_in_bytes(), Rbox); |
116 std(Rmark, BasicLock::displaced_header_offset_in_bytes(), Rbox); |
117 |
117 |
118 // Compare object markOop with Rmark and if equal exchange Rscratch with object markOop. |
118 // Compare object markWord with Rmark and if equal exchange Rscratch with object markWord. |
119 assert(oopDesc::mark_offset_in_bytes() == 0, "cas must take a zero displacement"); |
119 assert(oopDesc::mark_offset_in_bytes() == 0, "cas must take a zero displacement"); |
120 cmpxchgd(/*flag=*/CCR0, |
120 cmpxchgd(/*flag=*/CCR0, |
121 /*current_value=*/Rscratch, |
121 /*current_value=*/Rscratch, |
122 /*compare_value=*/Rmark, |
122 /*compare_value=*/Rmark, |
123 /*exchange_value=*/Rbox, |
123 /*exchange_value=*/Rbox, |
135 b(slow_case); // far |
135 b(slow_case); // far |
136 |
136 |
137 bind(cas_failed); |
137 bind(cas_failed); |
138 // We did not find an unlocked object so see if this is a recursive case. |
138 // We did not find an unlocked object so see if this is a recursive case. |
139 sub(Rscratch, Rscratch, R1_SP); |
139 sub(Rscratch, Rscratch, R1_SP); |
140 load_const_optimized(R0, (~(os::vm_page_size()-1) | markOopDesc::lock_mask_in_place)); |
140 load_const_optimized(R0, (~(os::vm_page_size()-1) | markWord::lock_mask_in_place)); |
141 and_(R0/*==0?*/, Rscratch, R0); |
141 and_(R0/*==0?*/, Rscratch, R0); |
142 std(R0/*==0, perhaps*/, BasicLock::displaced_header_offset_in_bytes(), Rbox); |
142 std(R0/*==0, perhaps*/, BasicLock::displaced_header_offset_in_bytes(), Rbox); |
143 bne(CCR0, slow_int); |
143 bne(CCR0, slow_int); |
144 |
144 |
145 bind(done); |
145 bind(done); |
169 ld(Roop, BasicObjectLock::obj_offset_in_bytes(), Rbox); |
169 ld(Roop, BasicObjectLock::obj_offset_in_bytes(), Rbox); |
170 verify_oop(Roop); |
170 verify_oop(Roop); |
171 } |
171 } |
172 |
172 |
173 // Check if it is still a light weight lock, this is is true if we see |
173 // Check if it is still a light weight lock, this is is true if we see |
174 // the stack address of the basicLock in the markOop of the object. |
174 // the stack address of the basicLock in the markWord of the object. |
175 cmpxchgd(/*flag=*/CCR0, |
175 cmpxchgd(/*flag=*/CCR0, |
176 /*current_value=*/R0, |
176 /*current_value=*/R0, |
177 /*compare_value=*/Rbox, |
177 /*compare_value=*/Rbox, |
178 /*exchange_value=*/Rmark, |
178 /*exchange_value=*/Rmark, |
179 /*where=*/Roop, |
179 /*where=*/Roop, |
213 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) { |
213 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) { |
214 assert_different_registers(obj, klass, len, t1, t2); |
214 assert_different_registers(obj, klass, len, t1, t2); |
215 if (UseBiasedLocking && !len->is_valid()) { |
215 if (UseBiasedLocking && !len->is_valid()) { |
216 ld(t1, in_bytes(Klass::prototype_header_offset()), klass); |
216 ld(t1, in_bytes(Klass::prototype_header_offset()), klass); |
217 } else { |
217 } else { |
218 load_const_optimized(t1, (intx)markOopDesc::prototype()); |
218 load_const_optimized(t1, (intx)markWord::prototype().value()); |
219 } |
219 } |
220 std(t1, oopDesc::mark_offset_in_bytes(), obj); |
220 std(t1, oopDesc::mark_offset_in_bytes(), obj); |
221 store_klass(obj, klass); |
221 store_klass(obj, klass); |
222 if (len->is_valid()) { |
222 if (len->is_valid()) { |
223 stw(len, arrayOopDesc::length_offset_in_bytes(), obj); |
223 stw(len, arrayOopDesc::length_offset_in_bytes(), obj); |