@@ -82,59 +82,13 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox
82
82
// Save object being locked into the BasicObjectLock...
83
83
std (Roop, in_bytes (BasicObjectLock::obj_offset ()), Rbox);
84
84
85
- if (LockingMode == LM_LIGHTWEIGHT) {
86
- lightweight_lock (Rbox, Roop, Rmark, Rscratch, slow_int);
87
- } else if (LockingMode == LM_LEGACY) {
88
-
89
- if (DiagnoseSyncOnValueBasedClasses != 0 ) {
90
- load_klass (Rscratch, Roop);
91
- lbz (Rscratch, in_bytes (Klass::misc_flags_offset ()), Rscratch);
92
- testbitdi (CR0, R0, Rscratch, exact_log2 (KlassFlags::_misc_is_value_based_class));
93
- bne (CR0, slow_int);
94
- }
95
-
96
- // ... and mark it unlocked.
97
- ori (Rmark, Rmark, markWord::unlocked_value);
98
-
99
- // Save unlocked object header into the displaced header location on the stack.
100
- std (Rmark, BasicLock::displaced_header_offset_in_bytes (), Rbox);
101
-
102
- // Compare object markWord with Rmark and if equal exchange Rscratch with object markWord.
103
- assert (oopDesc::mark_offset_in_bytes () == 0 , " cas must take a zero displacement" );
104
- cmpxchgd (/* flag=*/ CR0,
105
- /* current_value=*/ Rscratch,
106
- /* compare_value=*/ Rmark,
107
- /* exchange_value=*/ Rbox,
108
- /* where=*/ Roop/* +0==mark_offset_in_bytes*/ ,
109
- MacroAssembler::MemBarRel | MacroAssembler::MemBarAcq,
110
- MacroAssembler::cmpxchgx_hint_acquire_lock (),
111
- noreg,
112
- &cas_failed,
113
- /* check without membar and ldarx first*/ true );
114
- // If compare/exchange succeeded we found an unlocked object and we now have locked it
115
- // hence we are done.
116
- } else {
117
- assert (false , " Unhandled LockingMode:%d" , LockingMode);
118
- }
85
+ lightweight_lock (Rbox, Roop, Rmark, Rscratch, slow_int);
119
86
b (done);
120
87
121
88
bind (slow_int);
122
89
b (slow_case); // far
123
90
124
- if (LockingMode == LM_LEGACY) {
125
- bind (cas_failed);
126
- // We did not find an unlocked object so see if this is a recursive case.
127
- sub (Rscratch, Rscratch, R1_SP);
128
- load_const_optimized (R0, (~(os::vm_page_size ()-1 ) | markWord::lock_mask_in_place));
129
- and_ (R0/* ==0?*/ , Rscratch, R0);
130
- std (R0/* ==0, perhaps*/ , BasicLock::displaced_header_offset_in_bytes (), Rbox);
131
- bne (CR0, slow_int);
132
- }
133
-
134
91
bind (done);
135
- if (LockingMode == LM_LEGACY) {
136
- inc_held_monitor_count (Rmark /* tmp*/ );
137
- }
138
92
}
139
93
140
94
@@ -146,43 +100,17 @@ void C1_MacroAssembler::unlock_object(Register Rmark, Register Roop, Register Rb
146
100
Address mark_addr (Roop, oopDesc::mark_offset_in_bytes ());
147
101
assert (mark_addr.disp () == 0 , " cas must take a zero displacement" );
148
102
149
- if (LockingMode != LM_LIGHTWEIGHT) {
150
- // Test first if it is a fast recursive unlock.
151
- ld (Rmark, BasicLock::displaced_header_offset_in_bytes (), Rbox);
152
- cmpdi (CR0, Rmark, 0 );
153
- beq (CR0, done);
154
- }
155
-
156
103
// Load object.
157
104
ld (Roop, in_bytes (BasicObjectLock::obj_offset ()), Rbox);
158
105
verify_oop (Roop, FILE_AND_LINE);
159
106
160
- if (LockingMode == LM_LIGHTWEIGHT) {
161
- lightweight_unlock (Roop, Rmark, slow_int);
162
- } else if (LockingMode == LM_LEGACY) {
163
- // Check if it is still a light weight lock, this is is true if we see
164
- // the stack address of the basicLock in the markWord of the object.
165
- cmpxchgd (/* flag=*/ CR0,
166
- /* current_value=*/ R0,
167
- /* compare_value=*/ Rbox,
168
- /* exchange_value=*/ Rmark,
169
- /* where=*/ Roop,
170
- MacroAssembler::MemBarRel,
171
- MacroAssembler::cmpxchgx_hint_release_lock (),
172
- noreg,
173
- &slow_int);
174
- } else {
175
- assert (false , " Unhandled LockingMode:%d" , LockingMode);
176
- }
107
+ lightweight_unlock (Roop, Rmark, slow_int);
177
108
b (done);
178
109
bind (slow_int);
179
110
b (slow_case); // far
180
111
181
112
// Done
182
113
bind (done);
183
- if (LockingMode == LM_LEGACY) {
184
- dec_held_monitor_count (Rmark /* tmp*/ );
185
- }
186
114
}
187
115
188
116
0 commit comments