Path: blob/master/src/hotspot/cpu/arm/frame_arm.inline.hpp
40930 views
/*1* Copyright (c) 2008, 2019, 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 CPU_ARM_FRAME_ARM_INLINE_HPP25#define CPU_ARM_FRAME_ARM_INLINE_HPP2627#include "code/codeCache.hpp"28#include "code/vmreg.inline.hpp"2930// Inline functions for ARM frames:3132// Constructors:3334inline frame::frame() {35_pc = NULL;36_sp = NULL;37_unextended_sp = NULL;38_fp = NULL;39_cb = NULL;40_deopt_state = unknown;41}4243inline void frame::init(intptr_t* sp, intptr_t* fp, address pc) {44_sp = sp;45_unextended_sp = sp;46_fp = fp;47_pc = pc;48assert(pc != NULL, "no pc?");49_cb = CodeCache::find_blob(pc);50adjust_unextended_sp();5152address original_pc = CompiledMethod::get_deopt_original_pc(this);53if (original_pc != NULL) {54_pc = original_pc;55_deopt_state = is_deoptimized;56} else {57_deopt_state = not_deoptimized;58}59}6061inline frame::frame(intptr_t* sp, intptr_t* fp, address pc) {62init(sp, fp, pc);63}6465inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc) {66_sp = sp;67_unextended_sp = unextended_sp;68_fp = fp;69_pc = pc;70assert(pc != NULL, "no pc?");71_cb = CodeCache::find_blob(pc);72adjust_unextended_sp();7374address original_pc = CompiledMethod::get_deopt_original_pc(this);75if (original_pc != NULL) {76_pc = original_pc;77assert(_cb->as_compiled_method()->insts_contains_inclusive(_pc),78"original PC must be in the main code section of the the compiled method (or must be immediately following it)");79_deopt_state = is_deoptimized;80} else {81_deopt_state = not_deoptimized;82}83}848586inline frame::frame(intptr_t* sp, intptr_t* fp) {87_sp = sp;88_unextended_sp = sp;89_fp = fp;90assert(sp != NULL,"null SP ?");91_pc = (address)(sp[-1]);92// assert(_pc != NULL, "no pc?"); // see comments in x8693_cb = CodeCache::find_blob(_pc);94adjust_unextended_sp();9596address original_pc = CompiledMethod::get_deopt_original_pc(this);97if (original_pc != NULL) {98_pc = original_pc;99_deopt_state = is_deoptimized;100} else {101_deopt_state = not_deoptimized;102}103}104105106// Accessors107108inline bool frame::equal(frame other) const {109bool ret = sp() == other.sp()110&& unextended_sp() == other.unextended_sp()111&& fp() == other.fp()112&& pc() == other.pc();113assert(!ret || ret && cb() == other.cb() && _deopt_state == other._deopt_state, "inconsistent construction");114return ret;115}116117// Return unique id for this frame. The id must have a value where we can distinguish118// identity and younger/older relationship. NULL represents an invalid (incomparable)119// frame.120inline intptr_t* frame::id(void) const { return unextended_sp(); }121122// Return true if the frame is older (less recent activation) than the frame represented by id123inline bool frame::is_older(intptr_t* id) const { assert(this->id() != NULL && id != NULL, "NULL frame id");124return this->id() > id ; }125126127inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); }128129inline intptr_t* frame::unextended_sp() const { return _unextended_sp; }130131// Return address:132133inline address* frame::sender_pc_addr() const { return (address*) addr_at(return_addr_offset); }134inline address frame::sender_pc() const { return *sender_pc_addr(); }135136inline intptr_t* frame::sender_sp() const { return addr_at(sender_sp_offset); }137138inline intptr_t** frame::interpreter_frame_locals_addr() const {139return (intptr_t**)addr_at(interpreter_frame_locals_offset);140}141142inline intptr_t* frame::interpreter_frame_last_sp() const {143return *(intptr_t**)addr_at(interpreter_frame_last_sp_offset);144}145146inline intptr_t* frame::interpreter_frame_bcp_addr() const {147return (intptr_t*)addr_at(interpreter_frame_bcp_offset);148}149150inline intptr_t* frame::interpreter_frame_mdp_addr() const {151return (intptr_t*)addr_at(interpreter_frame_mdp_offset);152}153154155// Constant pool cache156157inline ConstantPoolCache** frame::interpreter_frame_cache_addr() const {158return (ConstantPoolCache**)addr_at(interpreter_frame_cache_offset);159}160161// Method162163inline Method** frame::interpreter_frame_method_addr() const {164return (Method**)addr_at(interpreter_frame_method_offset);165}166167inline oop* frame::interpreter_frame_mirror_addr() const {168return (oop*)addr_at(interpreter_frame_mirror_offset);169}170171// top of expression stack172inline intptr_t* frame::interpreter_frame_tos_address() const {173intptr_t* last_sp = interpreter_frame_last_sp();174if (last_sp == NULL ) {175return sp();176} else {177// sp() may have been extended or shrunk by an adapter. At least178// check that we don't fall behind the legal region.179// For top deoptimized frame last_sp == interpreter_frame_monitor_end.180assert(last_sp <= (intptr_t*) interpreter_frame_monitor_end(), "bad tos");181return last_sp;182}183}184185inline oop* frame::interpreter_frame_temp_oop_addr() const {186return (oop *)(fp() + interpreter_frame_oop_temp_offset);187}188189inline int frame::interpreter_frame_monitor_size() {190return BasicObjectLock::size();191}192193194// expression stack195// (the max_stack arguments are used by the GC; see class FrameClosure)196197inline intptr_t* frame::interpreter_frame_expression_stack() const {198intptr_t* monitor_end = (intptr_t*) interpreter_frame_monitor_end();199return monitor_end-1;200}201202203// Entry frames204205inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const {206return (JavaCallWrapper**)addr_at(entry_frame_call_wrapper_offset);207}208209210// Compiled frames211212inline oop frame::saved_oop_result(RegisterMap* map) const {213oop* result_adr = (oop*) map->location(R0->as_VMReg());214guarantee(result_adr != NULL, "bad register save location");215return (*result_adr);216}217218inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {219oop* result_adr = (oop*) map->location(R0->as_VMReg());220guarantee(result_adr != NULL, "bad register save location");221*result_adr = obj;222}223224#endif // CPU_ARM_FRAME_ARM_INLINE_HPP225226227