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