Path: blob/master/src/hotspot/cpu/ppc/frame_ppc.inline.hpp
40930 views
/*1* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.2* Copyright (c) 2012, 2015 SAP SE. 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_PPC_FRAME_PPC_INLINE_HPP26#define CPU_PPC_FRAME_PPC_INLINE_HPP2728#include "code/codeCache.hpp"29#include "code/vmreg.inline.hpp"30#include "utilities/align.hpp"3132// Inline functions for ppc64 frames:3334// Find codeblob and set deopt_state.35inline void frame::find_codeblob_and_set_pc_and_deopt_state(address pc) {36assert(pc != NULL, "precondition: must have PC");3738_cb = CodeCache::find_blob(pc);39_pc = pc; // Must be set for get_deopt_original_pc()4041_fp = (intptr_t*)own_abi()->callers_sp;4243address original_pc = CompiledMethod::get_deopt_original_pc(this);44if (original_pc != NULL) {45_pc = original_pc;46_deopt_state = is_deoptimized;47} else {48_deopt_state = not_deoptimized;49}5051assert(((uint64_t)_sp & 0xf) == 0, "SP must be 16-byte aligned");52}5354// Constructors5556// Initialize all fields, _unextended_sp will be adjusted in find_codeblob_and_set_pc_and_deopt_state.57inline frame::frame() : _sp(NULL), _pc(NULL), _cb(NULL), _deopt_state(unknown), _unextended_sp(NULL), _fp(NULL) {}5859inline frame::frame(intptr_t* sp) : _sp(sp), _unextended_sp(sp) {60find_codeblob_and_set_pc_and_deopt_state((address)own_abi()->lr); // also sets _fp and adjusts _unextended_sp61}6263inline frame::frame(intptr_t* sp, address pc) : _sp(sp), _unextended_sp(sp) {64find_codeblob_and_set_pc_and_deopt_state(pc); // also sets _fp and adjusts _unextended_sp65}6667inline frame::frame(intptr_t* sp, address pc, intptr_t* unextended_sp) : _sp(sp), _unextended_sp(unextended_sp) {68find_codeblob_and_set_pc_and_deopt_state(pc); // also sets _fp and adjusts _unextended_sp69}7071// Accessors7273// Return unique id for this frame. The id must have a value where we74// can distinguish identity and younger/older relationship. NULL75// represents an invalid (incomparable) frame.76inline intptr_t* frame::id(void) const {77// Use _fp. _sp or _unextended_sp wouldn't be correct due to resizing.78return _fp;79}8081// Return true if this frame is older (less recent activation) than82// the frame represented by id.83inline bool frame::is_older(intptr_t* id) const {84assert(this->id() != NULL && id != NULL, "NULL frame id");85// Stack grows towards smaller addresses on ppc64.86return this->id() > id;87}8889inline int frame::frame_size(RegisterMap* map) const {90// Stack grows towards smaller addresses on PPC64: sender is at a higher address.91return sender_sp() - sp();92}9394// Return the frame's stack pointer before it has been extended by a95// c2i adapter. This is needed by deoptimization for ignoring c2i adapter96// frames.97inline intptr_t* frame::unextended_sp() const {98return _unextended_sp;99}100101// All frames have this field.102inline address frame::sender_pc() const {103return (address)callers_abi()->lr;104}105inline address* frame::sender_pc_addr() const {106return (address*)&(callers_abi()->lr);107}108109// All frames have this field.110inline intptr_t* frame::sender_sp() const {111return (intptr_t*)callers_abi();112}113114// All frames have this field.115inline intptr_t* frame::link() const {116return (intptr_t*)callers_abi()->callers_sp;117}118119inline intptr_t* frame::real_fp() const {120return fp();121}122123// Template Interpreter frame value accessors.124125inline frame::ijava_state* frame::get_ijava_state() const {126return (ijava_state*) ((uintptr_t)fp() - ijava_state_size);127}128129inline intptr_t** frame::interpreter_frame_locals_addr() const {130return (intptr_t**) &(get_ijava_state()->locals);131}132133inline intptr_t* frame::interpreter_frame_bcp_addr() const {134return (intptr_t*) &(get_ijava_state()->bcp);135}136137inline intptr_t* frame::interpreter_frame_mdp_addr() const {138return (intptr_t*) &(get_ijava_state()->mdx);139}140141// Pointer beyond the "oldest/deepest" BasicObjectLock on stack.142inline BasicObjectLock* frame::interpreter_frame_monitor_end() const {143return (BasicObjectLock*) get_ijava_state()->monitors;144}145146inline BasicObjectLock* frame::interpreter_frame_monitor_begin() const {147return (BasicObjectLock*) get_ijava_state();148}149150// Return register stack slot addr at which currently interpreted method is found.151inline Method** frame::interpreter_frame_method_addr() const {152return (Method**) &(get_ijava_state()->method);153}154155inline oop* frame::interpreter_frame_mirror_addr() const {156return (oop*) &(get_ijava_state()->mirror);157}158159inline ConstantPoolCache** frame::interpreter_frame_cache_addr() const {160return (ConstantPoolCache**) &(get_ijava_state()->cpoolCache);161}162163inline oop* frame::interpreter_frame_temp_oop_addr() const {164return (oop*) &(get_ijava_state()->oop_tmp);165}166167inline intptr_t* frame::interpreter_frame_esp() const {168return (intptr_t*) get_ijava_state()->esp;169}170171// Convenient setters172inline void frame::interpreter_frame_set_monitor_end(BasicObjectLock* end) { get_ijava_state()->monitors = (intptr_t) end;}173inline void frame::interpreter_frame_set_cpcache(ConstantPoolCache* cp) { *interpreter_frame_cache_addr() = cp; }174inline void frame::interpreter_frame_set_esp(intptr_t* esp) { get_ijava_state()->esp = (intptr_t) esp; }175inline void frame::interpreter_frame_set_top_frame_sp(intptr_t* top_frame_sp) { get_ijava_state()->top_frame_sp = (intptr_t) top_frame_sp; }176inline void frame::interpreter_frame_set_sender_sp(intptr_t* sender_sp) { get_ijava_state()->sender_sp = (intptr_t) sender_sp; }177178inline intptr_t* frame::interpreter_frame_expression_stack() const {179return (intptr_t*)interpreter_frame_monitor_end() - 1;180}181182// top of expression stack183inline intptr_t* frame::interpreter_frame_tos_address() const {184return ((intptr_t*) get_ijava_state()->esp) + Interpreter::stackElementWords;185}186187inline intptr_t* frame::interpreter_frame_tos_at(jint offset) const {188return &interpreter_frame_tos_address()[offset];189}190191inline int frame::interpreter_frame_monitor_size() {192// Number of stack slots for a monitor.193return align_up(BasicObjectLock::size(), // number of stack slots194WordsPerLong); // number of stack slots for a Java long195}196197inline int frame::interpreter_frame_monitor_size_in_bytes() {198return frame::interpreter_frame_monitor_size() * wordSize;199}200201// entry frames202203inline intptr_t* frame::entry_frame_argument_at(int offset) const {204// Since an entry frame always calls the interpreter first, the205// parameters are on the stack and relative to known register in the206// entry frame.207intptr_t* tos = (intptr_t*)get_entry_frame_locals()->arguments_tos_address;208return &tos[offset + 1]; // prepushed tos209}210211inline JavaCallWrapper** frame::entry_frame_call_wrapper_addr() const {212return (JavaCallWrapper**)&get_entry_frame_locals()->call_wrapper_address;213}214215inline oop frame::saved_oop_result(RegisterMap* map) const {216return *((oop*)map->location(R3->as_VMReg()));217}218219inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {220*((oop*)map->location(R3->as_VMReg())) = obj;221}222223#endif // CPU_PPC_FRAME_PPC_INLINE_HPP224225226