Path: blob/master/src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp
40930 views
/*1* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2014, Red Hat Inc. All rights reserved.3* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4*5* This code is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#ifndef CPU_AARCH64_FRAME_AARCH64_INLINE_HPP26#define CPU_AARCH64_FRAME_AARCH64_INLINE_HPP2728#include "code/codeCache.hpp"29#include "code/vmreg.inline.hpp"3031// Inline functions for AArch64 frames:3233// Constructors:3435inline frame::frame() {36_pc = NULL;37_sp = NULL;38_unextended_sp = NULL;39_fp = NULL;40_cb = NULL;41_deopt_state = unknown;42}4344static int spin;4546inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) {47intptr_t a = intptr_t(sp);48intptr_t b = intptr_t(fp);49_sp = sp;50_unextended_sp = sp;51_fp = fp;52_pc = pc;53assert(pc != NULL, "no pc?");54_cb = CodeCache::find_blob(pc);55adjust_unextended_sp();5657address original_pc = CompiledMethod::get_deopt_original_pc(this);58if (original_pc != NULL) {59_pc = original_pc;60_deopt_state = is_deoptimized;61} else {62_deopt_state = not_deoptimized;63}64}6566inline frame::frame(intptr_t* sp, intptr_t* fp, address pc) {67init(sp, fp, pc);68}6970inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc) {71intptr_t a = intptr_t(sp);72intptr_t b = intptr_t(fp);73_sp = sp;74_unextended_sp = unextended_sp;75_fp = fp;76_pc = pc;77assert(pc != NULL, "no pc?");78_cb = CodeCache::find_blob(pc);79adjust_unextended_sp();8081address original_pc = CompiledMethod::get_deopt_original_pc(this);82if (original_pc != NULL) {83_pc = original_pc;84assert(_cb->as_compiled_method()->insts_contains_inclusive(_pc),85"original PC must be in the main code section of the the compiled method (or must be immediately following it)");86_deopt_state = is_deoptimized;87} else {88_deopt_state = not_deoptimized;89}90}9192inline frame::frame(intptr_t* sp, intptr_t* fp) {93intptr_t a = intptr_t(sp);94intptr_t b = intptr_t(fp);95_sp = sp;96_unextended_sp = sp;97_fp = fp;98_pc = (address)(sp[-1]);99100// Here's a sticky one. This constructor can be called via AsyncGetCallTrace101// when last_Java_sp is non-null but the pc fetched is junk. If we are truly102// unlucky the junk value could be to a zombied method and we'll die on the103// find_blob call. This is also why we can have no asserts on the validity104// of the pc we find here. AsyncGetCallTrace -> pd_get_top_frame_for_signal_handler105// -> pd_last_frame should use a specialized version of pd_last_frame which could106// call a specilaized frame constructor instead of this one.107// Then we could use the assert below. However this assert is of somewhat dubious108// value.109// assert(_pc != NULL, "no pc?");110111_cb = CodeCache::find_blob(_pc);112adjust_unextended_sp();113114address original_pc = CompiledMethod::get_deopt_original_pc(this);115if (original_pc != NULL) {116_pc = original_pc;117_deopt_state = is_deoptimized;118} else {119_deopt_state = not_deoptimized;120}121}122123// Accessors124125inline bool frame::equal(frame other) const {126bool ret = sp() == other.sp()127&& unextended_sp() == other.unextended_sp()128&& fp() == other.fp()129&& pc() == other.pc();130assert(!ret || ret && cb() == other.cb() && _deopt_state == other._deopt_state, "inconsistent construction");131return ret;132}133134// Return unique id for this frame. The id must have a value where we can distinguish135// identity and younger/older relationship. NULL represents an invalid (incomparable)136// frame.137inline intptr_t* frame::id(void) const { return unextended_sp(); }138139// Return true if the frame is older (less recent activation) than the frame represented by id140inline bool frame::is_older(intptr_t* id) const { assert(this->id() != NULL && id != NULL, "NULL frame id");141return this->id() > id ; }142143144145inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); }146147148inline intptr_t* frame::unextended_sp() const { return _unextended_sp; }149150// Return address:151152inline address* frame::sender_pc_addr() const { return (address*) addr_at( return_addr_offset); }153inline address frame::sender_pc() const { return *sender_pc_addr(); }154155inline intptr_t* frame::sender_sp() const { return addr_at( sender_sp_offset); }156157inline intptr_t** frame::interpreter_frame_locals_addr() const {158return (intptr_t**)addr_at(interpreter_frame_locals_offset);159}160161inline intptr_t* frame::interpreter_frame_last_sp() const {162return *(intptr_t**)addr_at(interpreter_frame_last_sp_offset);163}164165inline intptr_t* frame::interpreter_frame_bcp_addr() const {166return (intptr_t*)addr_at(interpreter_frame_bcp_offset);167}168169inline intptr_t* frame::interpreter_frame_mdp_addr() const {170return (intptr_t*)addr_at(interpreter_frame_mdp_offset);171}172173174// Constant pool cache175176inline ConstantPoolCache** frame::interpreter_frame_cache_addr() const {177return (ConstantPoolCache**)addr_at(interpreter_frame_cache_offset);178}179180// Method181182inline Method** frame::interpreter_frame_method_addr() const {183return (Method**)addr_at(interpreter_frame_method_offset);184}185186// Mirror187188inline oop* frame::interpreter_frame_mirror_addr() const {189return (oop*)addr_at(interpreter_frame_mirror_offset);190}191192// top of expression stack193inline intptr_t* frame::interpreter_frame_tos_address() const {194intptr_t* last_sp = interpreter_frame_last_sp();195if (last_sp == NULL) {196return sp();197} else {198// sp() may have been extended or shrunk by an adapter. At least199// check that we don't fall behind the legal region.200// For top deoptimized frame last_sp == interpreter_frame_monitor_end.201assert(last_sp <= (intptr_t*) interpreter_frame_monitor_end(), "bad tos");202return last_sp;203}204}205206inline oop* frame::interpreter_frame_temp_oop_addr() const {207return (oop *)(fp() + interpreter_frame_oop_temp_offset);208}209210inline int frame::interpreter_frame_monitor_size() {211return BasicObjectLock::size();212}213214215// expression stack216// (the max_stack arguments are used by the GC; see class FrameClosure)217218inline intptr_t* frame::interpreter_frame_expression_stack() const {219intptr_t* monitor_end = (intptr_t*) interpreter_frame_monitor_end();220return monitor_end-1;221}222223224// Entry frames225226inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const {227return (JavaCallWrapper**)addr_at(entry_frame_call_wrapper_offset);228}229230231// Compiled frames232233inline oop frame::saved_oop_result(RegisterMap* map) const {234oop* result_adr = (oop *)map->location(r0->as_VMReg());235guarantee(result_adr != NULL, "bad register save location");236237return (*result_adr);238}239240inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {241oop* result_adr = (oop *)map->location(r0->as_VMReg());242guarantee(result_adr != NULL, "bad register save location");243244*result_adr = obj;245}246247#endif // CPU_AARCH64_FRAME_AARCH64_INLINE_HPP248249250