1 /* 2 * Copyright (c) 2019, 2023, Oracle and/or its affiliates. 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 it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 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 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #ifndef CPU_PPC_CONTINUATION_PPC_INLINE_HPP 26 #define CPU_PPC_CONTINUATION_PPC_INLINE_HPP 27 28 #include "oops/stackChunkOop.inline.hpp" 29 #include "runtime/frame.hpp" 30 #include "runtime/frame.inline.hpp" 31 32 inline void patch_callee_link(const frame& f, intptr_t* fp) { 33 *ContinuationHelper::Frame::callee_link_address(f) = fp; 34 } 35 36 inline void patch_callee_link_relative(const frame& f, intptr_t* fp) { 37 intptr_t* la = (intptr_t*)ContinuationHelper::Frame::callee_link_address(f); 38 intptr_t new_value = fp - la; 39 *la = new_value; 40 } 41 42 ////// Freeze 43 44 // Fast path 45 46 inline void FreezeBase::patch_stack_pd(intptr_t* frame_sp, intptr_t* heap_sp) { 47 // Nothing to do. The backchain is reconstructed when thawing (see Thaw<ConfigT>::patch_caller_links()) 48 } 49 50 // Slow path 51 52 template<typename FKind> 53 inline frame FreezeBase::sender(const frame& f) { 54 assert(FKind::is_instance(f), ""); 55 if (FKind::interpreted) { 56 return frame(f.sender_sp(), f.sender_pc(), f.interpreter_frame_sender_sp()); 57 } 58 59 intptr_t* sender_sp = f.sender_sp(); 60 address sender_pc = f.sender_pc(); 61 assert(sender_sp != f.sp(), "must have changed"); 62 63 int slot = 0; 64 CodeBlob* sender_cb = CodeCache::find_blob_and_oopmap(sender_pc, slot); 65 return sender_cb != nullptr 66 ? frame(sender_sp, sender_sp, nullptr, sender_pc, sender_cb, slot == -1 ? nullptr : sender_cb->oop_map_for_slot(slot, sender_pc)) 67 : frame(sender_sp, sender_pc, sender_sp); 68 } 69 70 void FreezeBase::adjust_interpreted_frame_unextended_sp(frame& f) { 71 // nothing to do 72 } 73 74 inline void FreezeBase::relativize_interpreted_frame_metadata(const frame& f, const frame& hf) { 75 intptr_t* vfp = f.fp(); 76 intptr_t* hfp = hf.fp(); 77 assert(f.fp() > (intptr_t*)f.interpreter_frame_esp(), ""); 78 79 // There is alignment padding between vfp and f's locals array in the original 80 // frame, because we freeze the padding (see recurse_freeze_interpreted_frame) 81 // in order to keep the same relativized locals pointer, we don't need to change it here. 82 83 // Make sure that monitors is already relativized. 84 assert(hf.at_absolute(ijava_idx(monitors)) <= -(frame::ijava_state_size / wordSize), ""); 85 86 // Make sure that esp is already relativized. 87 assert(hf.at_absolute(ijava_idx(esp)) <= hf.at_absolute(ijava_idx(monitors)), ""); 88 89 // top_frame_sp is already relativized 90 91 // hfp == hf.sp() + (f.fp() - f.sp()) is not true on ppc because the stack frame has room for 92 // the maximal expression stack and the expression stack in the heap frame is trimmed. 93 assert(hf.fp() == hf.interpreter_frame_esp() + (f.fp() - f.interpreter_frame_esp()), ""); 94 assert(hf.fp() <= (intptr_t*)hf.at(ijava_idx(locals)), ""); 95 } 96 97 inline void FreezeBase::set_top_frame_metadata_pd(const frame& hf) { 98 stackChunkOop chunk = _cont.tail(); 99 assert(chunk->is_in_chunk(hf.sp()), "hf.sp()=" PTR_FORMAT, p2i(hf.sp())); 100 101 hf.own_abi()->lr = (uint64_t)hf.pc(); 102 if (hf.is_interpreted_frame()) { 103 patch_callee_link_relative(hf, hf.fp()); 104 } 105 #ifdef ASSERT 106 else { 107 // See also FreezeBase::patch_pd() 108 patch_callee_link(hf, (intptr_t*)badAddress); 109 } 110 #endif 111 } 112 113 // 114 // Heap frames differ from stack frames in the following aspects 115 // 116 // - they are just word aligned 117 // - the unextended sp of interpreted frames is set such that 118 // unextended sp + frame::metadata_words_at_top + 1 points to the last call parameter 119 // (the comment at the file end explains the unextended sp for interpreted frames on the stack) 120 // 121 // The difference in respect to the unextended sp is required to comply with shared code. 122 // Furthermore fast frozen and compiled frames have invalid back links (see 123 // Thaw<ConfigT>::patch_caller_links() and FreezeBase::patch_pd()) 124 // 125 // === New Interpreted Frame ========================================================================================== 126 // 127 // ### Interpreted Caller: Overlap new frame with Caller 128 // 129 // Caller on entry New frame with resized Caller 130 // 131 // | frame::java_abi | | | 132 // | |<- FP of caller | Caller's SP |<- FP of caller 133 // ========================== ========================== 134 // | ijava_state | | ijava_state | 135 // | | | | 136 // |------------------------| ----- |------------------------| 137 // | P0 | ^ | L0 aka P0 | 138 // | : | | | : : | 139 // | Pn |<- unext. SP | | : Pn |<- unext. SP 140 // |------------------------| + metadata overlap | : | + metadata 141 // | frame::java_abi | | | Lm | 142 // | (metadata_words_at_top)|<- SP == unext. SP v |------------------------|<- unextended SP of caller (1) 143 // ========================== of caller ----- | frame::java_abi | 144 // | (metadata_words_at_top)|<- new SP of caller / FP of new frame 145 // overlap = stack_argsize(f) ========================== ^ 146 // + frame::metadata_words_at_top | ijava_state | | 147 // | | | 148 // Where f is the frame to be relocated on the heap. |------------------------| | 149 // See also StackChunkFrameStream::frame_size(). | Expressions | FP - esp of f 150 // | P0 | | 151 // | : | | 152 // | Growth | | Pi | v 153 // v v |------------------------| --- 154 // | frame::java_abi | 155 // | (metadata_words_at_top)|<- unextended SP / 156 // ========================== SP of new frame 157 // ### Compiled Caller: No Overlap 158 // 159 // The caller is resized to accomodate the callee's locals and abi but there is _no_ overlap with 160 // the original caller frame. 161 // 162 // Caller on entry New frame with resized Caller 163 // 164 // | frame::java_abi | | | 165 // | (metadata_words_at_top)|<- FP of caller | Caller's SP |<- FP of caller 166 // ========================== ========================== 167 // | | | | 168 // | | | | 169 // |------------------------| |------------------------| 170 // | frame::java_abi | | frame::java_abi | 171 // | (metadata_words_at_top)|<- SP == unext. SP | (metadata_words_at_top)|<- unext. SP of caller 172 // ========================== of caller |------------------------| 173 // | L0 aka P0 | 174 // | : : | 175 // | : Pn | 176 // overlap = 0 | Lm | 177 // |------------------------| 178 // f is the frame to be relocated on the heap | frame::java_abi | 179 // | (metadata_words_at_top)|<- new SP of caller / FP of new frame 180 // ========================== ^ 181 // | ijava_state | | 182 // | Growth | | | | 183 // v v |------------------------| | 184 // | Expressions | FP - esp of f 185 // | P0 | | 186 // | : | | 187 // | Pi | v 188 // |------------------------| --- 189 // | frame::java_abi | 190 // | (metadata_words_at_top)|<- unextended SP / 191 // ========================== SP of new frame 192 // 193 // (1) Caller's unextended SP is preserved in callee's frame::ijava_state::sender_sp 194 // (See ContinuationHelper::InterpretedFrame::patch_sender_sp). This is required 195 // by StackChunkFrameStream<frame_kind>::next_for_interpreter_frame(). 196 // 197 // === New Compiled Frame ============================================================================================= 198 // 199 // ### Interpreted Caller: No Overlap 200 // 201 // The caller is resized to accomodate the callee's stack arguments and abi but there is _no_ overlap with 202 // the original caller frame. 203 // 204 // Note: a new ABI is added to the caller even if there are no stackargs. 205 // This is necessary to comply with shared code. 206 // 207 // Caller on entry New frame with resized Caller 208 // 209 // | frame::java_abi | | frame::java_abi | 210 // | (metadata_words_at_top)|<- FP of caller | (metadata_words_at_top)|<- FP of caller 211 // ========================== ========================== 212 // | ijava_state | | ijava_state | 213 // | | | | 214 // |------------------------| |------------------------| 215 // | P0 | | P0 | 216 // | : | | : | 217 // | Pn |<- unext. SP | Pn |<- unext. SP 218 // |------------------------| + metadata |------------------------| + metadata 219 // | frame::java_abi | | frame::java_abi | 220 // | (metadata_words_at_top)|<- SP == unext. SP | (metadata_words_at_top)|<- unextended SP of caller (1) 221 // ========================== of caller |------------------------| 222 // | Stack Args | 223 // overlap = 0 | (if any) | 224 // |------------------------| 225 // f is the frame to be relocated on the heap | frame::java_abi | 226 // | (metadata_words_at_top)|<- new SP of caller / FP of new frame 227 // ========================== 228 // | | 229 // | Growth | | | 230 // v v |------------------------| 231 // | frame::java_abi | 232 // | (metadata_words_at_top)|<- SP == unext. SP of new frame 233 // ========================== 234 // 235 // ### Compiled Caller: Stackargs + ABI Overlap 236 // 237 // Caller on entry New frame with resized Caller 238 // 239 // | frame::java_abi | | frame::java_abi | 240 // | (metadata_words_at_top)|<- FP of caller | (metadata_words_at_top)|<- FP of caller 241 // ========================== ========================== 242 // | | | | 243 // | | | | 244 // |------------------------| ----- |------------------------| 245 // | Stack Args | ^ | Stack Args | 246 // | (if any) | | | (if any) | 247 // |------------------------| overlap |------------------------| 248 // | frame::java_abi | | | frame::java_abi | 249 // | (metadata_words_at_top)|<- SP == unext. SP v | (metadata_words_at_top)|<- SP == unext. SP of caller 250 // ========================== of caller ----- ========================== / FP of new frame 251 // | | 252 // overlap = stack_argsize(f) | | 253 // + frame::metadata_words_at_top |------------------------| 254 // | frame::java_abi | 255 // Where f is the frame to be relocated on the heap. | (metadata_words_at_top)|<- SP == unext. SP of new frame 256 // See also StackChunkFrameStream::frame_size(). ========================== 257 // 258 template<typename FKind> 259 frame FreezeBase::new_heap_frame(frame& f, frame& caller) { 260 assert(FKind::is_instance(f), ""); 261 262 intptr_t *sp, *fp; 263 if (FKind::interpreted) { 264 intptr_t locals_offset = *f.addr_at(ijava_idx(locals)); 265 // If the caller.is_empty(), i.e. we're freezing into an empty chunk, then we set 266 // the chunk's argsize in finalize_freeze and make room for it above the unextended_sp 267 // See also comment on StackChunkFrameStream<frame_kind>::interpreter_frame_size() 268 int overlap = 269 (caller.is_interpreted_frame() || caller.is_empty()) 270 ? ContinuationHelper::InterpretedFrame::stack_argsize(f) + frame::metadata_words_at_top 271 : 0; 272 fp = caller.unextended_sp() - 1 - locals_offset + overlap; 273 // esp points one slot below the last argument 274 intptr_t* x86_64_like_unextended_sp = f.interpreter_frame_esp() + 1 - frame::metadata_words_at_top; 275 sp = fp - (f.fp() - x86_64_like_unextended_sp); 276 277 assert (sp <= fp && (fp <= caller.unextended_sp() || caller.is_interpreted_frame()), 278 "sp=" PTR_FORMAT " fp=" PTR_FORMAT " caller.unextended_sp()=" PTR_FORMAT " caller.is_interpreted_frame()=%d", 279 p2i(sp), p2i(fp), p2i(caller.unextended_sp()), caller.is_interpreted_frame()); 280 caller.set_sp(fp); 281 282 assert(_cont.tail()->is_in_chunk(sp), ""); 283 284 frame hf(sp, sp, fp, f.pc(), nullptr, nullptr, true /* on_heap */); 285 // frame_top() and frame_bottom() read these before relativize_interpreted_frame_metadata() is called 286 *hf.addr_at(ijava_idx(locals)) = locals_offset; 287 *hf.addr_at(ijava_idx(esp)) = f.interpreter_frame_esp() - f.fp(); 288 return hf; 289 } else { 290 int fsize = FKind::size(f); 291 sp = caller.unextended_sp() - fsize; 292 if (caller.is_interpreted_frame()) { 293 // If the caller is interpreted, our stackargs are not supposed to overlap with it 294 // so we make more room by moving sp down by argsize 295 int argsize = FKind::stack_argsize(f); 296 sp -= argsize + frame::metadata_words_at_top; 297 } 298 fp = sp + fsize; 299 caller.set_sp(fp); 300 301 assert(_cont.tail()->is_in_chunk(sp), ""); 302 303 return frame(sp, sp, fp, f.pc(), nullptr, nullptr, true /* on_heap */); 304 } 305 } 306 307 inline void FreezeBase::patch_pd(frame& hf, const frame& caller) { 308 if (caller.is_interpreted_frame()) { 309 assert(!caller.is_empty(), ""); 310 patch_callee_link_relative(caller, caller.fp()); 311 } 312 #ifdef ASSERT 313 else { 314 // For compiled frames the back link is actually redundant. It gets computed 315 // as unextended_sp + frame_size. 316 317 // Note the difference on x86_64: the link is not made relative if the caller 318 // is a compiled frame because there rbp is used as a non-volatile register by 319 // c1/c2 so it could be a computed value local to the caller. 320 321 // See also: 322 // - FreezeBase::set_top_frame_metadata_pd 323 // - StackChunkFrameStream<frame_kind>::fp() 324 // - UseContinuationFastPath: compiled frames are copied in a batch w/o patching the back link. 325 // The backlinks are restored when thawing (see Thaw<ConfigT>::patch_caller_links()) 326 patch_callee_link(hf, (intptr_t*)badAddress); 327 } 328 #endif 329 } 330 331 //////// Thaw 332 333 // Fast path 334 335 inline void ThawBase::prefetch_chunk_pd(void* start, int size) { 336 size <<= LogBytesPerWord; 337 Prefetch::read(start, size); 338 Prefetch::read(start, size - 64); 339 } 340 341 // Set back chain links of fast thawed frames such that *sp == callers_sp. 342 // See https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#STACK 343 template <typename ConfigT> 344 inline void Thaw<ConfigT>::patch_caller_links(intptr_t* sp, intptr_t* bottom) { 345 for (intptr_t* callers_sp; sp < bottom; sp = callers_sp) { 346 address pc = (address)((frame::java_abi*) sp)->lr; 347 assert(pc != nullptr, ""); 348 // see ThawBase::patch_return() which gets called just before 349 bool is_entry_frame = pc == StubRoutines::cont_returnBarrier() || pc == _cont.entryPC(); 350 if (is_entry_frame) { 351 callers_sp = _cont.entryFP(); 352 } else { 353 CodeBlob* cb = CodeCache::find_blob_fast(pc); 354 callers_sp = sp + cb->frame_size(); 355 } 356 // set the back link 357 ((frame::java_abi*) sp)->callers_sp = (intptr_t) callers_sp; 358 } 359 } 360 361 // Slow path 362 363 inline frame ThawBase::new_entry_frame() { 364 intptr_t* sp = _cont.entrySP(); 365 return frame(sp, _cont.entryPC(), sp, _cont.entryFP()); 366 } 367 368 // === New Interpreted Frame ================================================================================================================ 369 // 370 // ### Non-Interpreted Caller (compiled, enterSpecial): No Overlap 371 // 372 // Heap Frame `hf` `hf` gets copied to stack _without_ overlapping the caller 373 // 374 // | | Non-Interpreted | | 375 // | |<- bottom Caller |----------------------| 376 // |----------------------| ^ | frame::java_abi |<- unextended SP 377 // | L0 aka P0 | | --- ======================== 378 // | : : | | ^ | L0 aka P0 | 379 // | : Pn | | | | : : | Parameters do 380 // | : | | | | : Pn | not overlap with 381 // | Lm | | | | : | caller! 382 // |----------------------| `fsize` | | : | 383 // | frame::java_abi | | | : | 384 // ======================== | `fsize` + padding | Lm | 385 // | | | |----------------------| 386 // | ijava_state | | | | Opt. Align. Padding | 387 // | | | | |----------------------| 388 // |----------------------| | | | frame::java_abi |<- new SP of caller 389 // | L0 aka P0 | | | ======================== / FP of new frame 390 // | : : | | | | | (aligned) 391 // | : Pn |<- unext. SP + metadata | | ijava_state | 392 // | : | | | | | 393 // | Lm | | | |----------------------| 394 // |----------------------| v | | P0 | 395 // | frame::java_abi |<- SP / unextended SP | | : | 396 // ======================== | | Pi |<- unextended SP + metadata 397 // | |----------------------| 398 // | Growth | v | frame::java_abi |<- unextended SP / SP of new frame 399 // v v --- ======================== (not yet aligned(1)) 400 // 401 // 402 // ### Interpreted Caller: Overlap with Caller 403 // 404 // Caller New frame with resized/aligned Caller 405 // 406 // | | | | 407 // | ijava_state | | ijava_state | 408 // |----------------------| |----------------------| 409 // | non param. expr. | bottom | non param. expr. | 410 // | - - - - - - - - - - | --- ^ | - - - - - - - - - - | 411 // | P0 | ^ | | L0 aka P0 | 412 // | : | | | | : : | 413 // | Pn |<- unextended SP overlap | | : Pn |<- unextended SP 414 // |----------------------| + metadata_words_at_top | | | : | + metadata_words_at_top 415 // | frame::java_abi |<- unextended SP v | | : | (unaligned) 416 // ======================== / SP of new frame --- | | : | of caller 417 // (not yet aligned(1)) | | Lm | 418 // `fsize` |----------------------| 419 // overlap = stack_argsize(hf) + padding| Opt. Align. Padding | 420 // + frame::metadata_words_at_top | |----------------------| 421 // | | frame::java_abi |<- new SP of caller 422 // | ======================== / FP of new frame 423 // | | | (aligned) 424 // | Growth | | | ijava_state | 425 // v v | | | 426 // | |----------------------| 427 // | | P0 | 428 // | | : | 429 // | | Pi |<- unextended SP 430 // | |----------------------| + metadata_words_at_top 431 // v | frame::java_abi |<- unextended SP / SP of new frame 432 // --- ======================== (not yet aligned(1)) 433 // 434 // 435 // (1) The SP / unextended SP of the new interpreted frame is not aligned. It 436 // gets aligned when its callee is pushed on stack or in finish_thaw() if 437 // it is the top frame. This allows addressing parameters: unextended SP + metadata_words_at_top 438 // 439 // (2) If caller is interpreted then its ijava_state::top_frame_sp will be used as sender sp 440 // of the new frame (see ContinuationHelper::InterpretedFrame::patch_sender_sp() and diagram at the end of this file) 441 // 442 // (3) The size of alignment padding required when thawing frames is accounted for 443 // in FreezeBase::_align_size. 444 // 445 // === New Compiled Frame =================================================================================================================== 446 // 447 // Compiled Caller Interpreted Caller 448 // 449 // - stackargs+abi overlap with caller - gets resized for stackargs 450 // - no alignment padding - SP gets aligned 451 // - no overlap with orig. 452 // caller 453 // O C 454 // r a | | | | 455 // i l | | | | 456 // g l |----------------------| | | 457 // i e | Stack Args | | | 458 // n r | (if any) | |----------------------| 459 // a |----------------------| | frame::java_abi | 460 // l | frame::java_abi |<- unext. SP / SP | (unused) |<- unal.unext.SP 461 // - - - ======================== - - - - - - - - - - |----------------------|- - - - - - - - - - - - - - - - - - - - - - - - - - - - 462 // N | | | Opt. Align. Padding | 463 // e | | |----------------------| 464 // w |----------------------| | Stack Args | 465 // | frame::java_abi |<- unext. SP / SP | (if any) | 466 // F ======================== |----------------------| 467 // r | frame::java_abi |<- caller's SP 468 // a ======================== / new frame's FP 469 // m | | (aligned) 470 // e | | 471 // |----------------------| 472 // | frame::java_abi |<- unext. SP / SP 473 // ======================== 474 // 475 // If the new frame is at the bottom just above the ContinuationEntry frame then the stackargs 476 // don't overlap the caller either even though it is compiled because the size is not 477 // limited/known. In contrast to the interpreted caller case the abi overlaps with the caller 478 // if there are no stackargs. This is to comply with shared code (see e.g. StackChunkFrameStream::frame_size()) 479 // 480 template<typename FKind> frame ThawBase::new_stack_frame(const frame& hf, frame& caller, bool bottom) { 481 assert(FKind::is_instance(hf), ""); 482 483 assert(is_aligned(caller.fp(), frame::frame_alignment), ""); 484 assert(is_aligned(caller.sp(), frame::frame_alignment), ""); 485 if (FKind::interpreted) { 486 // Note: we have to overlap with the caller, at least if it is interpreted, to match the 487 // max_thawing_size calculation during freeze. See also comment above. 488 intptr_t* heap_sp = hf.unextended_sp(); 489 const int fsize = ContinuationHelper::InterpretedFrame::frame_bottom(hf) - hf.unextended_sp(); 490 const int overlap = !caller.is_interpreted_frame() ? 0 491 : ContinuationHelper::InterpretedFrame::stack_argsize(hf) + frame::metadata_words_at_top; 492 intptr_t* frame_sp = caller.unextended_sp() + overlap - fsize; 493 intptr_t* fp = frame_sp + (hf.fp() - heap_sp); 494 // align fp 495 int padding = fp - align_down(fp, frame::frame_alignment); 496 fp -= padding; 497 // alignment of sp is done by callee or in finish_thaw() 498 frame_sp -= padding; 499 500 // On ppc esp points to the next free slot on the expression stack and sp + metadata points to the last parameter 501 DEBUG_ONLY(intptr_t* esp = fp + *hf.addr_at(ijava_idx(esp));) 502 assert(frame_sp + frame::metadata_words_at_top == esp+1, " frame_sp=" PTR_FORMAT " esp=" PTR_FORMAT, p2i(frame_sp), p2i(esp)); 503 caller.set_sp(fp); 504 frame f(frame_sp, hf.pc(), frame_sp, fp); 505 // we need to set the locals so that the caller of new_stack_frame() can call 506 // ContinuationHelper::InterpretedFrame::frame_bottom 507 // copy relativized locals from the heap frame 508 *f.addr_at(ijava_idx(locals)) = *hf.addr_at(ijava_idx(locals)); 509 510 return f; 511 } else { 512 int fsize = FKind::size(hf); 513 int argsize = hf.compiled_frame_stack_argsize(); 514 intptr_t* frame_sp = caller.sp() - fsize; 515 516 if ((bottom && argsize > 0) || caller.is_interpreted_frame()) { 517 frame_sp -= argsize + frame::metadata_words_at_top; 518 frame_sp = align_down(frame_sp, frame::alignment_in_bytes); 519 caller.set_sp(frame_sp + fsize); 520 } 521 522 assert(hf.cb() != nullptr, ""); 523 assert(hf.oop_map() != nullptr, ""); 524 intptr_t* fp = frame_sp + fsize; 525 return frame(frame_sp, frame_sp, fp, hf.pc(), hf.cb(), hf.oop_map(), false); 526 } 527 } 528 529 inline intptr_t* ThawBase::align(const frame& hf, intptr_t* frame_sp, frame& caller, bool bottom) { 530 // Unused. Alignment is done directly in new_stack_frame() / finish_thaw(). 531 return nullptr; 532 } 533 534 inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, const frame& f) { 535 intptr_t* vfp = f.fp(); 536 537 // Make sure that monitors is still relativized. 538 assert(f.at_absolute(ijava_idx(monitors)) <= -(frame::ijava_state_size / wordSize), ""); 539 540 // Make sure that esp is still relativized. 541 assert(f.at_absolute(ijava_idx(esp)) <= f.at_absolute(ijava_idx(monitors)), ""); 542 543 // Keep top_frame_sp relativized. 544 } 545 546 inline void ThawBase::patch_pd(frame& f, const frame& caller) { 547 patch_callee_link(caller, caller.fp()); 548 // Prevent assertion if f gets deoptimized right away before it's fully initialized 549 f.mark_not_fully_initialized(); 550 } 551 552 // 553 // Interpreter Calling Procedure on PPC 554 // 555 // Caller Resized Caller before the Call New Callee Frame 556 // 557 // - SP/FP are 16 byte aligned. - The unused part of the expression stack - The caller's original SP is passed as 558 // Padding is added as necessary. is removed sender SP (in R21_sender_SP) also by 559 // - SP is _not_ used as esp - Slots for the callee's nonparameter locals compiled callers. It is saved in the 560 // (expression stack pointer) are added. ijava_state::sender_sp slot and 561 // - Has reserved slots for the - The large ABI is replaced with a minimal restored when returning. 562 // maximal expression stack ABI. This removes a c2i extension if there 563 // - Has a larger ABI section on - The original SP was saved in is one. 564 // top that is required to call ijava_state::top_frame_sp slot. - ijava_state::sender_sp will be set 565 // C++ code From there it is restored as SP _after_ as the caller's unextended sp when 566 // returning from a call. This reverts the iterating stack frames 567 // resizing described above. It is also (see frame::unextended_sp() and 568 // required to undo potential i2c extensions frame::sender_for_interpreter_frame()) 569 // if the calle should be compiled. 570 // - Note that unextended SP < SP 571 // is possible on ppc. 572 // 573 // | | | | | | 574 // | (frame::java_abi) | | (frame::java_abi) | | (frame::java_abi) | 575 // | 4 words | | 4 words | | 4 words | 576 // | Caller's SP |<- FP of caller | Caller's SP |<- FP of caller | Caller's SP |<- FP of caller 577 // ======================== (aligned) ======================== ======================== 578 // | frame:: | | frame:: | | frame:: | 579 // | ijava_state | | ijava_state | | ijava_state | 580 // | | | | | | 581 // |----------------------| |----------------------| |----------------------| 582 // | P0 | | L0 aka P0 | | L0 aka P0 | 583 // | | | : | | : | 584 // | Pn | | : Pn | | : Pn | 585 // |----------------------| | : | | : | 586 // | | | Lm | | Lm | 587 // | Reserved Expr. Stack | |----------------------| |----------------------| 588 // | | | Opt. Alignm. Padding | | Opt. Alignm. Padding | 589 // | |<- ConstMethod |----------------------| |----------------------| 590 // |----------------------| ::_max_stack | | | | 591 // | Opt. Alignm. Padding | | (frame::java_abi) | | (frame::java_abi) | 592 // |----------------------| | 4 words | | 4 words | 593 // | Large ABI | | Caller's SP |<- new SP of caller | Caller's SP |<- SP of caller / 594 // | for C++ calls | ======================== (aligned) ======================== FP of callee 595 // | (frame:: | | frame:: | (aligned) 596 // | native_abi_reg_args)| | ijava_state | 597 // | | | | 598 // | | |----------------------| 599 // | | | | 600 // | Caller's SP |<- SP of caller <- unextended SP | Reserved Expr. Stack |<- unextended SP 601 // ======================== (aligned) of caller | | of caller 602 // (aligned) | | 603 // | | 604 // | | 605 // | | 606 // | |<- ConstMethod 607 // |----------------------| ::_max_stack 608 // Resize Caller Push new Callee Frame | Opt. Alignm. Padding | 609 // --------------------> ------------------------> |----------------------| 610 // (ABI, expressions, locals) | Large ABI | 611 // | for C++ calls | 612 // | (frame:: | 613 // | native_abi_reg_args)| 614 // | Growth | | | 615 // v v | | 616 // | | 617 // | Caller's SP |<- SP of callee 618 // ======================== (aligned) 619 // 620 // 621 #endif // CPU_PPC_CONTINUATION_PPC_INLINE_HPP