Path: blob/master/src/hotspot/share/code/compiledMethod.inline.hpp
40931 views
/*1* Copyright (c) 2017, 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_COMPILEDMETHOD_INLINE_HPP25#define SHARE_CODE_COMPILEDMETHOD_INLINE_HPP2627#include "code/compiledMethod.hpp"2829#include "code/nativeInst.hpp"30#include "runtime/atomic.hpp"31#include "runtime/frame.hpp"3233inline bool CompiledMethod::is_deopt_pc(address pc) { return is_deopt_entry(pc) || is_deopt_mh_entry(pc); }3435// When using JVMCI the address might be off by the size of a call instruction.36inline bool CompiledMethod::is_deopt_entry(address pc) {37return pc == deopt_handler_begin()38#if INCLUDE_JVMCI39|| (is_compiled_by_jvmci() && pc == (deopt_handler_begin() + NativeCall::instruction_size))40#endif41;42}4344inline bool CompiledMethod::is_deopt_mh_entry(address pc) {45return pc == deopt_mh_handler_begin()46#if INCLUDE_JVMCI47|| (is_compiled_by_jvmci() && pc == (deopt_mh_handler_begin() + NativeCall::instruction_size))48#endif49;50}5152// -----------------------------------------------------------------------------53// CompiledMethod::get_deopt_original_pc54//55// Return the original PC for the given PC if:56// (a) the given PC belongs to a nmethod and57// (b) it is a deopt PC5859inline address CompiledMethod::get_deopt_original_pc(const frame* fr) {60if (fr->cb() == NULL) return NULL;6162CompiledMethod* cm = fr->cb()->as_compiled_method_or_null();63if (cm != NULL && cm->is_deopt_pc(fr->pc()))64return cm->get_original_pc(fr);6566return NULL;67}686970// class ExceptionCache methods7172inline int ExceptionCache::count() { return Atomic::load_acquire(&_count); }7374address ExceptionCache::pc_at(int index) {75assert(index >= 0 && index < count(),"");76return _pc[index];77}7879address ExceptionCache::handler_at(int index) {80assert(index >= 0 && index < count(),"");81return _handler[index];82}8384// increment_count is only called under lock, but there may be concurrent readers.85inline void ExceptionCache::increment_count() { Atomic::release_store(&_count, _count + 1); }868788#endif // SHARE_CODE_COMPILEDMETHOD_INLINE_HPP899091