0N/A/*
1879N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. 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 *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#ifndef SHARE_VM_CODE_PCDESC_HPP
1879N/A#define SHARE_VM_CODE_PCDESC_HPP
1879N/A
1879N/A#include "memory/allocation.hpp"
1879N/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
2742N/A enum {
2742N/A PCDESC_reexecute = 1 << 0,
2742N/A PCDESC_is_method_handle_invoke = 1 << 1,
2742N/A PCDESC_return_oop = 1 << 2
2742N/A };
2742N/A
2742N/A int _flags;
2742N/A
2742N/A void set_flag(int mask, bool z) {
2742N/A _flags = z ? (_flags | mask) : (_flags & ~mask);
2742N/A }
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
2742N/A bool should_reexecute() const { return (_flags & PCDESC_reexecute) != 0; }
2742N/A void set_should_reexecute(bool z) { set_flag(PCDESC_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
2742N/A bool is_method_handle_invoke() const { return (_flags & PCDESC_is_method_handle_invoke) != 0; }
2742N/A void set_is_method_handle_invoke(bool z) { set_flag(PCDESC_is_method_handle_invoke, z); }
1135N/A
2742N/A bool return_oop() const { return (_flags & PCDESC_return_oop) != 0; }
2742N/A void set_return_oop(bool z) { set_flag(PCDESC_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};
1879N/A
1879N/A#endif // SHARE_VM_CODE_PCDESC_HPP