188 // traces and tools as well |
188 // traces and tools as well |
189 GrowableArray<MonitorInfo*> *monitors = new GrowableArray<MonitorInfo*>(1); |
189 GrowableArray<MonitorInfo*> *monitors = new GrowableArray<MonitorInfo*>(1); |
190 // Casting away const |
190 // Casting away const |
191 frame& fr = (frame&) _fr; |
191 frame& fr = (frame&) _fr; |
192 MonitorInfo* info = new MonitorInfo(fr.compiled_synchronized_native_monitor_owner(nm), |
192 MonitorInfo* info = new MonitorInfo(fr.compiled_synchronized_native_monitor_owner(nm), |
193 fr.compiled_synchronized_native_monitor(nm), false); |
193 fr.compiled_synchronized_native_monitor(nm), false, false); |
194 monitors->push(info); |
194 monitors->push(info); |
195 return monitors; |
195 return monitors; |
196 } |
196 } |
197 GrowableArray<MonitorValue*>* monitors = scope()->monitors(); |
197 GrowableArray<MonitorValue*>* monitors = scope()->monitors(); |
198 if (monitors == NULL) { |
198 if (monitors == NULL) { |
199 return new GrowableArray<MonitorInfo*>(0); |
199 return new GrowableArray<MonitorInfo*>(0); |
200 } |
200 } |
201 GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(monitors->length()); |
201 GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(monitors->length()); |
202 for (int index = 0; index < monitors->length(); index++) { |
202 for (int index = 0; index < monitors->length(); index++) { |
203 MonitorValue* mv = monitors->at(index); |
203 MonitorValue* mv = monitors->at(index); |
204 StackValue *owner_sv = create_stack_value(mv->owner()); // it is an oop |
204 ScopeValue* ov = mv->owner(); |
205 result->push(new MonitorInfo(owner_sv->get_obj()(), resolve_monitor_lock(mv->basic_lock()), mv->eliminated())); |
205 StackValue *owner_sv = create_stack_value(ov); // it is an oop |
|
206 if (ov->is_object() && owner_sv->obj_is_scalar_replaced()) { // The owner object was scalar replaced |
|
207 assert(mv->eliminated(), "monitor should be eliminated for scalar replaced object"); |
|
208 // Put klass for scalar replaced object. |
|
209 ScopeValue* kv = ((ObjectValue *)ov)->klass(); |
|
210 assert(kv->is_constant_oop(), "klass should be oop constant for scalar replaced object"); |
|
211 KlassHandle k(((ConstantOopReadValue*)kv)->value()()); |
|
212 result->push(new MonitorInfo(k->as_klassOop(), resolve_monitor_lock(mv->basic_lock()), |
|
213 mv->eliminated(), true)); |
|
214 } else { |
|
215 result->push(new MonitorInfo(owner_sv->get_obj()(), resolve_monitor_lock(mv->basic_lock()), |
|
216 mv->eliminated(), false)); |
|
217 } |
206 } |
218 } |
207 return result; |
219 return result; |
208 } |
220 } |
209 |
221 |
210 |
222 |