Path: blob/master/src/hotspot/cpu/aarch64/frame_aarch64.hpp
40930 views
/*1* Copyright (c) 1997, 2020, 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_HPP26#define CPU_AARCH64_FRAME_AARCH64_HPP2728#include "runtime/synchronizer.hpp"2930// A frame represents a physical stack frame (an activation). Frames can be31// C or Java frames, and the Java frames can be interpreted or compiled.32// In contrast, vframes represent source-level activations, so that one physical frame33// can correspond to multiple source level frames because of inlining.34// A frame is comprised of {pc, fp, sp}35// ------------------------------ Asm interpreter ----------------------------------------36// Layout of asm interpreter frame:37// [expression stack ] * <- sp3839// [monitors[0] ] \40// ... | monitor block size = k41// [monitors[k-1] ] /42// [frame initial esp ] ( == &monitors[0], initially here) initial_sp_offset43// [byte code index/pointr] = bcx() bcx_offset4445// [pointer to locals ] = locals() locals_offset46// [constant pool cache ] = cache() cache_offset4748// [klass of method ] = mirror() mirror_offset49// [padding ]5051// [methodData ] = mdp() mdx_offset52// [Method ] = method() method_offset5354// [last esp ] = last_sp() last_sp_offset55// [old stack pointer ] (sender_sp) sender_sp_offset5657// [old frame pointer ] <- fp = link()58// [return pc ]5960// [last sp ]61// [oop temp ] (only for native calls)6263// [padding ] (to preserve machine SP alignment)64// [locals and parameters ]65// <- sender sp66// ------------------------------ Asm interpreter ----------------------------------------6768public:69enum {70pc_return_offset = 0,71// All frames72link_offset = 0,73return_addr_offset = 1,74sender_sp_offset = 2,7576// Interpreter frames77interpreter_frame_oop_temp_offset = 3, // for native calls only7879interpreter_frame_sender_sp_offset = -1,80// outgoing sp before a call to an invoked method81interpreter_frame_last_sp_offset = interpreter_frame_sender_sp_offset - 1,82interpreter_frame_method_offset = interpreter_frame_last_sp_offset - 1,83interpreter_frame_mdp_offset = interpreter_frame_method_offset - 1,84interpreter_frame_padding_offset = interpreter_frame_mdp_offset - 1,85interpreter_frame_mirror_offset = interpreter_frame_padding_offset - 1,86interpreter_frame_cache_offset = interpreter_frame_mirror_offset - 1,87interpreter_frame_locals_offset = interpreter_frame_cache_offset - 1,88interpreter_frame_bcp_offset = interpreter_frame_locals_offset - 1,89interpreter_frame_initial_sp_offset = interpreter_frame_bcp_offset - 1,9091interpreter_frame_monitor_block_top_offset = interpreter_frame_initial_sp_offset,92interpreter_frame_monitor_block_bottom_offset = interpreter_frame_initial_sp_offset,9394// Entry frames95// n.b. these values are determined by the layout defined in96// stubGenerator for the Java call stub97entry_frame_after_call_words = 27,98entry_frame_call_wrapper_offset = -8,99100// we don't need a save area101arg_reg_save_area_bytes = 0102103};104105intptr_t ptr_at(int offset) const {106return *ptr_at_addr(offset);107}108109void ptr_at_put(int offset, intptr_t value) {110*ptr_at_addr(offset) = value;111}112113private:114// an additional field beyond _sp and _pc:115intptr_t* _fp; // frame pointer116// The interpreter and adapters will extend the frame of the caller.117// Since oopMaps are based on the sp of the caller before extension118// we need to know that value. However in order to compute the address119// of the return address we need the real "raw" sp. Since sparc already120// uses sp() to mean "raw" sp and unextended_sp() to mean the caller's121// original sp we use that convention.122123intptr_t* _unextended_sp;124void adjust_unextended_sp();125126intptr_t* ptr_at_addr(int offset) const {127return (intptr_t*) addr_at(offset);128}129130#ifdef ASSERT131// Used in frame::sender_for_{interpreter,compiled}_frame132static void verify_deopt_original_pc( CompiledMethod* nm, intptr_t* unextended_sp);133#endif134135public:136// Constructors137138frame(intptr_t* sp, intptr_t* fp, address pc);139140frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc);141142frame(intptr_t* sp, intptr_t* fp);143144void init(intptr_t* sp, intptr_t* fp, address pc);145146// accessors for the instance variables147// Note: not necessarily the real 'frame pointer' (see real_fp)148intptr_t* fp() const { return _fp; }149150inline address* sender_pc_addr() const;151152// expression stack tos if we are nested in a java call153intptr_t* interpreter_frame_last_sp() const;154155// helper to update a map with callee-saved RBP156static void update_map_with_saved_link(RegisterMap* map, intptr_t** link_addr);157158// deoptimization support159void interpreter_frame_set_last_sp(intptr_t* sp);160161static jint interpreter_frame_expression_stack_direction() { return -1; }162163// returns the sending frame, without applying any barriers164frame sender_raw(RegisterMap* map) const;165166#endif // CPU_AARCH64_FRAME_AARCH64_HPP167168169