Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/aarch32/vm/frame_aarch32.inline.hpp
32285 views
/*1* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2014, Red Hat Inc. All rights reserved.3* Copyright (c) 2015, Linaro Ltd. All rights reserved.4* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.5*6* This code is free software; you can redistribute it and/or modify it7* under the terms of the GNU General Public License version 2 only, as8* published by the Free Software Foundation.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*24*/2526#ifndef CPU_AARCH32_VM_FRAME_AARCH32_INLINE_HPP27#define CPU_AARCH32_VM_FRAME_AARCH32_INLINE_HPP2829#include "code/codeCache.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 = nmethod::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 = nmethod::get_deopt_original_pc(this);82if (original_pc != NULL) {83_pc = original_pc;84assert(((nmethod*)_cb)->insts_contains(_pc), "original PC must be in nmethod");85_deopt_state = is_deoptimized;86} else {87_deopt_state = not_deoptimized;88}89}9091inline frame::frame(intptr_t* sp, intptr_t* fp) {92intptr_t a = intptr_t(sp);93intptr_t b = intptr_t(fp);94_sp = sp;95_unextended_sp = sp;96_fp = fp;97_pc = (address)(fp[0]);9899// Here's a sticky one. This constructor can be called via AsyncGetCallTrace100// when last_Java_sp is non-null but the pc fetched is junk. If we are truly101// unlucky the junk value could be to a zombied method and we'll die on the102// find_blob call. This is also why we can have no asserts on the validity103// of the pc we find here. AsyncGetCallTrace -> pd_get_top_frame_for_signal_handler104// -> pd_last_frame should use a specialized version of pd_last_frame which could105// call a specilaized frame constructor instead of this one.106// Then we could use the assert below. However this assert is of somewhat dubious107// value.108// assert(_pc != NULL, "no pc?");109110_cb = CodeCache::find_blob(_pc);111adjust_unextended_sp();112113address original_pc = nmethod::get_deopt_original_pc(this);114if (original_pc != NULL) {115_pc = original_pc;116_deopt_state = is_deoptimized;117} else {118_deopt_state = not_deoptimized;119}120}121122// Accessors123124inline bool frame::equal(frame other) const {125bool ret = sp() == other.sp()126&& unextended_sp() == other.unextended_sp()127&& fp() == other.fp()128&& pc() == other.pc();129assert(!ret || ret && cb() == other.cb() && _deopt_state == other._deopt_state, "inconsistent construction");130return ret;131}132133// Return unique id for this frame. The id must have a value where we can distinguish134// identity and younger/older relationship. NULL represents an invalid (incomparable)135// frame.136inline intptr_t* frame::id(void) const { return unextended_sp(); }137138// Relationals on frames based139// Return true if the frame is younger (more recent activation) than the frame represented by id140inline bool frame::is_younger(intptr_t* id) const { assert(this->id() != NULL && id != NULL, "NULL frame id");141return this->id() < id ; }142143// Return true if the frame is older (less recent activation) than the frame represented by id144inline bool frame::is_older(intptr_t* id) const { assert(this->id() != NULL && id != NULL, "NULL frame id");145return this->id() > id ; }146147148149inline intptr_t* frame::link() const { return (intptr_t*) *(intptr_t **)addr_at(link_offset); }150151152inline intptr_t* frame::unextended_sp() const { return _unextended_sp; }153154// Return address:155156inline address* frame::sender_pc_addr() const { return (address*) addr_at( return_addr_offset); }157inline address frame::sender_pc() const { return *sender_pc_addr(); }158159#ifdef CC_INTERP160161inline interpreterState frame::get_interpreterState() const {162return ((interpreterState)addr_at( -((int)sizeof(BytecodeInterpreter))/wordSize ));163}164165inline intptr_t* frame::sender_sp() const {166// Hmm this seems awfully expensive QQQ, is this really called with interpreted frames?167if (is_interpreted_frame()) {168assert(false, "should never happen");169return get_interpreterState()->sender_sp();170} else {171return addr_at(sender_sp_offset);172}173}174175inline intptr_t** frame::interpreter_frame_locals_addr() const {176assert(is_interpreted_frame(), "must be interpreted");177return &(get_interpreterState()->_locals);178}179180inline intptr_t* frame::interpreter_frame_bcx_addr() const {181assert(is_interpreted_frame(), "must be interpreted");182return (intptr_t*) &(get_interpreterState()->_bcp);183}184185186// Constant pool cache187188inline constantPoolCacheOop* frame::interpreter_frame_cache_addr() const {189assert(is_interpreted_frame(), "must be interpreted");190return &(get_interpreterState()->_constants);191}192193// Method194195inline methodOop* frame::interpreter_frame_method_addr() const {196assert(is_interpreted_frame(), "must be interpreted");197return &(get_interpreterState()->_method);198}199200inline intptr_t* frame::interpreter_frame_mdx_addr() const {201assert(is_interpreted_frame(), "must be interpreted");202return (intptr_t*) &(get_interpreterState()->_mdx);203}204205// top of expression stack206inline intptr_t* frame::interpreter_frame_tos_address() const {207assert(is_interpreted_frame(), "wrong frame type");208return get_interpreterState()->_stack + 1;209}210211#else /* asm interpreter */212inline intptr_t* frame::sender_sp() const { return addr_at(sender_sp_offset); }213214inline intptr_t** frame::interpreter_frame_locals_addr() const {215return (intptr_t**)addr_at(interpreter_frame_locals_offset);216}217218inline intptr_t* frame::interpreter_frame_last_sp() const {219return *(intptr_t**)addr_at(interpreter_frame_last_sp_offset);220}221222inline intptr_t* frame::interpreter_frame_bcx_addr() const {223return (intptr_t*) addr_at(interpreter_frame_bcx_offset);224}225226inline intptr_t* frame::interpreter_frame_mdx_addr() const {227return (intptr_t*) addr_at(interpreter_frame_mdx_offset);228}229230231// Constant pool cache232233inline ConstantPoolCache** frame::interpreter_frame_cache_addr() const {234return (ConstantPoolCache**)addr_at(interpreter_frame_cache_offset);235}236237// Method238239inline Method** frame::interpreter_frame_method_addr() const {240return (Method**)addr_at(interpreter_frame_method_offset);241}242243// top of expression stack244inline intptr_t* frame::interpreter_frame_tos_address() const {245intptr_t* last_sp = interpreter_frame_last_sp();246if (last_sp == NULL) {247return sp();248} else {249// sp() may have been extended or shrunk by an adapter. At least250// check that we don't fall behind the legal region.251// For top deoptimized frame last_sp == interpreter_frame_monitor_end.252assert(last_sp <= (intptr_t*) interpreter_frame_monitor_end(), "bad tos");253return last_sp;254}255}256257inline oop* frame::interpreter_frame_temp_oop_addr() const {258return (oop *)(fp() + interpreter_frame_oop_temp_offset);259}260261#endif /* CC_INTERP */262263inline int frame::pd_oop_map_offset_adjustment() const {264return 0;265}266267inline int frame::interpreter_frame_monitor_size() {268return BasicObjectLock::size();269}270271272// expression stack273// (the max_stack arguments are used by the GC; see class FrameClosure)274275inline intptr_t* frame::interpreter_frame_expression_stack() const {276intptr_t* monitor_end = (intptr_t*) interpreter_frame_monitor_end();277return monitor_end-1;278}279280281inline jint frame::interpreter_frame_expression_stack_direction() { return -1; }282283284// Entry frames285286inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const {287return (JavaCallWrapper**)addr_at(entry_frame_call_wrapper_offset);288}289290291// Compiled frames292293inline int frame::local_offset_for_compiler(int local_index, int nof_args, int max_nof_locals, int max_nof_monitors) {294return (nof_args - local_index + (local_index < nof_args ? 1: -1));295}296297inline int frame::monitor_offset_for_compiler(int local_index, int nof_args, int max_nof_locals, int max_nof_monitors) {298return local_offset_for_compiler(local_index, nof_args, max_nof_locals, max_nof_monitors);299}300301inline int frame::min_local_offset_for_compiler(int nof_args, int max_nof_locals, int max_nof_monitors) {302return (nof_args - (max_nof_locals + max_nof_monitors*2) - 1);303}304305inline bool frame::volatile_across_calls(Register reg) {306return true;307}308309310311inline oop frame::saved_oop_result(RegisterMap* map) const {312oop* result_adr = (oop *)map->location(r0->as_VMReg());313guarantee(result_adr != NULL, "bad register save location");314315return (*result_adr);316}317318inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {319oop* result_adr = (oop *)map->location(r0->as_VMReg());320guarantee(result_adr != NULL, "bad register save location");321322*result_adr = obj;323}324325#endif // CPU_AARCH32_VM_FRAME_AARCH32_INLINE_HPP326327328