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