duke@435: /* cfang@1366: * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * duke@435: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: * CA 95054 USA or visit www.sun.com if you need additional information or duke@435: * have any questions. duke@435: * duke@435: */ duke@435: duke@435: // PcDescs map a physical PC (given as offset from start of nmethod) to duke@435: // the corresponding source scope and byte code index. duke@435: duke@435: class nmethod; duke@435: duke@435: class PcDesc VALUE_OBJ_CLASS_SPEC { duke@435: friend class VMStructs; duke@435: private: duke@435: int _pc_offset; // offset from start of nmethod duke@435: int _scope_decode_offset; // offset for scope in nmethod duke@435: int _obj_decode_offset; duke@435: cfang@1366: union PcDescFlags { cfang@1366: int word; cfang@1366: struct { cfang@1366: unsigned int reexecute: 1; cfang@1366: } bits; never@1449: bool operator ==(const PcDescFlags& other) { return word == other.word; } cfang@1366: } _flags; cfang@1366: duke@435: public: duke@435: int pc_offset() const { return _pc_offset; } duke@435: int scope_decode_offset() const { return _scope_decode_offset; } duke@435: int obj_decode_offset() const { return _obj_decode_offset; } duke@435: duke@435: void set_pc_offset(int x) { _pc_offset = x; } duke@435: void set_scope_decode_offset(int x) { _scope_decode_offset = x; } duke@435: void set_obj_decode_offset(int x) { _obj_decode_offset = x; } duke@435: duke@435: // Constructor (only used for static in nmethod.cpp) duke@435: // Also used by ScopeDesc::sender()] duke@435: PcDesc(int pc_offset, int scope_decode_offset, int obj_decode_offset); duke@435: duke@435: enum { duke@435: // upper and lower exclusive limits real offsets: duke@435: lower_offset_limit = -1, duke@435: upper_offset_limit = (unsigned int)-1 >> 1 duke@435: }; duke@435: cfang@1366: // Flags cfang@1366: bool should_reexecute() const { return _flags.bits.reexecute; } cfang@1366: void set_should_reexecute(bool z) { _flags.bits.reexecute = z; } cfang@1366: never@1449: // Does pd refer to the same information as pd? never@1449: bool is_same_info(const PcDesc* pd) { never@1449: return _scope_decode_offset == pd->_scope_decode_offset && never@1449: _obj_decode_offset == pd->_obj_decode_offset && never@1449: _flags == pd->_flags; never@1449: } never@1449: duke@435: // Returns the real pc duke@435: address real_pc(const nmethod* code) const; duke@435: duke@435: void print(nmethod* code); duke@435: bool verify(nmethod* code); duke@435: };