1 /* |
1 /* |
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2016, 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 |
195 |
196 GrowableArray<MonitorInfo*>* compiledVFrame::monitors() const { |
196 GrowableArray<MonitorInfo*>* compiledVFrame::monitors() const { |
197 // Natives has no scope |
197 // Natives has no scope |
198 if (scope() == NULL) { |
198 if (scope() == NULL) { |
199 nmethod* nm = code(); |
199 CompiledMethod* nm = code(); |
200 Method* method = nm->method(); |
200 Method* method = nm->method(); |
201 assert(method->is_native(), ""); |
201 assert(method->is_native(), ""); |
202 if (!method->is_synchronized()) { |
202 if (!method->is_synchronized()) { |
203 return new GrowableArray<MonitorInfo*>(0); |
203 return new GrowableArray<MonitorInfo*>(0); |
204 } |
204 } |
238 } |
238 } |
239 return result; |
239 return result; |
240 } |
240 } |
241 |
241 |
242 |
242 |
243 compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, nmethod* nm) |
243 compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, CompiledMethod* nm) |
244 : javaVFrame(fr, reg_map, thread) { |
244 : javaVFrame(fr, reg_map, thread) { |
245 _scope = NULL; |
245 _scope = NULL; |
246 // Compiled method (native stub or Java code) |
246 // Compiled method (native stub or Java code) |
247 // native wrappers have no scope data, it is implied |
247 // native wrappers have no scope data, it is implied |
248 if (!nm->is_native_method()) { |
248 if (!nm->is_compiled() || !nm->as_compiled_method()->is_native_method()) { |
249 _scope = nm->scope_desc_at(_fr.pc()); |
249 _scope = nm->scope_desc_at(_fr.pc()); |
250 } |
250 } |
251 } |
251 } |
252 |
252 |
253 compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, ScopeDesc* scope) |
253 compiledVFrame::compiledVFrame(const frame* fr, const RegisterMap* reg_map, JavaThread* thread, ScopeDesc* scope) |
254 : javaVFrame(fr, reg_map, thread) { |
254 : javaVFrame(fr, reg_map, thread) { |
262 if (scope() == NULL) return true; |
262 if (scope() == NULL) return true; |
263 return scope()->is_top(); |
263 return scope()->is_top(); |
264 } |
264 } |
265 |
265 |
266 |
266 |
267 nmethod* compiledVFrame::code() const { |
267 CompiledMethod* compiledVFrame::code() const { |
268 return CodeCache::find_nmethod(_fr.pc()); |
268 return CodeCache::find_compiled(_fr.pc()); |
269 } |
269 } |
270 |
270 |
271 |
271 |
272 Method* compiledVFrame::method() const { |
272 Method* compiledVFrame::method() const { |
273 if (scope() == NULL) { |
273 if (scope() == NULL) { |
274 // native nmethods have no scope the method is implied |
274 // native nmethods have no scope the method is implied |
275 nmethod* nm = code(); |
275 nmethod* nm = code()->as_nmethod(); |
276 assert(nm->is_native_method(), "must be native"); |
276 assert(nm->is_native_method(), "must be native"); |
277 return nm->method(); |
277 return nm->method(); |
278 } |
278 } |
279 return scope()->method(); |
279 return scope()->method(); |
280 } |
280 } |
287 |
287 |
288 |
288 |
289 int compiledVFrame::raw_bci() const { |
289 int compiledVFrame::raw_bci() const { |
290 if (scope() == NULL) { |
290 if (scope() == NULL) { |
291 // native nmethods have no scope the method/bci is implied |
291 // native nmethods have no scope the method/bci is implied |
292 nmethod* nm = code(); |
292 nmethod* nm = code()->as_nmethod(); |
293 assert(nm->is_native_method(), "must be native"); |
293 assert(nm->is_native_method(), "must be native"); |
294 return 0; |
294 return 0; |
295 } |
295 } |
296 return scope()->bci(); |
296 return scope()->bci(); |
297 } |
297 } |
298 |
298 |
299 bool compiledVFrame::should_reexecute() const { |
299 bool compiledVFrame::should_reexecute() const { |
300 if (scope() == NULL) { |
300 if (scope() == NULL) { |
301 // native nmethods have no scope the method/bci is implied |
301 // native nmethods have no scope the method/bci is implied |
302 nmethod* nm = code(); |
302 nmethod* nm = code()->as_nmethod(); |
303 assert(nm->is_native_method(), "must be native"); |
303 assert(nm->is_native_method(), "must be native"); |
304 return false; |
304 return false; |
305 } |
305 } |
306 return scope()->should_reexecute(); |
306 return scope()->should_reexecute(); |
307 } |
307 } |
308 |
308 |
309 vframe* compiledVFrame::sender() const { |
309 vframe* compiledVFrame::sender() const { |
310 const frame f = fr(); |
310 const frame f = fr(); |
311 if (scope() == NULL) { |
311 if (scope() == NULL) { |
312 // native nmethods have no scope the method/bci is implied |
312 // native nmethods have no scope the method/bci is implied |
313 nmethod* nm = code(); |
313 nmethod* nm = code()->as_nmethod(); |
314 assert(nm->is_native_method(), "must be native"); |
314 assert(nm->is_native_method(), "must be native"); |
315 return vframe::sender(); |
315 return vframe::sender(); |
316 } else { |
316 } else { |
317 return scope()->is_top() |
317 return scope()->is_top() |
318 ? vframe::sender() |
318 ? vframe::sender() |