Tue, 17 Oct 2017 12:58:25 +0800
merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * Copyright 2012, 2014 SAP AG. All rights reserved. |
aoqi@0 | 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 5 | * |
aoqi@0 | 6 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 7 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 8 | * published by the Free Software Foundation. |
aoqi@0 | 9 | * |
aoqi@0 | 10 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 13 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 14 | * accompanied this code). |
aoqi@0 | 15 | * |
aoqi@0 | 16 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 17 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 19 | * |
aoqi@0 | 20 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 21 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 22 | * questions. |
aoqi@0 | 23 | * |
aoqi@0 | 24 | */ |
aoqi@0 | 25 | |
aoqi@0 | 26 | #ifndef CPU_PPC_VM_FRAME_PPC_HPP |
aoqi@0 | 27 | #define CPU_PPC_VM_FRAME_PPC_HPP |
aoqi@0 | 28 | |
aoqi@0 | 29 | #include "runtime/synchronizer.hpp" |
aoqi@0 | 30 | #include "utilities/top.hpp" |
aoqi@0 | 31 | |
aoqi@0 | 32 | // C frame layout on PPC-64. |
aoqi@0 | 33 | // |
aoqi@0 | 34 | // In this figure the stack grows upwards, while memory grows |
aoqi@0 | 35 | // downwards. See "64-bit PowerPC ELF ABI Supplement Version 1.7", |
aoqi@0 | 36 | // IBM Corp. (2003-10-29) |
aoqi@0 | 37 | // (http://math-atlas.sourceforge.net/devel/assembly/PPC-elf64abi-1.7.pdf). |
aoqi@0 | 38 | // |
aoqi@0 | 39 | // Square brackets denote stack regions possibly larger |
aoqi@0 | 40 | // than a single 64 bit slot. |
aoqi@0 | 41 | // |
aoqi@0 | 42 | // STACK: |
aoqi@0 | 43 | // 0 [C_FRAME] <-- SP after prolog (mod 16 = 0) |
aoqi@0 | 44 | // [C_FRAME] <-- SP before prolog |
aoqi@0 | 45 | // ... |
aoqi@0 | 46 | // [C_FRAME] |
aoqi@0 | 47 | // |
aoqi@0 | 48 | // C_FRAME: |
aoqi@0 | 49 | // 0 [ABI_REG_ARGS] |
aoqi@0 | 50 | // 112 CARG_9: outgoing arg 9 (arg_1 ... arg_8 via gpr_3 ... gpr_{10}) |
aoqi@0 | 51 | // ... |
aoqi@0 | 52 | // 40+M*8 CARG_M: outgoing arg M (M is the maximum of outgoing args taken over all call sites in the procedure) |
aoqi@0 | 53 | // local 1 |
aoqi@0 | 54 | // ... |
aoqi@0 | 55 | // local N |
aoqi@0 | 56 | // spill slot for vector reg (16 bytes aligned) |
aoqi@0 | 57 | // ... |
aoqi@0 | 58 | // spill slot for vector reg |
aoqi@0 | 59 | // alignment (4 or 12 bytes) |
aoqi@0 | 60 | // V SR_VRSAVE |
aoqi@0 | 61 | // V+4 spill slot for GR |
aoqi@0 | 62 | // ... ... |
aoqi@0 | 63 | // spill slot for GR |
aoqi@0 | 64 | // spill slot for FR |
aoqi@0 | 65 | // ... |
aoqi@0 | 66 | // spill slot for FR |
aoqi@0 | 67 | // |
aoqi@0 | 68 | // ABI_48: |
aoqi@0 | 69 | // 0 caller's SP |
aoqi@0 | 70 | // 8 space for condition register (CR) for next call |
aoqi@0 | 71 | // 16 space for link register (LR) for next call |
aoqi@0 | 72 | // 24 reserved |
aoqi@0 | 73 | // 32 reserved |
aoqi@0 | 74 | // 40 space for TOC (=R2) register for next call |
aoqi@0 | 75 | // |
aoqi@0 | 76 | // ABI_REG_ARGS: |
aoqi@0 | 77 | // 0 [ABI_48] |
aoqi@0 | 78 | // 48 CARG_1: spill slot for outgoing arg 1. used by next callee. |
aoqi@0 | 79 | // ... ... |
aoqi@0 | 80 | // 104 CARG_8: spill slot for outgoing arg 8. used by next callee. |
aoqi@0 | 81 | // |
aoqi@0 | 82 | |
aoqi@0 | 83 | public: |
aoqi@0 | 84 | |
aoqi@0 | 85 | // C frame layout |
aoqi@0 | 86 | |
aoqi@0 | 87 | enum { |
aoqi@0 | 88 | // stack alignment |
aoqi@0 | 89 | alignment_in_bytes = 16, |
aoqi@0 | 90 | // log_2(16*8 bits) = 7. |
aoqi@0 | 91 | log_2_of_alignment_in_bits = 7 |
aoqi@0 | 92 | }; |
aoqi@0 | 93 | |
aoqi@0 | 94 | // ABI_MINFRAME: |
aoqi@0 | 95 | struct abi_minframe { |
aoqi@0 | 96 | uint64_t callers_sp; |
aoqi@0 | 97 | uint64_t cr; //_16 |
aoqi@0 | 98 | uint64_t lr; |
aoqi@0 | 99 | #if !defined(ABI_ELFv2) |
aoqi@0 | 100 | uint64_t reserved1; //_16 |
aoqi@0 | 101 | uint64_t reserved2; |
aoqi@0 | 102 | #endif |
aoqi@0 | 103 | uint64_t toc; //_16 |
aoqi@0 | 104 | // nothing to add here! |
aoqi@0 | 105 | // aligned to frame::alignment_in_bytes (16) |
aoqi@0 | 106 | }; |
aoqi@0 | 107 | |
aoqi@0 | 108 | enum { |
aoqi@0 | 109 | abi_minframe_size = sizeof(abi_minframe) |
aoqi@0 | 110 | }; |
aoqi@0 | 111 | |
aoqi@0 | 112 | struct abi_reg_args : abi_minframe { |
aoqi@0 | 113 | uint64_t carg_1; |
aoqi@0 | 114 | uint64_t carg_2; //_16 |
aoqi@0 | 115 | uint64_t carg_3; |
aoqi@0 | 116 | uint64_t carg_4; //_16 |
aoqi@0 | 117 | uint64_t carg_5; |
aoqi@0 | 118 | uint64_t carg_6; //_16 |
aoqi@0 | 119 | uint64_t carg_7; |
aoqi@0 | 120 | uint64_t carg_8; //_16 |
aoqi@0 | 121 | // aligned to frame::alignment_in_bytes (16) |
aoqi@0 | 122 | }; |
aoqi@0 | 123 | |
aoqi@0 | 124 | enum { |
aoqi@0 | 125 | abi_reg_args_size = sizeof(abi_reg_args) |
aoqi@0 | 126 | }; |
aoqi@0 | 127 | |
aoqi@0 | 128 | #define _abi(_component) \ |
aoqi@0 | 129 | (offset_of(frame::abi_reg_args, _component)) |
aoqi@0 | 130 | |
aoqi@0 | 131 | struct abi_reg_args_spill : abi_reg_args { |
aoqi@0 | 132 | // additional spill slots |
aoqi@0 | 133 | uint64_t spill_ret; |
aoqi@0 | 134 | uint64_t spill_fret; //_16 |
aoqi@0 | 135 | // aligned to frame::alignment_in_bytes (16) |
aoqi@0 | 136 | }; |
aoqi@0 | 137 | |
aoqi@0 | 138 | enum { |
aoqi@0 | 139 | abi_reg_args_spill_size = sizeof(abi_reg_args_spill) |
aoqi@0 | 140 | }; |
aoqi@0 | 141 | |
aoqi@0 | 142 | #define _abi_reg_args_spill(_component) \ |
aoqi@0 | 143 | (offset_of(frame::abi_reg_args_spill, _component)) |
aoqi@0 | 144 | |
aoqi@0 | 145 | // non-volatile GPRs: |
aoqi@0 | 146 | |
aoqi@0 | 147 | struct spill_nonvolatiles { |
aoqi@0 | 148 | uint64_t r14; |
aoqi@0 | 149 | uint64_t r15; //_16 |
aoqi@0 | 150 | uint64_t r16; |
aoqi@0 | 151 | uint64_t r17; //_16 |
aoqi@0 | 152 | uint64_t r18; |
aoqi@0 | 153 | uint64_t r19; //_16 |
aoqi@0 | 154 | uint64_t r20; |
aoqi@0 | 155 | uint64_t r21; //_16 |
aoqi@0 | 156 | uint64_t r22; |
aoqi@0 | 157 | uint64_t r23; //_16 |
aoqi@0 | 158 | uint64_t r24; |
aoqi@0 | 159 | uint64_t r25; //_16 |
aoqi@0 | 160 | uint64_t r26; |
aoqi@0 | 161 | uint64_t r27; //_16 |
aoqi@0 | 162 | uint64_t r28; |
aoqi@0 | 163 | uint64_t r29; //_16 |
aoqi@0 | 164 | uint64_t r30; |
aoqi@0 | 165 | uint64_t r31; //_16 |
aoqi@0 | 166 | |
aoqi@0 | 167 | double f14; |
aoqi@0 | 168 | double f15; |
aoqi@0 | 169 | double f16; |
aoqi@0 | 170 | double f17; |
aoqi@0 | 171 | double f18; |
aoqi@0 | 172 | double f19; |
aoqi@0 | 173 | double f20; |
aoqi@0 | 174 | double f21; |
aoqi@0 | 175 | double f22; |
aoqi@0 | 176 | double f23; |
aoqi@0 | 177 | double f24; |
aoqi@0 | 178 | double f25; |
aoqi@0 | 179 | double f26; |
aoqi@0 | 180 | double f27; |
aoqi@0 | 181 | double f28; |
aoqi@0 | 182 | double f29; |
aoqi@0 | 183 | double f30; |
aoqi@0 | 184 | double f31; |
aoqi@0 | 185 | |
aoqi@0 | 186 | // aligned to frame::alignment_in_bytes (16) |
aoqi@0 | 187 | }; |
aoqi@0 | 188 | |
aoqi@0 | 189 | enum { |
aoqi@0 | 190 | spill_nonvolatiles_size = sizeof(spill_nonvolatiles) |
aoqi@0 | 191 | }; |
aoqi@0 | 192 | |
aoqi@0 | 193 | #define _spill_nonvolatiles_neg(_component) \ |
aoqi@0 | 194 | (int)(-frame::spill_nonvolatiles_size + offset_of(frame::spill_nonvolatiles, _component)) |
aoqi@0 | 195 | |
aoqi@0 | 196 | |
aoqi@0 | 197 | |
aoqi@0 | 198 | #ifndef CC_INTERP |
aoqi@0 | 199 | // Frame layout for the Java template interpreter on PPC64. |
aoqi@0 | 200 | // |
aoqi@0 | 201 | // Diffs to the CC_INTERP are marked with 'X'. |
aoqi@0 | 202 | // |
aoqi@0 | 203 | // TOP_IJAVA_FRAME: |
aoqi@0 | 204 | // |
aoqi@0 | 205 | // 0 [TOP_IJAVA_FRAME_ABI] |
aoqi@0 | 206 | // alignment (optional) |
aoqi@0 | 207 | // [operand stack] |
aoqi@0 | 208 | // [monitors] (optional) |
aoqi@0 | 209 | // X[IJAVA_STATE] |
aoqi@0 | 210 | // note: own locals are located in the caller frame. |
aoqi@0 | 211 | // |
aoqi@0 | 212 | // PARENT_IJAVA_FRAME: |
aoqi@0 | 213 | // |
aoqi@0 | 214 | // 0 [PARENT_IJAVA_FRAME_ABI] |
aoqi@0 | 215 | // alignment (optional) |
aoqi@0 | 216 | // [callee's Java result] |
aoqi@0 | 217 | // [callee's locals w/o arguments] |
aoqi@0 | 218 | // [outgoing arguments] |
aoqi@0 | 219 | // [used part of operand stack w/o arguments] |
aoqi@0 | 220 | // [monitors] (optional) |
aoqi@0 | 221 | // X[IJAVA_STATE] |
aoqi@0 | 222 | // |
aoqi@0 | 223 | |
aoqi@0 | 224 | struct parent_ijava_frame_abi : abi_minframe { |
aoqi@0 | 225 | }; |
aoqi@0 | 226 | |
aoqi@0 | 227 | enum { |
aoqi@0 | 228 | parent_ijava_frame_abi_size = sizeof(parent_ijava_frame_abi) |
aoqi@0 | 229 | }; |
aoqi@0 | 230 | |
aoqi@0 | 231 | #define _parent_ijava_frame_abi(_component) \ |
aoqi@0 | 232 | (offset_of(frame::parent_ijava_frame_abi, _component)) |
aoqi@0 | 233 | |
aoqi@0 | 234 | struct top_ijava_frame_abi : abi_reg_args { |
aoqi@0 | 235 | }; |
aoqi@0 | 236 | |
aoqi@0 | 237 | enum { |
aoqi@0 | 238 | top_ijava_frame_abi_size = sizeof(top_ijava_frame_abi) |
aoqi@0 | 239 | }; |
aoqi@0 | 240 | |
aoqi@0 | 241 | #define _top_ijava_frame_abi(_component) \ |
aoqi@0 | 242 | (offset_of(frame::top_ijava_frame_abi, _component)) |
aoqi@0 | 243 | |
aoqi@0 | 244 | struct ijava_state { |
aoqi@0 | 245 | #ifdef ASSERT |
aoqi@0 | 246 | uint64_t ijava_reserved; // Used for assertion. |
aoqi@0 | 247 | uint64_t ijava_reserved2; // Inserted for alignment. |
aoqi@0 | 248 | #endif |
aoqi@0 | 249 | uint64_t method; |
aoqi@0 | 250 | uint64_t locals; |
aoqi@0 | 251 | uint64_t monitors; |
aoqi@0 | 252 | uint64_t cpoolCache; |
aoqi@0 | 253 | uint64_t bcp; |
aoqi@0 | 254 | uint64_t esp; |
aoqi@0 | 255 | uint64_t mdx; |
aoqi@0 | 256 | uint64_t top_frame_sp; // Maybe define parent_frame_abi and move there. |
aoqi@0 | 257 | uint64_t sender_sp; |
aoqi@0 | 258 | // Slots only needed for native calls. Maybe better to move elsewhere. |
aoqi@0 | 259 | uint64_t oop_tmp; |
aoqi@0 | 260 | uint64_t lresult; |
aoqi@0 | 261 | uint64_t fresult; |
aoqi@0 | 262 | // Aligned to frame::alignment_in_bytes (16). |
aoqi@0 | 263 | }; |
aoqi@0 | 264 | |
aoqi@0 | 265 | enum { |
aoqi@0 | 266 | ijava_state_size = sizeof(ijava_state) |
aoqi@0 | 267 | }; |
aoqi@0 | 268 | |
aoqi@0 | 269 | #define _ijava_state_neg(_component) \ |
aoqi@0 | 270 | (int) (-frame::ijava_state_size + offset_of(frame::ijava_state, _component)) |
aoqi@0 | 271 | |
aoqi@0 | 272 | #else // CC_INTERP: |
aoqi@0 | 273 | |
aoqi@0 | 274 | // Frame layout for the Java C++ interpreter on PPC64. |
aoqi@0 | 275 | // |
aoqi@0 | 276 | // This frame layout provides a C-like frame for every Java frame. |
aoqi@0 | 277 | // |
aoqi@0 | 278 | // In these figures the stack grows upwards, while memory grows |
aoqi@0 | 279 | // downwards. Square brackets denote regions possibly larger than |
aoqi@0 | 280 | // single 64 bit slots. |
aoqi@0 | 281 | // |
aoqi@0 | 282 | // STACK (no JNI, no compiled code, no library calls, |
aoqi@0 | 283 | // interpreter-loop is active): |
aoqi@0 | 284 | // 0 [InterpretMethod] |
aoqi@0 | 285 | // [TOP_IJAVA_FRAME] |
aoqi@0 | 286 | // [PARENT_IJAVA_FRAME] |
aoqi@0 | 287 | // ... |
aoqi@0 | 288 | // [PARENT_IJAVA_FRAME] |
aoqi@0 | 289 | // [ENTRY_FRAME] |
aoqi@0 | 290 | // [C_FRAME] |
aoqi@0 | 291 | // ... |
aoqi@0 | 292 | // [C_FRAME] |
aoqi@0 | 293 | // |
aoqi@0 | 294 | // TOP_IJAVA_FRAME: |
aoqi@0 | 295 | // 0 [TOP_IJAVA_FRAME_ABI] |
aoqi@0 | 296 | // alignment (optional) |
aoqi@0 | 297 | // [operand stack] |
aoqi@0 | 298 | // [monitors] (optional) |
aoqi@0 | 299 | // [cInterpreter object] |
aoqi@0 | 300 | // result, locals, and arguments are in parent frame! |
aoqi@0 | 301 | // |
aoqi@0 | 302 | // PARENT_IJAVA_FRAME: |
aoqi@0 | 303 | // 0 [PARENT_IJAVA_FRAME_ABI] |
aoqi@0 | 304 | // alignment (optional) |
aoqi@0 | 305 | // [callee's Java result] |
aoqi@0 | 306 | // [callee's locals w/o arguments] |
aoqi@0 | 307 | // [outgoing arguments] |
aoqi@0 | 308 | // [used part of operand stack w/o arguments] |
aoqi@0 | 309 | // [monitors] (optional) |
aoqi@0 | 310 | // [cInterpreter object] |
aoqi@0 | 311 | // |
aoqi@0 | 312 | // ENTRY_FRAME: |
aoqi@0 | 313 | // 0 [PARENT_IJAVA_FRAME_ABI] |
aoqi@0 | 314 | // alignment (optional) |
aoqi@0 | 315 | // [callee's Java result] |
aoqi@0 | 316 | // [callee's locals w/o arguments] |
aoqi@0 | 317 | // [outgoing arguments] |
aoqi@0 | 318 | // [ENTRY_FRAME_LOCALS] |
aoqi@0 | 319 | // |
aoqi@0 | 320 | // PARENT_IJAVA_FRAME_ABI: |
aoqi@0 | 321 | // 0 [ABI_MINFRAME] |
aoqi@0 | 322 | // top_frame_sp |
aoqi@0 | 323 | // initial_caller_sp |
aoqi@0 | 324 | // |
aoqi@0 | 325 | // TOP_IJAVA_FRAME_ABI: |
aoqi@0 | 326 | // 0 [PARENT_IJAVA_FRAME_ABI] |
aoqi@0 | 327 | // carg_3_unused |
aoqi@0 | 328 | // carg_4_unused |
aoqi@0 | 329 | // carg_5_unused |
aoqi@0 | 330 | // carg_6_unused |
aoqi@0 | 331 | // carg_7_unused |
aoqi@0 | 332 | // frame_manager_lr |
aoqi@0 | 333 | // |
aoqi@0 | 334 | |
aoqi@0 | 335 | // PARENT_IJAVA_FRAME_ABI |
aoqi@0 | 336 | |
aoqi@0 | 337 | struct parent_ijava_frame_abi : abi_minframe { |
aoqi@0 | 338 | // SOE registers. |
aoqi@0 | 339 | // C2i adapters spill their top-frame stack-pointer here. |
aoqi@0 | 340 | uint64_t top_frame_sp; // carg_1 |
aoqi@0 | 341 | // Sp of calling compiled frame before it was resized by the c2i |
aoqi@0 | 342 | // adapter or sp of call stub. Does not contain a valid value for |
aoqi@0 | 343 | // non-initial frames. |
aoqi@0 | 344 | uint64_t initial_caller_sp; // carg_2 |
aoqi@0 | 345 | // aligned to frame::alignment_in_bytes (16) |
aoqi@0 | 346 | }; |
aoqi@0 | 347 | |
aoqi@0 | 348 | enum { |
aoqi@0 | 349 | parent_ijava_frame_abi_size = sizeof(parent_ijava_frame_abi) |
aoqi@0 | 350 | }; |
aoqi@0 | 351 | |
aoqi@0 | 352 | #define _parent_ijava_frame_abi(_component) \ |
aoqi@0 | 353 | (offset_of(frame::parent_ijava_frame_abi, _component)) |
aoqi@0 | 354 | |
aoqi@0 | 355 | // TOP_IJAVA_FRAME_ABI |
aoqi@0 | 356 | |
aoqi@0 | 357 | struct top_ijava_frame_abi : parent_ijava_frame_abi { |
aoqi@0 | 358 | uint64_t carg_3_unused; // carg_3 |
aoqi@0 | 359 | uint64_t card_4_unused; //_16 carg_4 |
aoqi@0 | 360 | uint64_t carg_5_unused; // carg_5 |
aoqi@0 | 361 | uint64_t carg_6_unused; //_16 carg_6 |
aoqi@0 | 362 | uint64_t carg_7_unused; // carg_7 |
aoqi@0 | 363 | // Use arg8 for storing frame_manager_lr. The size of |
aoqi@0 | 364 | // top_ijava_frame_abi must match abi_reg_args. |
aoqi@0 | 365 | uint64_t frame_manager_lr; //_16 carg_8 |
aoqi@0 | 366 | // nothing to add here! |
aoqi@0 | 367 | // aligned to frame::alignment_in_bytes (16) |
aoqi@0 | 368 | }; |
aoqi@0 | 369 | |
aoqi@0 | 370 | enum { |
aoqi@0 | 371 | top_ijava_frame_abi_size = sizeof(top_ijava_frame_abi) |
aoqi@0 | 372 | }; |
aoqi@0 | 373 | |
aoqi@0 | 374 | #define _top_ijava_frame_abi(_component) \ |
aoqi@0 | 375 | (offset_of(frame::top_ijava_frame_abi, _component)) |
aoqi@0 | 376 | |
aoqi@0 | 377 | #endif // CC_INTERP |
aoqi@0 | 378 | |
aoqi@0 | 379 | // ENTRY_FRAME |
aoqi@0 | 380 | |
aoqi@0 | 381 | struct entry_frame_locals { |
aoqi@0 | 382 | uint64_t call_wrapper_address; |
aoqi@0 | 383 | uint64_t result_address; //_16 |
aoqi@0 | 384 | uint64_t result_type; |
aoqi@0 | 385 | uint64_t arguments_tos_address; //_16 |
aoqi@0 | 386 | // aligned to frame::alignment_in_bytes (16) |
aoqi@0 | 387 | uint64_t r[spill_nonvolatiles_size/sizeof(uint64_t)]; |
aoqi@0 | 388 | }; |
aoqi@0 | 389 | |
aoqi@0 | 390 | enum { |
aoqi@0 | 391 | entry_frame_locals_size = sizeof(entry_frame_locals) |
aoqi@0 | 392 | }; |
aoqi@0 | 393 | |
aoqi@0 | 394 | #define _entry_frame_locals_neg(_component) \ |
aoqi@0 | 395 | (int)(-frame::entry_frame_locals_size + offset_of(frame::entry_frame_locals, _component)) |
aoqi@0 | 396 | |
aoqi@0 | 397 | |
aoqi@0 | 398 | // Frame layout for JIT generated methods |
aoqi@0 | 399 | // |
aoqi@0 | 400 | // In these figures the stack grows upwards, while memory grows |
aoqi@0 | 401 | // downwards. Square brackets denote regions possibly larger than single |
aoqi@0 | 402 | // 64 bit slots. |
aoqi@0 | 403 | // |
aoqi@0 | 404 | // STACK (interpreted Java calls JIT generated Java): |
aoqi@0 | 405 | // [JIT_FRAME] <-- SP (mod 16 = 0) |
aoqi@0 | 406 | // [TOP_IJAVA_FRAME] |
aoqi@0 | 407 | // ... |
aoqi@0 | 408 | // |
aoqi@0 | 409 | // JIT_FRAME (is a C frame according to PPC-64 ABI): |
aoqi@0 | 410 | // [out_preserve] |
aoqi@0 | 411 | // [out_args] |
aoqi@0 | 412 | // [spills] |
aoqi@0 | 413 | // [pad_1] |
aoqi@0 | 414 | // [monitor] (optional) |
aoqi@0 | 415 | // ... |
aoqi@0 | 416 | // [monitor] (optional) |
aoqi@0 | 417 | // [pad_2] |
aoqi@0 | 418 | // [in_preserve] added / removed by prolog / epilog |
aoqi@0 | 419 | // |
aoqi@0 | 420 | |
aoqi@0 | 421 | // JIT_ABI (TOP and PARENT) |
aoqi@0 | 422 | |
aoqi@0 | 423 | struct jit_abi { |
aoqi@0 | 424 | uint64_t callers_sp; |
aoqi@0 | 425 | uint64_t cr; |
aoqi@0 | 426 | uint64_t lr; |
aoqi@0 | 427 | uint64_t toc; |
aoqi@0 | 428 | // Nothing to add here! |
aoqi@0 | 429 | // NOT ALIGNED to frame::alignment_in_bytes (16). |
aoqi@0 | 430 | }; |
aoqi@0 | 431 | |
aoqi@0 | 432 | struct jit_out_preserve : jit_abi { |
aoqi@0 | 433 | // Nothing to add here! |
aoqi@0 | 434 | }; |
aoqi@0 | 435 | |
aoqi@0 | 436 | struct jit_in_preserve { |
aoqi@0 | 437 | // Nothing to add here! |
aoqi@0 | 438 | }; |
aoqi@0 | 439 | |
aoqi@0 | 440 | enum { |
aoqi@0 | 441 | jit_out_preserve_size = sizeof(jit_out_preserve), |
aoqi@0 | 442 | jit_in_preserve_size = sizeof(jit_in_preserve) |
aoqi@0 | 443 | }; |
aoqi@0 | 444 | |
aoqi@0 | 445 | struct jit_monitor { |
aoqi@0 | 446 | uint64_t monitor[1]; |
aoqi@0 | 447 | }; |
aoqi@0 | 448 | |
aoqi@0 | 449 | enum { |
aoqi@0 | 450 | jit_monitor_size = sizeof(jit_monitor), |
aoqi@0 | 451 | }; |
aoqi@0 | 452 | |
aoqi@0 | 453 | private: |
aoqi@0 | 454 | |
aoqi@0 | 455 | // STACK: |
aoqi@0 | 456 | // ... |
aoqi@0 | 457 | // [THIS_FRAME] <-- this._sp (stack pointer for this frame) |
aoqi@0 | 458 | // [CALLER_FRAME] <-- this.fp() (_sp of caller's frame) |
aoqi@0 | 459 | // ... |
aoqi@0 | 460 | // |
aoqi@0 | 461 | |
aoqi@0 | 462 | // frame pointer for this frame |
aoqi@0 | 463 | intptr_t* _fp; |
aoqi@0 | 464 | |
aoqi@0 | 465 | // The frame's stack pointer before it has been extended by a c2i adapter; |
aoqi@0 | 466 | // needed by deoptimization |
aoqi@0 | 467 | intptr_t* _unextended_sp; |
aoqi@0 | 468 | void adjust_unextended_sp(); |
aoqi@0 | 469 | |
aoqi@0 | 470 | public: |
aoqi@0 | 471 | |
aoqi@0 | 472 | // Accessors for fields |
aoqi@0 | 473 | intptr_t* fp() const { return _fp; } |
aoqi@0 | 474 | |
aoqi@0 | 475 | // Accessors for ABIs |
aoqi@0 | 476 | inline abi_minframe* own_abi() const { return (abi_minframe*) _sp; } |
aoqi@0 | 477 | inline abi_minframe* callers_abi() const { return (abi_minframe*) _fp; } |
aoqi@0 | 478 | |
aoqi@0 | 479 | private: |
aoqi@0 | 480 | |
aoqi@0 | 481 | // Find codeblob and set deopt_state. |
aoqi@0 | 482 | inline void find_codeblob_and_set_pc_and_deopt_state(address pc); |
aoqi@0 | 483 | |
aoqi@0 | 484 | public: |
aoqi@0 | 485 | |
aoqi@0 | 486 | // Constructors |
aoqi@0 | 487 | inline frame(intptr_t* sp); |
aoqi@0 | 488 | frame(intptr_t* sp, address pc); |
aoqi@0 | 489 | inline frame(intptr_t* sp, address pc, intptr_t* unextended_sp); |
aoqi@0 | 490 | |
aoqi@0 | 491 | private: |
aoqi@0 | 492 | |
aoqi@0 | 493 | intptr_t* compiled_sender_sp(CodeBlob* cb) const; |
aoqi@0 | 494 | address* compiled_sender_pc_addr(CodeBlob* cb) const; |
aoqi@0 | 495 | address* sender_pc_addr(void) const; |
aoqi@0 | 496 | |
aoqi@0 | 497 | public: |
aoqi@0 | 498 | |
aoqi@0 | 499 | #ifdef CC_INTERP |
aoqi@0 | 500 | // Additional interface for interpreter frames: |
aoqi@0 | 501 | inline interpreterState get_interpreterState() const; |
aoqi@0 | 502 | #else |
aoqi@0 | 503 | inline ijava_state* get_ijava_state() const; |
aoqi@0 | 504 | // Some convenient register frame setters/getters for deoptimization. |
aoqi@0 | 505 | inline intptr_t* interpreter_frame_esp() const; |
aoqi@0 | 506 | inline void interpreter_frame_set_cpcache(ConstantPoolCache* cp); |
aoqi@0 | 507 | inline void interpreter_frame_set_esp(intptr_t* esp); |
aoqi@0 | 508 | inline void interpreter_frame_set_top_frame_sp(intptr_t* top_frame_sp); |
aoqi@0 | 509 | inline void interpreter_frame_set_sender_sp(intptr_t* sender_sp); |
aoqi@0 | 510 | #endif // CC_INTERP |
aoqi@0 | 511 | |
aoqi@0 | 512 | // Size of a monitor in bytes. |
aoqi@0 | 513 | static int interpreter_frame_monitor_size_in_bytes(); |
aoqi@0 | 514 | |
aoqi@0 | 515 | // The size of a cInterpreter object. |
aoqi@0 | 516 | static inline int interpreter_frame_cinterpreterstate_size_in_bytes(); |
aoqi@0 | 517 | |
aoqi@0 | 518 | private: |
aoqi@0 | 519 | |
aoqi@0 | 520 | ConstantPoolCache** interpreter_frame_cpoolcache_addr() const; |
aoqi@0 | 521 | |
aoqi@0 | 522 | public: |
aoqi@0 | 523 | |
aoqi@0 | 524 | // Additional interface for entry frames: |
aoqi@0 | 525 | inline entry_frame_locals* get_entry_frame_locals() const { |
aoqi@0 | 526 | return (entry_frame_locals*) (((address) fp()) - entry_frame_locals_size); |
aoqi@0 | 527 | } |
aoqi@0 | 528 | |
aoqi@0 | 529 | enum { |
aoqi@0 | 530 | // normal return address is 1 bundle past PC |
aoqi@0 | 531 | pc_return_offset = 0 |
aoqi@0 | 532 | }; |
aoqi@0 | 533 | |
aoqi@0 | 534 | #endif // CPU_PPC_VM_FRAME_PPC_HPP |