src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp
changeset 57565 01bca26734bb
parent 55749 cff8aad2593f
child 57710 05ff6e27de45
equal deleted inserted replaced
57564:0a8436eda2fa 57565:01bca26734bb
    46 #include "adfiles/ad_aarch64.hpp"
    46 #include "adfiles/ad_aarch64.hpp"
    47 #include "opto/runtime.hpp"
    47 #include "opto/runtime.hpp"
    48 #endif
    48 #endif
    49 #if INCLUDE_JVMCI
    49 #if INCLUDE_JVMCI
    50 #include "jvmci/jvmciJavaClasses.hpp"
    50 #include "jvmci/jvmciJavaClasses.hpp"
    51 #endif
       
    52 
       
    53 #ifdef BUILTIN_SIM
       
    54 #include "../../../../../../simulator/simulator.hpp"
       
    55 #endif
    51 #endif
    56 
    52 
    57 #define __ masm->
    53 #define __ masm->
    58 
    54 
    59 const int StackAlignmentInSlots = StackAlignmentInBytes / VMRegImpl::stack_slot_size;
    55 const int StackAlignmentInSlots = StackAlignmentInBytes / VMRegImpl::stack_slot_size;
   340 #endif
   336 #endif
   341 
   337 
   342   __ mov(c_rarg0, rmethod);
   338   __ mov(c_rarg0, rmethod);
   343   __ mov(c_rarg1, lr);
   339   __ mov(c_rarg1, lr);
   344   __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::fixup_callers_callsite)));
   340   __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::fixup_callers_callsite)));
   345   __ blrt(rscratch1, 2, 0, 0);
   341   __ blr(rscratch1);
   346   __ maybe_isb();
   342   __ maybe_isb();
   347 
   343 
   348   __ pop_CPU_state();
   344   __ pop_CPU_state();
   349   // restore sp
   345   // restore sp
   350   __ leave();
   346   __ leave();
   660   __ str(rmethod, Address(rthread, JavaThread::callee_target_offset()));
   656   __ str(rmethod, Address(rthread, JavaThread::callee_target_offset()));
   661 
   657 
   662   __ br(rscratch1);
   658   __ br(rscratch1);
   663 }
   659 }
   664 
   660 
   665 #ifdef BUILTIN_SIM
       
   666 static void generate_i2c_adapter_name(char *result, int total_args_passed, const BasicType *sig_bt)
       
   667 {
       
   668   strcpy(result, "i2c(");
       
   669   int idx = 4;
       
   670   for (int i = 0; i < total_args_passed; i++) {
       
   671     switch(sig_bt[i]) {
       
   672     case T_BOOLEAN:
       
   673       result[idx++] = 'Z';
       
   674       break;
       
   675     case T_CHAR:
       
   676       result[idx++] = 'C';
       
   677       break;
       
   678     case T_FLOAT:
       
   679       result[idx++] = 'F';
       
   680       break;
       
   681     case T_DOUBLE:
       
   682       assert((i < (total_args_passed - 1)) && (sig_bt[i+1] == T_VOID),
       
   683              "double must be followed by void");
       
   684       i++;
       
   685       result[idx++] = 'D';
       
   686       break;
       
   687     case T_BYTE:
       
   688       result[idx++] = 'B';
       
   689       break;
       
   690     case T_SHORT:
       
   691       result[idx++] = 'S';
       
   692       break;
       
   693     case T_INT:
       
   694       result[idx++] = 'I';
       
   695       break;
       
   696     case T_LONG:
       
   697       assert((i < (total_args_passed - 1)) && (sig_bt[i+1] == T_VOID),
       
   698              "long must be followed by void");
       
   699       i++;
       
   700       result[idx++] = 'L';
       
   701       break;
       
   702     case T_OBJECT:
       
   703       result[idx++] = 'O';
       
   704       break;
       
   705     case T_ARRAY:
       
   706       result[idx++] = '[';
       
   707       break;
       
   708     case T_ADDRESS:
       
   709       result[idx++] = 'P';
       
   710       break;
       
   711     case T_NARROWOOP:
       
   712       result[idx++] = 'N';
       
   713       break;
       
   714     case T_METADATA:
       
   715       result[idx++] = 'M';
       
   716       break;
       
   717     case T_NARROWKLASS:
       
   718       result[idx++] = 'K';
       
   719       break;
       
   720     default:
       
   721       result[idx++] = '?';
       
   722       break;
       
   723     }
       
   724   }
       
   725   result[idx++] = ')';
       
   726   result[idx] = '\0';
       
   727 }
       
   728 #endif
       
   729 
       
   730 // ---------------------------------------------------------------
   661 // ---------------------------------------------------------------
   731 AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm,
   662 AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm,
   732                                                             int total_args_passed,
   663                                                             int total_args_passed,
   733                                                             int comp_args_on_stack,
   664                                                             int comp_args_on_stack,
   734                                                             const BasicType *sig_bt,
   665                                                             const BasicType *sig_bt,
   735                                                             const VMRegPair *regs,
   666                                                             const VMRegPair *regs,
   736                                                             AdapterFingerPrint* fingerprint) {
   667                                                             AdapterFingerPrint* fingerprint) {
   737   address i2c_entry = __ pc();
   668   address i2c_entry = __ pc();
   738 #ifdef BUILTIN_SIM
   669 
   739   char *name = NULL;
       
   740   AArch64Simulator *sim = NULL;
       
   741   size_t len = 65536;
       
   742   if (NotifySimulator) {
       
   743     name = NEW_C_HEAP_ARRAY(char, len, mtInternal);
       
   744   }
       
   745 
       
   746   if (name) {
       
   747     generate_i2c_adapter_name(name, total_args_passed, sig_bt);
       
   748     sim = AArch64Simulator::get_current(UseSimulatorCache, DisableBCCheck);
       
   749     sim->notifyCompile(name, i2c_entry);
       
   750   }
       
   751 #endif
       
   752   gen_i2c_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs);
   670   gen_i2c_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs);
   753 
   671 
   754   address c2i_unverified_entry = __ pc();
   672   address c2i_unverified_entry = __ pc();
   755   Label skip_fixup;
   673   Label skip_fixup;
   756 
   674 
   787     __ far_jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
   705     __ far_jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
   788     __ block_comment("} c2i_unverified_entry");
   706     __ block_comment("} c2i_unverified_entry");
   789   }
   707   }
   790 
   708 
   791   address c2i_entry = __ pc();
   709   address c2i_entry = __ pc();
   792 
       
   793 #ifdef BUILTIN_SIM
       
   794   if (name) {
       
   795     name[0] = 'c';
       
   796     name[2] = 'i';
       
   797     sim->notifyCompile(name, c2i_entry);
       
   798     FREE_C_HEAP_ARRAY(char, name, mtInternal);
       
   799   }
       
   800 #endif
       
   801 
   710 
   802   // Class initialization barrier for static methods
   711   // Class initialization barrier for static methods
   803   address c2i_no_clinit_check_entry = NULL;
   712   address c2i_no_clinit_check_entry = NULL;
   804   if (VM_Version::supports_fast_class_init_checks()) {
   713   if (VM_Version::supports_fast_class_init_checks()) {
   805     Label L_skip_barrier;
   714     Label L_skip_barrier;
  1217     __ far_call(RuntimeAddress(dest));
  1126     __ far_call(RuntimeAddress(dest));
  1218   } else {
  1127   } else {
  1219     assert((unsigned)gpargs < 256, "eek!");
  1128     assert((unsigned)gpargs < 256, "eek!");
  1220     assert((unsigned)fpargs < 32, "eek!");
  1129     assert((unsigned)fpargs < 32, "eek!");
  1221     __ lea(rscratch1, RuntimeAddress(dest));
  1130     __ lea(rscratch1, RuntimeAddress(dest));
  1222     if (UseBuiltinSim)   __ mov(rscratch2, (gpargs << 6) | (fpargs << 2) | type);
  1131     __ blr(rscratch1);
  1223     __ blrt(rscratch1, rscratch2);
       
  1224     __ maybe_isb();
  1132     __ maybe_isb();
  1225   }
  1133   }
  1226 }
  1134 }
  1227 
  1135 
  1228 static void verify_oop_args(MacroAssembler* masm,
  1136 static void verify_oop_args(MacroAssembler* masm,
  1339                                                 const methodHandle& method,
  1247                                                 const methodHandle& method,
  1340                                                 int compile_id,
  1248                                                 int compile_id,
  1341                                                 BasicType* in_sig_bt,
  1249                                                 BasicType* in_sig_bt,
  1342                                                 VMRegPair* in_regs,
  1250                                                 VMRegPair* in_regs,
  1343                                                 BasicType ret_type) {
  1251                                                 BasicType ret_type) {
  1344 #ifdef BUILTIN_SIM
       
  1345   if (NotifySimulator) {
       
  1346     // Names are up to 65536 chars long.  UTF8-coded strings are up to
       
  1347     // 3 bytes per character.  We concatenate three such strings.
       
  1348     // Yes, I know this is ridiculous, but it's debug code and glibc
       
  1349     // allocates large arrays very efficiently.
       
  1350     size_t len = (65536 * 3) * 3;
       
  1351     char *name = new char[len];
       
  1352 
       
  1353     strncpy(name, method()->method_holder()->name()->as_utf8(), len);
       
  1354     strncat(name, ".", len);
       
  1355     strncat(name, method()->name()->as_utf8(), len);
       
  1356     strncat(name, method()->signature()->as_utf8(), len);
       
  1357     AArch64Simulator::get_current(UseSimulatorCache, DisableBCCheck)->notifyCompile(name, __ pc());
       
  1358     delete[] name;
       
  1359   }
       
  1360 #endif
       
  1361 
       
  1362   if (method->is_method_handle_intrinsic()) {
  1252   if (method->is_method_handle_intrinsic()) {
  1363     vmIntrinsics::ID iid = method->intrinsic_id();
  1253     vmIntrinsics::ID iid = method->intrinsic_id();
  1364     intptr_t start = (intptr_t)__ pc();
  1254     intptr_t start = (intptr_t)__ pc();
  1365     int vep_offset = ((intptr_t)__ pc()) - start;
  1255     int vep_offset = ((intptr_t)__ pc()) - start;
  1366 
  1256 
  1621   __ sub(sp, sp, stack_size - 2*wordSize);
  1511   __ sub(sp, sp, stack_size - 2*wordSize);
  1622 
  1512 
  1623   // Frame is now completed as far as size and linkage.
  1513   // Frame is now completed as far as size and linkage.
  1624   int frame_complete = ((intptr_t)__ pc()) - start;
  1514   int frame_complete = ((intptr_t)__ pc()) - start;
  1625 
  1515 
  1626   // record entry into native wrapper code
       
  1627   if (NotifySimulator) {
       
  1628     __ notify(Assembler::method_entry);
       
  1629   }
       
  1630 
       
  1631   // We use r20 as the oop handle for the receiver/klass
  1516   // We use r20 as the oop handle for the receiver/klass
  1632   // It is callee save so it survives the call to native
  1517   // It is callee save so it survives the call to native
  1633 
  1518 
  1634   const Register oop_handle_reg = r20;
  1519   const Register oop_handle_reg = r20;
  1635 
  1520 
  2087     // Any exception pending?
  1972     // Any exception pending?
  2088     __ ldr(rscratch1, Address(rthread, in_bytes(Thread::pending_exception_offset())));
  1973     __ ldr(rscratch1, Address(rthread, in_bytes(Thread::pending_exception_offset())));
  2089     __ cbnz(rscratch1, exception_pending);
  1974     __ cbnz(rscratch1, exception_pending);
  2090   }
  1975   }
  2091 
  1976 
  2092   // record exit from native wrapper code
       
  2093   if (NotifySimulator) {
       
  2094     __ notify(Assembler::method_reentry);
       
  2095   }
       
  2096 
       
  2097   // We're done
  1977   // We're done
  2098   __ ret(lr);
  1978   __ ret(lr);
  2099 
  1979 
  2100   // Unexpected paths are out of line and go here
  1980   // Unexpected paths are out of line and go here
  2101 
  1981 
  2206     if (!is_critical_native) {
  2086     if (!is_critical_native) {
  2207       __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans)));
  2087       __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans)));
  2208     } else {
  2088     } else {
  2209       __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans_and_transition)));
  2089       __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans_and_transition)));
  2210     }
  2090     }
  2211     __ blrt(rscratch1, 1, 0, 1);
  2091     __ blr(rscratch1);
  2212     __ maybe_isb();
  2092     __ maybe_isb();
  2213     // Restore any method result value
  2093     // Restore any method result value
  2214     restore_native_result(masm, ret_type, stack_slots);
  2094     restore_native_result(masm, ret_type, stack_slots);
  2215 
  2095 
  2216     if (is_critical_native) {
  2096     if (is_critical_native) {
  2302   CodeBuffer buffer("deopt_blob", 2048+pad, 1024);
  2182   CodeBuffer buffer("deopt_blob", 2048+pad, 1024);
  2303   MacroAssembler* masm = new MacroAssembler(&buffer);
  2183   MacroAssembler* masm = new MacroAssembler(&buffer);
  2304   int frame_size_in_words;
  2184   int frame_size_in_words;
  2305   OopMap* map = NULL;
  2185   OopMap* map = NULL;
  2306   OopMapSet *oop_maps = new OopMapSet();
  2186   OopMapSet *oop_maps = new OopMapSet();
  2307 
       
  2308 #ifdef BUILTIN_SIM
       
  2309   AArch64Simulator *simulator;
       
  2310   if (NotifySimulator) {
       
  2311     simulator = AArch64Simulator::get_current(UseSimulatorCache, DisableBCCheck);
       
  2312     simulator->notifyCompile(const_cast<char*>("SharedRuntime::deopt_blob"), __ pc());
       
  2313   }
       
  2314 #endif
       
  2315 
  2187 
  2316   // -------------
  2188   // -------------
  2317   // This code enters when returning to a de-optimized nmethod.  A return
  2189   // This code enters when returning to a de-optimized nmethod.  A return
  2318   // address has been pushed on the the stack, and return values are in
  2190   // address has been pushed on the the stack, and return values are in
  2319   // registers.
  2191   // registers.
  2399     __ mov(c_rarg0, rthread);
  2271     __ mov(c_rarg0, rthread);
  2400     __ movw(c_rarg2, rcpool); // exec mode
  2272     __ movw(c_rarg2, rcpool); // exec mode
  2401     __ lea(rscratch1,
  2273     __ lea(rscratch1,
  2402            RuntimeAddress(CAST_FROM_FN_PTR(address,
  2274            RuntimeAddress(CAST_FROM_FN_PTR(address,
  2403                                            Deoptimization::uncommon_trap)));
  2275                                            Deoptimization::uncommon_trap)));
  2404     __ blrt(rscratch1, 2, 0, MacroAssembler::ret_type_integral);
  2276     __ blr(rscratch1);
  2405     __ bind(retaddr);
  2277     __ bind(retaddr);
  2406     oop_maps->add_gc_map( __ pc()-start, map->deep_copy());
  2278     oop_maps->add_gc_map( __ pc()-start, map->deep_copy());
  2407 
  2279 
  2408     __ reset_last_Java_frame(false);
  2280     __ reset_last_Java_frame(false);
  2409 
  2281 
  2491   }
  2363   }
  2492 #endif // ASSERT
  2364 #endif // ASSERT
  2493   __ mov(c_rarg0, rthread);
  2365   __ mov(c_rarg0, rthread);
  2494   __ mov(c_rarg1, rcpool);
  2366   __ mov(c_rarg1, rcpool);
  2495   __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info)));
  2367   __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info)));
  2496   __ blrt(rscratch1, 1, 0, 1);
  2368   __ blr(rscratch1);
  2497   __ bind(retaddr);
  2369   __ bind(retaddr);
  2498 
  2370 
  2499   // Need to have an oopmap that tells fetch_unroll_info where to
  2371   // Need to have an oopmap that tells fetch_unroll_info where to
  2500   // find any register it might need.
  2372   // find any register it might need.
  2501   oop_maps->add_gc_map(__ pc() - start, map);
  2373   oop_maps->add_gc_map(__ pc() - start, map);
  2631   __ set_last_Java_frame(sp, rfp, the_pc, rscratch1);
  2503   __ set_last_Java_frame(sp, rfp, the_pc, rscratch1);
  2632 
  2504 
  2633   __ mov(c_rarg0, rthread);
  2505   __ mov(c_rarg0, rthread);
  2634   __ movw(c_rarg1, rcpool); // second arg: exec_mode
  2506   __ movw(c_rarg1, rcpool); // second arg: exec_mode
  2635   __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames)));
  2507   __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames)));
  2636   __ blrt(rscratch1, 2, 0, 0);
  2508   __ blr(rscratch1);
  2637 
  2509 
  2638   // Set an oopmap for the call site
  2510   // Set an oopmap for the call site
  2639   // Use the same PC we used for the last java frame
  2511   // Use the same PC we used for the last java frame
  2640   oop_maps->add_gc_map(the_pc - start,
  2512   oop_maps->add_gc_map(the_pc - start,
  2641                        new OopMap( frame_size_in_words, 0 ));
  2513                        new OopMap( frame_size_in_words, 0 ));
  2662   _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset);
  2534   _deopt_blob->set_unpack_with_exception_in_tls_offset(exception_in_tls_offset);
  2663 #if INCLUDE_JVMCI
  2535 #if INCLUDE_JVMCI
  2664   if (EnableJVMCI || UseAOT) {
  2536   if (EnableJVMCI || UseAOT) {
  2665     _deopt_blob->set_uncommon_trap_offset(uncommon_trap_offset);
  2537     _deopt_blob->set_uncommon_trap_offset(uncommon_trap_offset);
  2666     _deopt_blob->set_implicit_exception_uncommon_trap_offset(implicit_exception_uncommon_trap_offset);
  2538     _deopt_blob->set_implicit_exception_uncommon_trap_offset(implicit_exception_uncommon_trap_offset);
  2667   }
       
  2668 #endif
       
  2669 #ifdef BUILTIN_SIM
       
  2670   if (NotifySimulator) {
       
  2671     unsigned char *base = _deopt_blob->code_begin();
       
  2672     simulator->notifyRelocate(start, base - start);
       
  2673   }
  2539   }
  2674 #endif
  2540 #endif
  2675 }
  2541 }
  2676 
  2542 
  2677 uint SharedRuntime::out_preserve_stack_slots() {
  2543 uint SharedRuntime::out_preserve_stack_slots() {
  2684   // Allocate space for the code
  2550   // Allocate space for the code
  2685   ResourceMark rm;
  2551   ResourceMark rm;
  2686   // Setup code generation tools
  2552   // Setup code generation tools
  2687   CodeBuffer buffer("uncommon_trap_blob", 2048, 1024);
  2553   CodeBuffer buffer("uncommon_trap_blob", 2048, 1024);
  2688   MacroAssembler* masm = new MacroAssembler(&buffer);
  2554   MacroAssembler* masm = new MacroAssembler(&buffer);
  2689 
       
  2690 #ifdef BUILTIN_SIM
       
  2691   AArch64Simulator *simulator;
       
  2692   if (NotifySimulator) {
       
  2693     simulator = AArch64Simulator::get_current(UseSimulatorCache, DisableBCCheck);
       
  2694     simulator->notifyCompile(const_cast<char*>("SharedRuntime:uncommon_trap_blob"), __ pc());
       
  2695   }
       
  2696 #endif
       
  2697 
  2555 
  2698   assert(SimpleRuntimeFrame::framesize % 4 == 0, "sp not 16-byte aligned");
  2556   assert(SimpleRuntimeFrame::framesize % 4 == 0, "sp not 16-byte aligned");
  2699 
  2557 
  2700   address start = __ pc();
  2558   address start = __ pc();
  2701 
  2559 
  2731   __ mov(c_rarg0, rthread);
  2589   __ mov(c_rarg0, rthread);
  2732   __ movw(c_rarg2, (unsigned)Deoptimization::Unpack_uncommon_trap);
  2590   __ movw(c_rarg2, (unsigned)Deoptimization::Unpack_uncommon_trap);
  2733   __ lea(rscratch1,
  2591   __ lea(rscratch1,
  2734          RuntimeAddress(CAST_FROM_FN_PTR(address,
  2592          RuntimeAddress(CAST_FROM_FN_PTR(address,
  2735                                          Deoptimization::uncommon_trap)));
  2593                                          Deoptimization::uncommon_trap)));
  2736   __ blrt(rscratch1, 2, 0, MacroAssembler::ret_type_integral);
  2594   __ blr(rscratch1);
  2737   __ bind(retaddr);
  2595   __ bind(retaddr);
  2738 
  2596 
  2739   // Set an oopmap for the call site
  2597   // Set an oopmap for the call site
  2740   OopMapSet* oop_maps = new OopMapSet();
  2598   OopMapSet* oop_maps = new OopMapSet();
  2741   OopMap* map = new OopMap(SimpleRuntimeFrame::framesize, 0);
  2599   OopMap* map = new OopMap(SimpleRuntimeFrame::framesize, 0);
  2854 
  2712 
  2855   // sp should already be aligned
  2713   // sp should already be aligned
  2856   __ mov(c_rarg0, rthread);
  2714   __ mov(c_rarg0, rthread);
  2857   __ movw(c_rarg1, (unsigned)Deoptimization::Unpack_uncommon_trap);
  2715   __ movw(c_rarg1, (unsigned)Deoptimization::Unpack_uncommon_trap);
  2858   __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames)));
  2716   __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames)));
  2859   __ blrt(rscratch1, 2, 0, MacroAssembler::ret_type_integral);
  2717   __ blr(rscratch1);
  2860 
  2718 
  2861   // Set an oopmap for the call site
  2719   // Set an oopmap for the call site
  2862   // Use the same PC we used for the last java frame
  2720   // Use the same PC we used for the last java frame
  2863   oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0));
  2721   oop_maps->add_gc_map(the_pc - start, new OopMap(SimpleRuntimeFrame::framesize, 0));
  2864 
  2722 
  2874   // Make sure all code is generated
  2732   // Make sure all code is generated
  2875   masm->flush();
  2733   masm->flush();
  2876 
  2734 
  2877   _uncommon_trap_blob =  UncommonTrapBlob::create(&buffer, oop_maps,
  2735   _uncommon_trap_blob =  UncommonTrapBlob::create(&buffer, oop_maps,
  2878                                                  SimpleRuntimeFrame::framesize >> 1);
  2736                                                  SimpleRuntimeFrame::framesize >> 1);
  2879 
       
  2880 #ifdef BUILTIN_SIM
       
  2881   if (NotifySimulator) {
       
  2882     unsigned char *base = _deopt_blob->code_begin();
       
  2883     simulator->notifyRelocate(start, base - start);
       
  2884   }
       
  2885 #endif
       
  2886 }
  2737 }
  2887 #endif // COMPILER2_OR_JVMCI
  2738 #endif // COMPILER2_OR_JVMCI
  2888 
  2739 
  2889 
  2740 
  2890 //------------------------------generate_handler_blob------
  2741 //------------------------------generate_handler_blob------
  2930   }
  2781   }
  2931 
  2782 
  2932   // Do the call
  2783   // Do the call
  2933   __ mov(c_rarg0, rthread);
  2784   __ mov(c_rarg0, rthread);
  2934   __ lea(rscratch1, RuntimeAddress(call_ptr));
  2785   __ lea(rscratch1, RuntimeAddress(call_ptr));
  2935   __ blrt(rscratch1, 1, 0, 1);
  2786   __ blr(rscratch1);
  2936   __ bind(retaddr);
  2787   __ bind(retaddr);
  2937 
  2788 
  2938   // Set an oopmap for the call site.  This oopmap will map all
  2789   // Set an oopmap for the call site.  This oopmap will map all
  2939   // oop-registers and debug-info registers as callee-saved.  This
  2790   // oop-registers and debug-info registers as callee-saved.  This
  2940   // will allow deoptimization at this safepoint to find all possible
  2791   // will allow deoptimization at this safepoint to find all possible
  3035     __ set_last_Java_frame(sp, noreg, retaddr, rscratch1);
  2886     __ set_last_Java_frame(sp, noreg, retaddr, rscratch1);
  3036 
  2887 
  3037     __ mov(c_rarg0, rthread);
  2888     __ mov(c_rarg0, rthread);
  3038     __ lea(rscratch1, RuntimeAddress(destination));
  2889     __ lea(rscratch1, RuntimeAddress(destination));
  3039 
  2890 
  3040     __ blrt(rscratch1, 1, 0, 1);
  2891     __ blr(rscratch1);
  3041     __ bind(retaddr);
  2892     __ bind(retaddr);
  3042   }
  2893   }
  3043 
  2894 
  3044   // Set an oopmap for the call site.
  2895   // Set an oopmap for the call site.
  3045   // We need this not only for callee-saved registers, but also for volatile
  2896   // We need this not only for callee-saved registers, but also for volatile
  3167   // the stack should always be aligned
  3018   // the stack should always be aligned
  3168   address the_pc = __ pc();
  3019   address the_pc = __ pc();
  3169   __ set_last_Java_frame(sp, noreg, the_pc, rscratch1);
  3020   __ set_last_Java_frame(sp, noreg, the_pc, rscratch1);
  3170   __ mov(c_rarg0, rthread);
  3021   __ mov(c_rarg0, rthread);
  3171   __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, OptoRuntime::handle_exception_C)));
  3022   __ lea(rscratch1, RuntimeAddress(CAST_FROM_FN_PTR(address, OptoRuntime::handle_exception_C)));
  3172   __ blrt(rscratch1, 1, 0, MacroAssembler::ret_type_integral);
  3023   __ blr(rscratch1);
  3173   __ maybe_isb();
  3024   __ maybe_isb();
  3174 
  3025 
  3175   // Set an oopmap for the call site.  This oopmap will only be used if we
  3026   // Set an oopmap for the call site.  This oopmap will only be used if we
  3176   // are unwinding the stack.  Hence, all locations will be dead.
  3027   // are unwinding the stack.  Hence, all locations will be dead.
  3177   // Callee-saved registers will be the same as the frame above (i.e.,
  3028   // Callee-saved registers will be the same as the frame above (i.e.,