< prev index next >

src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp

Print this page

 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  *
 24  */
 25 
 26 #ifndef CPU_AARCH64_FRAME_AARCH64_INLINE_HPP
 27 #define CPU_AARCH64_FRAME_AARCH64_INLINE_HPP
 28 
 29 #include "code/codeBlob.inline.hpp"
 30 #include "code/codeCache.inline.hpp"
 31 #include "code/vmreg.inline.hpp"
 32 #include "interpreter/interpreter.hpp"
 33 #include "runtime/sharedRuntime.hpp"
 34 #include "pauth_aarch64.hpp"



 35 
 36 // Inline functions for AArch64 frames:
 37 
 38 #if INCLUDE_JFR
 39 
 40 // Static helper routines
 41 
 42 inline address frame::interpreter_bcp(const intptr_t* fp) {
 43   assert(fp != nullptr, "invariant");
 44   return reinterpret_cast<address>(fp[frame::interpreter_frame_bcp_offset]);
 45 }
 46 
 47 inline address frame::interpreter_return_address(const intptr_t* fp) {
 48   assert(fp != nullptr, "invariant");
 49   return reinterpret_cast<address>(fp[frame::return_addr_offset]);
 50 }
 51 
 52 inline intptr_t* frame::interpreter_sender_sp(const intptr_t* fp) {
 53   assert(fp != nullptr, "invariant");
 54   return reinterpret_cast<intptr_t*>(fp[frame::interpreter_frame_sender_sp_offset]);

434   assert(_cb == CodeCache::find_blob(pc()), "Must be the same");
435   if (_cb != nullptr) return sender_for_compiled_frame(map);
436 
437   // Must be native-compiled frame, i.e. the marshaling code for native
438   // methods that exists in the core system.
439 
440   // Native code may or may not have signed the return address, we have no way to be sure or what
441   // signing methods they used. Instead, just ensure the stripped value is used.
442 
443   return frame(sender_sp(), link(), sender_pc());
444 }
445 
446 inline frame frame::sender_for_compiled_frame(RegisterMap* map) const {
447   // we cannot rely upon the last fp having been saved to the thread
448   // in C2 code but it will have been pushed onto the stack. so we
449   // have to find it relative to the unextended sp
450 
451   assert(_cb->frame_size() > 0, "must have non-zero frame size");
452   intptr_t* l_sender_sp = (!PreserveFramePointer || _sp_is_trusted) ? unextended_sp() + _cb->frame_size()
453                                                                     : sender_sp();




454   assert(!_sp_is_trusted || l_sender_sp == real_fp(), "");
455 





456   // The return_address is always the word on the stack.
457   // For ROP protection, C1/C2 will have signed the sender_pc,
458   // but there is no requirement to authenticate it here.
459   address sender_pc = pauth_strip_verifiable((address) *(l_sender_sp - 1));
460 
461   intptr_t** saved_fp_addr = (intptr_t**) (l_sender_sp - frame::sender_sp_offset);








462 
463   if (map->update_map()) {
464     // Tell GC to use argument oopmaps for some runtime stubs that need it.
465     // For C1, the runtime stub might not have oop maps, so set this flag
466     // outside of update_register_map.
467     if (!_cb->is_nmethod()) { // compiled frames do not use callee-saved registers
468       map->set_include_argument_oops(_cb->caller_must_gc_arguments(map->thread()));













469       if (oop_map() != nullptr) {
470         _oop_map->update_register_map(this, map);
471       }
472     } else {
473       assert(!_cb->caller_must_gc_arguments(map->thread()), "");
474       assert(!map->include_argument_oops(), "");
475       assert(oop_map() == nullptr || !oop_map()->has_any(OopMapValue::callee_saved_value), "callee-saved value in compiled frame");
476     }
477 
478     // Since the prolog does the save and restore of FP there is no oopmap
479     // for it so we must fill in its location as if there was an oopmap entry
480     // since if our caller was compiled code there could be live jvm state in it.
481     update_map_with_saved_link(map, saved_fp_addr);
482   }
483 
484   if (Continuation::is_return_barrier_entry(sender_pc)) {
485     if (map->walk_cont()) { // about to walk into an h-stack
486       return Continuation::top_frame(*this, map);
487     } else {
488       return Continuation::continuation_bottom_sender(map->thread(), *this, l_sender_sp);

 15  *
 16  * You should have received a copy of the GNU General Public License version
 17  * 2 along with this work; if not, write to the Free Software Foundation,
 18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 19  *
 20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 21  * or visit www.oracle.com if you need additional information or have any
 22  * questions.
 23  *
 24  */
 25 
 26 #ifndef CPU_AARCH64_FRAME_AARCH64_INLINE_HPP
 27 #define CPU_AARCH64_FRAME_AARCH64_INLINE_HPP
 28 
 29 #include "code/codeBlob.inline.hpp"
 30 #include "code/codeCache.inline.hpp"
 31 #include "code/vmreg.inline.hpp"
 32 #include "interpreter/interpreter.hpp"
 33 #include "runtime/sharedRuntime.hpp"
 34 #include "pauth_aarch64.hpp"
 35 #ifdef COMPILER1
 36 #include "c1/c1_Runtime1.hpp"
 37 #endif
 38 
 39 // Inline functions for AArch64 frames:
 40 
 41 #if INCLUDE_JFR
 42 
 43 // Static helper routines
 44 
 45 inline address frame::interpreter_bcp(const intptr_t* fp) {
 46   assert(fp != nullptr, "invariant");
 47   return reinterpret_cast<address>(fp[frame::interpreter_frame_bcp_offset]);
 48 }
 49 
 50 inline address frame::interpreter_return_address(const intptr_t* fp) {
 51   assert(fp != nullptr, "invariant");
 52   return reinterpret_cast<address>(fp[frame::return_addr_offset]);
 53 }
 54 
 55 inline intptr_t* frame::interpreter_sender_sp(const intptr_t* fp) {
 56   assert(fp != nullptr, "invariant");
 57   return reinterpret_cast<intptr_t*>(fp[frame::interpreter_frame_sender_sp_offset]);

437   assert(_cb == CodeCache::find_blob(pc()), "Must be the same");
438   if (_cb != nullptr) return sender_for_compiled_frame(map);
439 
440   // Must be native-compiled frame, i.e. the marshaling code for native
441   // methods that exists in the core system.
442 
443   // Native code may or may not have signed the return address, we have no way to be sure or what
444   // signing methods they used. Instead, just ensure the stripped value is used.
445 
446   return frame(sender_sp(), link(), sender_pc());
447 }
448 
449 inline frame frame::sender_for_compiled_frame(RegisterMap* map) const {
450   // we cannot rely upon the last fp having been saved to the thread
451   // in C2 code but it will have been pushed onto the stack. so we
452   // have to find it relative to the unextended sp
453 
454   assert(_cb->frame_size() > 0, "must have non-zero frame size");
455   intptr_t* l_sender_sp = (!PreserveFramePointer || _sp_is_trusted) ? unextended_sp() + _cb->frame_size()
456                                                                     : sender_sp();
457 #ifdef ASSERT
458    address sender_pc_copy = pauth_strip_verifiable((address) *(l_sender_sp-1));
459 #endif
460 
461   assert(!_sp_is_trusted || l_sender_sp == real_fp(), "");
462 
463   intptr_t** saved_fp_addr = (intptr_t**) (l_sender_sp - frame::sender_sp_offset);
464 
465   // Repair the sender sp if the frame has been extended
466   l_sender_sp = repair_sender_sp(l_sender_sp, saved_fp_addr);
467 
468   // The return_address is always the word on the stack.
469   // For ROP protection, C1/C2 will have signed the sender_pc,
470   // but there is no requirement to authenticate it here.
471   address sender_pc = pauth_strip_verifiable((address) *(l_sender_sp - 1));
472 
473 #ifdef ASSERT
474   if (sender_pc != sender_pc_copy) {
475     // When extending the stack in the callee method entry to make room for unpacking of value
476     // type args, we keep a copy of the sender pc at the expected location in the callee frame.
477     // If the sender pc is patched due to deoptimization, the copy is not consistent anymore.
478     nmethod* nm = CodeCache::find_blob(sender_pc)->as_nmethod();
479     assert(sender_pc == nm->deopt_mh_handler_begin() || sender_pc == nm->deopt_handler_begin(), "unexpected sender pc");
480   }
481 #endif
482 
483   if (map->update_map()) {
484     // Tell GC to use argument oopmaps for some runtime stubs that need it.
485     // For C1, the runtime stub might not have oop maps, so set this flag
486     // outside of update_register_map.
487     bool c1_buffering = false;
488 #ifdef COMPILER1
489     nmethod* nm = _cb->as_nmethod_or_null();
490     if (nm != nullptr && nm->is_compiled_by_c1() && nm->method()->has_scalarized_args() &&
491         pc() < nm->verified_inline_entry_point()) {
492       // TODO 8284443 Can't we do that by not passing 'dont_gc_arguments' in case 'C1StubId::buffer_inline_args_id' in 'Runtime1::generate_code_for'?
493       // The VEP and VIEP(RO) of C1-compiled methods call buffer_inline_args_xxx
494       // before doing any argument shuffling, so we need to scan the oops
495       // as the caller passes them.
496       c1_buffering = true;
497     }
498 #endif
499     if (!_cb->is_nmethod() || c1_buffering) { // compiled frames do not use callee-saved registers
500       bool caller_args = _cb->caller_must_gc_arguments(map->thread()) || c1_buffering;
501       map->set_include_argument_oops(caller_args);
502       if (oop_map() != nullptr) {
503         _oop_map->update_register_map(this, map);
504       }
505     } else {
506       assert(!_cb->caller_must_gc_arguments(map->thread()), "");
507       assert(!map->include_argument_oops(), "");
508       assert(oop_map() == nullptr || !oop_map()->has_any(OopMapValue::callee_saved_value), "callee-saved value in compiled frame");
509     }
510 
511     // Since the prolog does the save and restore of FP there is no oopmap
512     // for it so we must fill in its location as if there was an oopmap entry
513     // since if our caller was compiled code there could be live jvm state in it.
514     update_map_with_saved_link(map, saved_fp_addr);
515   }
516 
517   if (Continuation::is_return_barrier_entry(sender_pc)) {
518     if (map->walk_cont()) { // about to walk into an h-stack
519       return Continuation::top_frame(*this, map);
520     } else {
521       return Continuation::continuation_bottom_sender(map->thread(), *this, l_sender_sp);
< prev index next >