Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/aarch32/vm/frame_aarch32.hpp
32285 views
1
/*
2
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
4
* Copyright (c) 2015, Linaro Ltd. All rights reserved.
5
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6
*
7
* This code is free software; you can redistribute it and/or modify it
8
* under the terms of the GNU General Public License version 2 only, as
9
* published by the Free Software Foundation.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*
25
*/
26
27
#ifndef CPU_AARCH32_VM_FRAME_AARCH32_HPP
28
#define CPU_AARCH32_VM_FRAME_AARCH32_HPP
29
30
#include "runtime/synchronizer.hpp"
31
#include "utilities/top.hpp"
32
33
// A frame represents a physical stack frame (an activation). Frames can be
34
// C or Java frames, and the Java frames can be interpreted or compiled.
35
// In contrast, vframes represent source-level activations, so that one physical frame
36
// can correspond to multiple source level frames because of inlining.
37
// A frame is comprised of {pc, fp, sp}
38
// ------------------------------ Asm interpreter ----------------------------------------
39
// Layout of asm interpreter frame:
40
// [expression stack ] * <- sp
41
42
// [monitors[0] ] \
43
// ... | monitor block size = k
44
// [monitors[k-1] ] /
45
// [frame initial esp ] ( == &monitors[0], initially here) initial_sp_offset
46
// [byte code index/pointr] = bcx() bcx_offset
47
48
// [pointer to locals ] = locals() locals_offset
49
// [constant pool cache ] = cache() cache_offset
50
51
// [methodData ] = mdp() mdx_offset
52
// [methodOop ] = method() method_offset
53
54
// [last esp ] = last_sp() last_sp_offset
55
// [old stack pointer ] (sender_sp) sender_sp_offset
56
57
// [old frame pointer ] = link()
58
// [return pc ] <- fp
59
60
// [last sp ]
61
// [oop temp ] (only for native calls)
62
63
// [locals and parameters ]
64
// <- sender sp
65
// ------------------------------ Asm interpreter ----------------------------------------
66
67
// ------------------------------ C++ interpreter ----------------------------------------
68
//
69
// Layout of C++ interpreter frame: (While executing in BytecodeInterpreter::run)
70
//
71
// <- SP (current sp)
72
// [local variables ] BytecodeInterpreter::run local variables
73
// ... BytecodeInterpreter::run local variables
74
// [local variables ] BytecodeInterpreter::run local variables
75
// [old frame pointer ] fp [ BytecodeInterpreter::run's ebp/rbp ]
76
// [return pc ] (return to frame manager)
77
// [interpreter_state* ] (arg to BytecodeInterpreter::run) --------------
78
// [expression stack ] <- last_Java_sp |
79
// [... ] * <- interpreter_state.stack |
80
// [expression stack ] * <- interpreter_state.stack_base |
81
// [monitors ] \ |
82
// ... | monitor block size |
83
// [monitors ] / <- interpreter_state.monitor_base |
84
// [struct interpretState ] <-----------------------------------------|
85
// [return pc ] (return to callee of frame manager [1]
86
// [locals and parameters ]
87
// <- sender sp
88
89
// [1] When the c++ interpreter calls a new method it returns to the frame
90
// manager which allocates a new frame on the stack. In that case there
91
// is no real callee of this newly allocated frame. The frame manager is
92
// aware of the additional frame(s) and will pop them as nested calls
93
// complete. Howevers tTo make it look good in the debugger the frame
94
// manager actually installs a dummy pc pointing to RecursiveInterpreterActivation
95
// with a fake interpreter_state* parameter to make it easy to debug
96
// nested calls.
97
98
// Note that contrary to the layout for the assembly interpreter the
99
// expression stack allocated for the C++ interpreter is full sized.
100
// However this is not as bad as it seems as the interpreter frame_manager
101
// will truncate the unused space on succesive method calls.
102
//
103
// ------------------------------ C++ interpreter ----------------------------------------
104
105
public:
106
enum {
107
pc_return_offset = 0,
108
// All frames
109
link_offset = -1,
110
return_addr_offset = 0,
111
sender_sp_offset = 1,
112
113
#ifndef CC_INTERP
114
115
// Interpreter frames
116
interpreter_frame_oop_temp_offset = 2, // for native calls only
117
118
interpreter_frame_sender_sp_offset = -2,
119
// outgoing sp before a call to an invoked method
120
interpreter_frame_last_sp_offset = interpreter_frame_sender_sp_offset - 1,
121
interpreter_frame_method_offset = interpreter_frame_last_sp_offset - 1,
122
interpreter_frame_mdx_offset = interpreter_frame_method_offset - 1,
123
interpreter_frame_cache_offset = interpreter_frame_mdx_offset - 1,
124
interpreter_frame_locals_offset = interpreter_frame_cache_offset - 1,
125
interpreter_frame_bcx_offset = interpreter_frame_locals_offset - 1,
126
interpreter_frame_initial_sp_offset = interpreter_frame_bcx_offset - 1,
127
128
interpreter_frame_monitor_block_top_offset = interpreter_frame_initial_sp_offset,
129
interpreter_frame_monitor_block_bottom_offset = interpreter_frame_initial_sp_offset,
130
131
#endif // CC_INTERP
132
133
// Entry frames
134
// n.b. these values are determined by the layout defined in
135
// stubGenerator for the Java call stub
136
entry_frame_after_call_words = 12+(StackAlignmentInBytes/BytesPerWord),
137
entry_frame_call_wrapper_offset = -12,
138
139
// we don't need a save area
140
arg_reg_save_area_bytes = 0,
141
142
// This is the offset from the rfp beyond the space taken up by
143
// frame variables
144
offset_from_rfp_bytes = 4
145
146
};
147
148
intptr_t ptr_at(int offset) const {
149
return *ptr_at_addr(offset);
150
}
151
152
void ptr_at_put(int offset, intptr_t value) {
153
*ptr_at_addr(offset) = value;
154
}
155
156
private:
157
// an additional field beyond _sp and _pc:
158
intptr_t* _fp; // frame pointer
159
// The interpreter and adapters will extend the frame of the caller.
160
// Since oopMaps are based on the sp of the caller before extension
161
// we need to know that value. However in order to compute the address
162
// of the return address we need the real "raw" sp. Since sparc already
163
// uses sp() to mean "raw" sp and unextended_sp() to mean the caller's
164
// original sp we use that convention.
165
166
intptr_t* _unextended_sp;
167
void adjust_unextended_sp();
168
169
intptr_t* ptr_at_addr(int offset) const {
170
return (intptr_t*) addr_at(offset);
171
}
172
173
#ifdef ASSERT
174
// Used in frame::sender_for_{interpreter,compiled}_frame
175
static void verify_deopt_original_pc( nmethod* nm, intptr_t* unextended_sp);
176
#endif
177
178
public:
179
// Constructors
180
181
frame(intptr_t* sp, intptr_t* fp, address pc);
182
183
frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc);
184
185
frame(intptr_t* sp, intptr_t* fp);
186
187
void init(intptr_t* sp, intptr_t* fp, address pc);
188
189
// accessors for the instance variables
190
// Note: not necessarily the real 'frame pointer' (see real_fp)
191
intptr_t* fp() const { return _fp; }
192
193
inline address* sender_pc_addr() const;
194
195
// expression stack tos if we are nested in a java call
196
intptr_t* interpreter_frame_last_sp() const;
197
198
// helper to update a map with callee-saved RBP
199
static void update_map_with_saved_link(RegisterMap* map, intptr_t** link_addr);
200
201
#ifndef CC_INTERP
202
// deoptimization support
203
void interpreter_frame_set_last_sp(intptr_t* sp);
204
#endif // CC_INTERP
205
206
#ifdef CC_INTERP
207
inline interpreterState get_interpreterState() const;
208
#endif // CC_INTERP
209
210
#endif // CPU_AARCH32_VM_FRAME_AARCH32_HPP
211
212