1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
194 |
194 |
195 GrowableArray<MonitorInfo*>* compiledVFrame::monitors() const { |
195 GrowableArray<MonitorInfo*>* compiledVFrame::monitors() const { |
196 // Natives has no scope |
196 // Natives has no scope |
197 if (scope() == NULL) { |
197 if (scope() == NULL) { |
198 nmethod* nm = code(); |
198 nmethod* nm = code(); |
199 methodOop method = nm->method(); |
199 Method* method = nm->method(); |
200 assert(method->is_native(), ""); |
200 assert(method->is_native(), ""); |
201 if (!method->is_synchronized()) { |
201 if (!method->is_synchronized()) { |
202 return new GrowableArray<MonitorInfo*>(0); |
202 return new GrowableArray<MonitorInfo*>(0); |
203 } |
203 } |
204 // This monitor is really only needed for UseBiasedLocking, but |
204 // This monitor is really only needed for UseBiasedLocking, but |
224 if (ov->is_object() && owner_sv->obj_is_scalar_replaced()) { // The owner object was scalar replaced |
224 if (ov->is_object() && owner_sv->obj_is_scalar_replaced()) { // The owner object was scalar replaced |
225 assert(mv->eliminated(), "monitor should be eliminated for scalar replaced object"); |
225 assert(mv->eliminated(), "monitor should be eliminated for scalar replaced object"); |
226 // Put klass for scalar replaced object. |
226 // Put klass for scalar replaced object. |
227 ScopeValue* kv = ((ObjectValue *)ov)->klass(); |
227 ScopeValue* kv = ((ObjectValue *)ov)->klass(); |
228 assert(kv->is_constant_oop(), "klass should be oop constant for scalar replaced object"); |
228 assert(kv->is_constant_oop(), "klass should be oop constant for scalar replaced object"); |
229 KlassHandle k(((ConstantOopReadValue*)kv)->value()()); |
229 Handle k(((ConstantOopReadValue*)kv)->value()()); |
230 result->push(new MonitorInfo(k->as_klassOop(), resolve_monitor_lock(mv->basic_lock()), |
230 assert(java_lang_Class::is_instance(k()), "must be"); |
|
231 result->push(new MonitorInfo(k(), resolve_monitor_lock(mv->basic_lock()), |
231 mv->eliminated(), true)); |
232 mv->eliminated(), true)); |
232 } else { |
233 } else { |
233 result->push(new MonitorInfo(owner_sv->get_obj()(), resolve_monitor_lock(mv->basic_lock()), |
234 result->push(new MonitorInfo(owner_sv->get_obj()(), resolve_monitor_lock(mv->basic_lock()), |
234 mv->eliminated(), false)); |
235 mv->eliminated(), false)); |
235 } |
236 } |
265 nmethod* compiledVFrame::code() const { |
266 nmethod* compiledVFrame::code() const { |
266 return CodeCache::find_nmethod(_fr.pc()); |
267 return CodeCache::find_nmethod(_fr.pc()); |
267 } |
268 } |
268 |
269 |
269 |
270 |
270 methodOop compiledVFrame::method() const { |
271 Method* compiledVFrame::method() const { |
271 if (scope() == NULL) { |
272 if (scope() == NULL) { |
272 // native nmethods have no scope the method is implied |
273 // native nmethods have no scope the method is implied |
273 nmethod* nm = code(); |
274 nmethod* nm = code(); |
274 assert(nm->is_native_method(), "must be native"); |
275 assert(nm->is_native_method(), "must be native"); |
275 return nm->method(); |
276 return nm->method(); |
276 } |
277 } |
277 return scope()->method()(); |
278 return scope()->method(); |
278 } |
279 } |
279 |
280 |
280 |
281 |
281 int compiledVFrame::bci() const { |
282 int compiledVFrame::bci() const { |
282 int raw = raw_bci(); |
283 int raw = raw_bci(); |
316 ? vframe::sender() |
317 ? vframe::sender() |
317 : new compiledVFrame(&f, register_map(), thread(), scope()->sender()); |
318 : new compiledVFrame(&f, register_map(), thread(), scope()->sender()); |
318 } |
319 } |
319 } |
320 } |
320 |
321 |
321 jvmtiDeferredLocalVariableSet::jvmtiDeferredLocalVariableSet(methodOop method, int bci, intptr_t* id) { |
322 jvmtiDeferredLocalVariableSet::jvmtiDeferredLocalVariableSet(Method* method, int bci, intptr_t* id) { |
322 _method = method; |
323 _method = method; |
323 _bci = bci; |
324 _bci = bci; |
324 _id = id; |
325 _id = id; |
325 // Alway will need at least one, must be on C heap |
326 // Alway will need at least one, must be on C heap |
326 _locals = new(ResourceObj::C_HEAP, mtCompiler) GrowableArray<jvmtiDeferredLocalVariable*> (1, true); |
327 _locals = new(ResourceObj::C_HEAP, mtCompiler) GrowableArray<jvmtiDeferredLocalVariable*> (1, true); |
351 } |
352 } |
352 locals()->push(new jvmtiDeferredLocalVariable(idx, type, val)); |
353 locals()->push(new jvmtiDeferredLocalVariable(idx, type, val)); |
353 } |
354 } |
354 |
355 |
355 void jvmtiDeferredLocalVariableSet::oops_do(OopClosure* f) { |
356 void jvmtiDeferredLocalVariableSet::oops_do(OopClosure* f) { |
356 |
357 // The Method* is on the stack so a live activation keeps it alive |
357 f->do_oop((oop*) &_method); |
358 // either by mirror in interpreter or code in compiled code. |
358 for ( int i = 0; i < locals()->length(); i++ ) { |
359 for ( int i = 0; i < locals()->length(); i++ ) { |
359 if ( locals()->at(i)->type() == T_OBJECT) { |
360 if ( locals()->at(i)->type() == T_OBJECT) { |
360 f->do_oop(locals()->at(i)->oop_addr()); |
361 f->do_oop(locals()->at(i)->oop_addr()); |
361 } |
362 } |
362 } |
363 } |