Path: blob/master/src/hotspot/share/code/pcDesc.hpp
40931 views
/*1* Copyright (c) 1997, 2020, 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_CODE_PCDESC_HPP25#define SHARE_CODE_PCDESC_HPP262728// PcDescs map a physical PC (given as offset from start of nmethod) to29// the corresponding source scope and byte code index.3031class CompiledMethod;3233class PcDesc {34friend class VMStructs;35private:36int _pc_offset; // offset from start of nmethod37int _scope_decode_offset; // offset for scope in nmethod38int _obj_decode_offset;3940enum {41PCDESC_reexecute = 1 << 0,42PCDESC_is_method_handle_invoke = 1 << 1,43PCDESC_return_oop = 1 << 2,44PCDESC_rethrow_exception = 1 << 3,45PCDESC_has_ea_local_in_scope = 1 << 4,46PCDESC_arg_escape = 1 << 5,47PCDESC_is_optimized_linkToNative = 1 << 648};4950int _flags;5152void set_flag(int mask, bool z) {53_flags = z ? (_flags | mask) : (_flags & ~mask);54}5556public:57int pc_offset() const { return _pc_offset; }58int scope_decode_offset() const { return _scope_decode_offset; }59int obj_decode_offset() const { return _obj_decode_offset; }6061void set_pc_offset(int x) { _pc_offset = x; }62void set_scope_decode_offset(int x) { _scope_decode_offset = x; }63void set_obj_decode_offset(int x) { _obj_decode_offset = x; }6465// Constructor (only used for static in nmethod.cpp)66// Also used by ScopeDesc::sender()]67PcDesc(int pc_offset, int scope_decode_offset, int obj_decode_offset);6869enum {70// upper and lower exclusive limits real offsets:71lower_offset_limit = -1,72upper_offset_limit = (unsigned int)-1 >> 173};7475// Flags76bool rethrow_exception() const { return (_flags & PCDESC_rethrow_exception) != 0; }77void set_rethrow_exception(bool z) { set_flag(PCDESC_rethrow_exception, z); }78bool should_reexecute() const { return (_flags & PCDESC_reexecute) != 0; }79void set_should_reexecute(bool z) { set_flag(PCDESC_reexecute, z); }8081// Does pd refer to the same information as pd?82bool is_same_info(const PcDesc* pd) {83return _scope_decode_offset == pd->_scope_decode_offset &&84_obj_decode_offset == pd->_obj_decode_offset &&85_flags == pd->_flags;86}8788bool is_method_handle_invoke() const { return (_flags & PCDESC_is_method_handle_invoke) != 0; }89void set_is_method_handle_invoke(bool z) { set_flag(PCDESC_is_method_handle_invoke, z); }9091bool is_optimized_linkToNative() const { return (_flags & PCDESC_is_optimized_linkToNative) != 0; }92void set_is_optimized_linkToNative(bool z) { set_flag(PCDESC_is_optimized_linkToNative, z); }9394bool return_oop() const { return (_flags & PCDESC_return_oop) != 0; }95void set_return_oop(bool z) { set_flag(PCDESC_return_oop, z); }9697// Indicates if there are objects in scope that, based on escape analysis, are local to the98// compiled method or local to the current thread, i.e. NoEscape or ArgEscape99bool has_ea_local_in_scope() const { return (_flags & PCDESC_has_ea_local_in_scope) != 0; }100void set_has_ea_local_in_scope(bool z) { set_flag(PCDESC_has_ea_local_in_scope, z); }101102// Indicates if this pc descriptor is at a call site where objects that do not escape the103// current thread are passed as arguments.104bool arg_escape() const { return (_flags & PCDESC_arg_escape) != 0; }105void set_arg_escape(bool z) { set_flag(PCDESC_arg_escape, z); }106107// Returns the real pc108address real_pc(const CompiledMethod* code) const;109110void print(CompiledMethod* code) { print_on(tty, code); }111void print_on(outputStream* st, CompiledMethod* code);112bool verify(CompiledMethod* code);113};114115#endif // SHARE_CODE_PCDESC_HPP116117118