Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/code/scopeDesc.hpp
32285 views
/*1* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_CODE_SCOPEDESC_HPP25#define SHARE_VM_CODE_SCOPEDESC_HPP2627#include "code/debugInfo.hpp"28#include "code/pcDesc.hpp"29#include "oops/method.hpp"30#include "utilities/growableArray.hpp"3132// SimpleScopeDesc is used when all you need to extract from33// a given pc,nmethod pair is a Method* and a bci. This is34// quite a bit faster than allocating a full ScopeDesc, but35// very limited in abilities.3637class SimpleScopeDesc : public StackObj {38private:39Method* _method;40int _bci;4142public:43SimpleScopeDesc(nmethod* code,address pc) {44PcDesc* pc_desc = code->pc_desc_at(pc);45assert(pc_desc != NULL, "Must be able to find matching PcDesc");46DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset());47int ignore_sender = buffer.read_int();48_method = buffer.read_method();49_bci = buffer.read_bci();50}5152Method* method() { return _method; }53int bci() { return _bci; }54};5556// ScopeDescs contain the information that makes source-level debugging of57// nmethods possible; each scopeDesc describes a method activation5859class ScopeDesc : public ResourceObj {60public:61// Constructor62ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool return_oop);6364// Calls above, giving default value of "serialized_null" to the65// "obj_decode_offset" argument. (We don't use a default argument to66// avoid a .hpp-.hpp dependency.)67ScopeDesc(const nmethod* code, int decode_offset, bool reexecute, bool return_oop);6869// JVM state70Method* method() const { return _method; }71int bci() const { return _bci; }72bool should_reexecute() const { return _reexecute; }73bool return_oop() const { return _return_oop; }7475GrowableArray<ScopeValue*>* locals();76GrowableArray<ScopeValue*>* expressions();77GrowableArray<MonitorValue*>* monitors();78GrowableArray<ScopeValue*>* objects();7980// Stack walking, returns NULL if this is the outer most scope.81ScopeDesc* sender() const;8283// Returns where the scope was decoded84int decode_offset() const { return _decode_offset; }8586// Tells whether sender() returns NULL87bool is_top() const;88// Tells whether sd is equal to this89bool is_equal(ScopeDesc* sd) const;9091private:92// Alternative constructor93ScopeDesc(const ScopeDesc* parent);9495// JVM state96Method* _method;97int _bci;98bool _reexecute;99bool _return_oop;100101// Decoding offsets102int _decode_offset;103int _sender_decode_offset;104int _locals_decode_offset;105int _expressions_decode_offset;106int _monitors_decode_offset;107108// Object pool109GrowableArray<ScopeValue*>* _objects;110111// Nmethod information112const nmethod* _code;113114// Decoding operations115void decode_body();116GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);117GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);118GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);119120DebugInfoReadStream* stream_at(int decode_offset) const;121122123public:124// Verification125void verify();126127#ifndef PRODUCT128public:129// Printing support130void print_on(outputStream* st) const;131void print_on(outputStream* st, PcDesc* pd) const;132void print_value_on(outputStream* st) const;133#endif134};135136#endif // SHARE_VM_CODE_SCOPEDESC_HPP137138139