< prev index next >

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp

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 #include "asm/macroAssembler.inline.hpp"
  27 #include "compiler/compiler_globals.hpp"
  28 #include "gc/shared/barrierSet.hpp"
  29 #include "gc/shared/barrierSetAssembler.hpp"
  30 #include "interp_masm_aarch64.hpp"
  31 #include "interpreter/interpreter.hpp"
  32 #include "interpreter/interpreterRuntime.hpp"
  33 #include "logging/log.hpp"
  34 #include "oops/arrayOop.hpp"

  35 #include "oops/markWord.hpp"
  36 #include "oops/method.hpp"
  37 #include "oops/methodData.hpp"

  38 #include "oops/resolvedFieldEntry.hpp"
  39 #include "oops/resolvedIndyEntry.hpp"
  40 #include "oops/resolvedMethodEntry.hpp"
  41 #include "prims/jvmtiExport.hpp"
  42 #include "prims/jvmtiThreadState.hpp"
  43 #include "runtime/basicLock.hpp"
  44 #include "runtime/frame.inline.hpp"
  45 #include "runtime/javaThread.hpp"
  46 #include "runtime/safepointMechanism.hpp"
  47 #include "runtime/sharedRuntime.hpp"
  48 #include "utilities/powerOfTwo.hpp"
  49 
  50 void InterpreterMacroAssembler::narrow(Register result) {
  51 
  52   // Get method->_constMethod->_result_type
  53   ldr(rscratch1, Address(rfp, frame::interpreter_frame_method_offset * wordSize));
  54   ldr(rscratch1, Address(rscratch1, Method::const_offset()));
  55   ldrb(rscratch1, Address(rscratch1, ConstMethod::result_type_offset()));
  56 
  57   Label done, notBool, notByte, notChar;

 191     ldrw(index, Address(rbcp, bcp_offset));
 192   } else if (index_size == sizeof(u1)) {
 193     load_unsigned_byte(index, Address(rbcp, bcp_offset));
 194   } else {
 195     ShouldNotReachHere();
 196   }
 197 }
 198 
 199 void InterpreterMacroAssembler::get_method_counters(Register method,
 200                                                     Register mcs, Label& skip) {
 201   Label has_counters;
 202   ldr(mcs, Address(method, Method::method_counters_offset()));
 203   cbnz(mcs, has_counters);
 204   call_VM(noreg, CAST_FROM_FN_PTR(address,
 205           InterpreterRuntime::build_method_counters), method);
 206   ldr(mcs, Address(method, Method::method_counters_offset()));
 207   cbz(mcs, skip); // No MethodCounters allocated, OutOfMemory
 208   bind(has_counters);
 209 }
 210 


































 211 // Load object from cpool->resolved_references(index)
 212 void InterpreterMacroAssembler::load_resolved_reference_at_index(
 213                                            Register result, Register index, Register tmp) {
 214   assert_different_registers(result, index);
 215 
 216   get_constant_pool(result);
 217   // load pointer for resolved_references[] objArray
 218   ldr(result, Address(result, ConstantPool::cache_offset()));
 219   ldr(result, Address(result, ConstantPoolCache::resolved_references_offset()));
 220   resolve_oop_handle(result, tmp, rscratch2);
 221   // Add in the index
 222   add(index, index, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop);
 223   load_heap_oop(result, Address(result, index, Address::uxtw(LogBytesPerHeapOop)), tmp, rscratch2);
 224 }
 225 
 226 void InterpreterMacroAssembler::load_resolved_klass_at_offset(
 227                              Register cpool, Register index, Register klass, Register temp) {
 228   add(temp, cpool, index, LSL, LogBytesPerWord);
 229   ldrh(temp, Address(temp, sizeof(ConstantPool))); // temp = resolved_klass_index
 230   ldr(klass, Address(cpool,  ConstantPool::resolved_klasses_offset())); // klass = cpool->_resolved_klasses
 231   add(klass, klass, temp, LSL, LogBytesPerWord);
 232   ldr(klass, Address(klass, Array<Klass*>::base_offset_in_bytes()));
 233 }
 234 
 235 // Generate a subtype check: branch to ok_is_subtype if sub_klass is a
 236 // subtype of super_klass.
 237 //
 238 // Args:
 239 //      r0: superklass
 240 //      Rsub_klass: subklass
 241 //
 242 // Kills:
 243 //      r2
 244 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
 245                                                   Label& ok_is_subtype) {

 246   assert(Rsub_klass != r0, "r0 holds superklass");
 247   assert(Rsub_klass != r2, "r2 holds 2ndary super array length");
 248 
 249   // Profile the not-null value's klass.
 250   profile_typecheck(r2, Rsub_klass); // blows r2
 251 

 252   // Do the check.
 253   check_klass_subtype(Rsub_klass, r0, r2, ok_is_subtype); // blows r2
 254 }
 255 
 256 // Java Expression Stack
 257 
 258 void InterpreterMacroAssembler::pop_ptr(Register r) {
 259   ldr(r, post(esp, wordSize));
 260 }
 261 
 262 void InterpreterMacroAssembler::pop_i(Register r) {
 263   ldrw(r, post(esp, wordSize));
 264 }
 265 
 266 void InterpreterMacroAssembler::pop_l(Register r) {
 267   ldr(r, post(esp, 2 * Interpreter::stackElementSize));
 268 }
 269 
 270 void InterpreterMacroAssembler::push_ptr(Register r) {
 271   str(r, pre(esp, -wordSize));

 641     cmpw(rscratch1, (u1)StackOverflow::stack_guard_enabled);
 642     br(Assembler::EQ, no_reserved_zone_enabling);
 643 
 644     // look for an overflow into the stack reserved zone, i.e.
 645     // interpreter_frame_sender_sp <= JavaThread::reserved_stack_activation
 646     ldr(rscratch1, Address(rthread, JavaThread::reserved_stack_activation_offset()));
 647     cmp(rscratch2, rscratch1);
 648     br(Assembler::LS, no_reserved_zone_enabling);
 649 
 650     JFR_ONLY(leave_jfr_critical_section();)
 651 
 652     call_VM_leaf(
 653       CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), rthread);
 654     call_VM(noreg, CAST_FROM_FN_PTR(address,
 655                    InterpreterRuntime::throw_delayed_StackOverflowError));
 656     should_not_reach_here();
 657 
 658     bind(no_reserved_zone_enabling);
 659   }
 660 































 661   // remove frame anchor
 662   leave();
 663 
 664   JFR_ONLY(leave_jfr_critical_section();)
 665 
 666   // restore sender esp
 667   mov(esp, rscratch2);
 668 
 669   // If we're returning to interpreted code we will shortly be
 670   // adjusting SP to allow some space for ESP.  If we're returning to
 671   // compiled code the saved sender SP was saved in sender_sp, so this
 672   // restores it.
 673   andr(sp, esp, -16);
 674 }
 675 
 676 #if INCLUDE_JFR
 677 void InterpreterMacroAssembler::enter_jfr_critical_section() {
 678   const Address sampling_critical_section(rthread, in_bytes(SAMPLING_CRITICAL_SECTION_OFFSET_JFR));
 679   mov(rscratch1, true);
 680   strb(rscratch1, sampling_critical_section);

 918 }
 919 
 920 
 921 void InterpreterMacroAssembler::profile_taken_branch(Register mdp) {
 922   if (ProfileInterpreter) {
 923     Label profile_continue;
 924 
 925     // If no method data exists, go to profile_continue.
 926     test_method_data_pointer(mdp, profile_continue);
 927 
 928     // We are taking a branch.  Increment the taken count.
 929     increment_mdp_data_at(mdp, in_bytes(JumpData::taken_offset()));
 930 
 931     // The method data pointer needs to be updated to reflect the new target.
 932     update_mdp_by_offset(mdp, in_bytes(JumpData::displacement_offset()));
 933     bind(profile_continue);
 934   }
 935 }
 936 
 937 
 938 void InterpreterMacroAssembler::profile_not_taken_branch(Register mdp) {
 939   if (ProfileInterpreter) {
 940     Label profile_continue;
 941 
 942     // If no method data exists, go to profile_continue.
 943     test_method_data_pointer(mdp, profile_continue);
 944 
 945     // We are not taking a branch.  Increment the not taken count.
 946     increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset()));
 947 
 948     // The method data pointer needs to be updated to correspond to
 949     // the next bytecode
 950     update_mdp_by_constant(mdp, in_bytes(BranchData::branch_data_size()));
 951     bind(profile_continue);
 952   }
 953 }
 954 
 955 
 956 void InterpreterMacroAssembler::profile_call(Register mdp) {
 957   if (ProfileInterpreter) {
 958     Label profile_continue;
 959 
 960     // If no method data exists, go to profile_continue.
 961     test_method_data_pointer(mdp, profile_continue);
 962 
 963     // We are making a call.  Increment the count.
 964     increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
 965 
 966     // The method data pointer needs to be updated to reflect the new target.
 967     update_mdp_by_constant(mdp, in_bytes(CounterData::counter_data_size()));
 968     bind(profile_continue);
 969   }
 970 }

1116     // case_array_offset_in_bytes()
1117     movw(reg2, in_bytes(MultiBranchData::per_case_size()));
1118     movw(rscratch1, in_bytes(MultiBranchData::case_array_offset()));
1119     Assembler::maddw(index, index, reg2, rscratch1);
1120 
1121     // Update the case count
1122     increment_mdp_data_at(mdp,
1123                           index,
1124                           in_bytes(MultiBranchData::relative_count_offset()));
1125 
1126     // The method data pointer needs to be updated.
1127     update_mdp_by_offset(mdp,
1128                          index,
1129                          in_bytes(MultiBranchData::
1130                                   relative_displacement_offset()));
1131 
1132     bind(profile_continue);
1133   }
1134 }
1135 


















































































































1136 void InterpreterMacroAssembler::_interp_verify_oop(Register reg, TosState state, const char* file, int line) {
1137   if (state == atos) {
1138     MacroAssembler::_verify_oop_checked(reg, "broken oop", file, line);
1139   }
1140 }
1141 
1142 void InterpreterMacroAssembler::notify_method_entry() {
1143   // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
1144   // track stack depth.  If it is possible to enter interp_only_mode we add
1145   // the code to check if the event should be sent.
1146   if (JvmtiExport::can_post_interpreter_events()) {
1147     Label L;
1148     ldrw(r3, Address(rthread, JavaThread::interp_only_mode_offset()));
1149     cbzw(r3, L);
1150     call_VM(noreg, CAST_FROM_FN_PTR(address,
1151                                     InterpreterRuntime::post_method_entry));
1152     bind(L);
1153   }
1154 
1155   if (DTraceMethodProbes) {

1479         profile_obj_type(tmp, mdo_arg_addr);
1480 
1481         int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1482         off_to_args += to_add;
1483       }
1484 
1485       if (MethodData::profile_return()) {
1486         ldr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())));
1487         sub(tmp, tmp, TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1488       }
1489 
1490       add(rscratch1, mdp, off_to_args);
1491       bind(done);
1492       mov(mdp, rscratch1);
1493 
1494       if (MethodData::profile_return()) {
1495         // We're right after the type profile for the last
1496         // argument. tmp is the number of cells left in the
1497         // CallTypeData/VirtualCallTypeData to reach its end. Non null
1498         // if there's a return to profile.
1499         assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(), "can't move past ret type");
1500         add(mdp, mdp, tmp, LSL, exact_log2(DataLayout::cell_size));
1501       }
1502       str(mdp, Address(rfp, frame::interpreter_frame_mdp_offset * wordSize));
1503     } else {
1504       assert(MethodData::profile_return(), "either profile call args or call ret");
1505       update_mdp_by_constant(mdp, in_bytes(TypeEntriesAtCall::return_only_size()));
1506     }
1507 
1508     // mdp points right after the end of the
1509     // CallTypeData/VirtualCallTypeData, right after the cells for the
1510     // return value type if there's one
1511 
1512     bind(profile_continue);
1513   }
1514 }
1515 
1516 void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) {
1517   assert_different_registers(mdp, ret, tmp, rbcp);
1518   if (ProfileInterpreter && MethodData::profile_return()) {
1519     Label profile_continue, done;

1525 
1526       // If we don't profile all invoke bytecodes we must make sure
1527       // it's a bytecode we indeed profile. We can't go back to the
1528       // beginning of the ProfileData we intend to update to check its
1529       // type because we're right after it and we don't known its
1530       // length
1531       Label do_profile;
1532       ldrb(rscratch1, Address(rbcp, 0));
1533       cmp(rscratch1, (u1)Bytecodes::_invokedynamic);
1534       br(Assembler::EQ, do_profile);
1535       cmp(rscratch1, (u1)Bytecodes::_invokehandle);
1536       br(Assembler::EQ, do_profile);
1537       get_method(tmp);
1538       ldrh(rscratch1, Address(tmp, Method::intrinsic_id_offset()));
1539       subs(zr, rscratch1, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1540       br(Assembler::NE, profile_continue);
1541 
1542       bind(do_profile);
1543     }
1544 
1545     Address mdo_ret_addr(mdp, -in_bytes(ReturnTypeEntry::size()));
1546     mov(tmp, ret);
1547     profile_obj_type(tmp, mdo_ret_addr);
1548 
1549     bind(profile_continue);
1550   }
1551 }
1552 
1553 void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2) {
1554   assert_different_registers(rscratch1, rscratch2, mdp, tmp1, tmp2);
1555   if (ProfileInterpreter && MethodData::profile_parameters()) {
1556     Label profile_continue, done;
1557 
1558     test_method_data_pointer(mdp, profile_continue);
1559 
1560     // Load the offset of the area within the MDO used for
1561     // parameters. If it's negative we're not profiling any parameters
1562     ldrw(tmp1, Address(mdp, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset())));
1563     tbnz(tmp1, 31, profile_continue);  // i.e. sign bit set
1564 
1565     // Compute a pointer to the area for parameters from the offset

  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 #include "asm/macroAssembler.inline.hpp"
  27 #include "compiler/compiler_globals.hpp"
  28 #include "gc/shared/barrierSet.hpp"
  29 #include "gc/shared/barrierSetAssembler.hpp"
  30 #include "interp_masm_aarch64.hpp"
  31 #include "interpreter/interpreter.hpp"
  32 #include "interpreter/interpreterRuntime.hpp"
  33 #include "logging/log.hpp"
  34 #include "oops/arrayOop.hpp"
  35 #include "oops/constMethodFlags.hpp"
  36 #include "oops/markWord.hpp"
  37 #include "oops/method.hpp"
  38 #include "oops/methodData.hpp"
  39 #include "oops/inlineKlass.hpp"
  40 #include "oops/resolvedFieldEntry.hpp"
  41 #include "oops/resolvedIndyEntry.hpp"
  42 #include "oops/resolvedMethodEntry.hpp"
  43 #include "prims/jvmtiExport.hpp"
  44 #include "prims/jvmtiThreadState.hpp"
  45 #include "runtime/basicLock.hpp"
  46 #include "runtime/frame.inline.hpp"
  47 #include "runtime/javaThread.hpp"
  48 #include "runtime/safepointMechanism.hpp"
  49 #include "runtime/sharedRuntime.hpp"
  50 #include "utilities/powerOfTwo.hpp"
  51 
  52 void InterpreterMacroAssembler::narrow(Register result) {
  53 
  54   // Get method->_constMethod->_result_type
  55   ldr(rscratch1, Address(rfp, frame::interpreter_frame_method_offset * wordSize));
  56   ldr(rscratch1, Address(rscratch1, Method::const_offset()));
  57   ldrb(rscratch1, Address(rscratch1, ConstMethod::result_type_offset()));
  58 
  59   Label done, notBool, notByte, notChar;

 193     ldrw(index, Address(rbcp, bcp_offset));
 194   } else if (index_size == sizeof(u1)) {
 195     load_unsigned_byte(index, Address(rbcp, bcp_offset));
 196   } else {
 197     ShouldNotReachHere();
 198   }
 199 }
 200 
 201 void InterpreterMacroAssembler::get_method_counters(Register method,
 202                                                     Register mcs, Label& skip) {
 203   Label has_counters;
 204   ldr(mcs, Address(method, Method::method_counters_offset()));
 205   cbnz(mcs, has_counters);
 206   call_VM(noreg, CAST_FROM_FN_PTR(address,
 207           InterpreterRuntime::build_method_counters), method);
 208   ldr(mcs, Address(method, Method::method_counters_offset()));
 209   cbz(mcs, skip); // No MethodCounters allocated, OutOfMemory
 210   bind(has_counters);
 211 }
 212 
 213 void InterpreterMacroAssembler::read_flat_field(Register entry, Register obj) {
 214   call_VM(obj, CAST_FROM_FN_PTR(address, InterpreterRuntime::read_flat_field), obj, entry);
 215   membar(Assembler::StoreStore);
 216 }
 217 
 218 void InterpreterMacroAssembler::write_flat_field(Register entry, Register field_offset,
 219                                                  Register tmp1, Register tmp2,
 220                                                  Register obj) {
 221   assert_different_registers(entry, field_offset, tmp1, tmp2, obj);
 222   Label slow_path, done;
 223 
 224   load_unsigned_byte(tmp1, Address(entry, in_bytes(ResolvedFieldEntry::flags_offset())));
 225   test_field_is_not_null_free_inline_type(tmp1, noreg /* temp */, slow_path);
 226 
 227   null_check(r0); // FIXME JDK-8341120
 228 
 229   add(obj, obj, field_offset);
 230 
 231   load_klass(tmp1, r0);
 232   payload_address(r0, r0, tmp1);
 233 
 234   Register layout_info = field_offset;
 235   load_unsigned_short(tmp1, Address(entry, in_bytes(ResolvedFieldEntry::field_index_offset())));
 236   ldr(tmp2, Address(entry, in_bytes(ResolvedFieldEntry::field_holder_offset())));
 237   inline_layout_info(tmp2, tmp1, layout_info);
 238 
 239   flat_field_copy(IN_HEAP, r0, obj, layout_info);
 240   b(done);
 241 
 242   bind(slow_path);
 243   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::write_flat_field), obj, r0, entry);
 244   bind(done);
 245 }
 246 
 247 // Load object from cpool->resolved_references(index)
 248 void InterpreterMacroAssembler::load_resolved_reference_at_index(
 249                                            Register result, Register index, Register tmp) {
 250   assert_different_registers(result, index);
 251 
 252   get_constant_pool(result);
 253   // load pointer for resolved_references[] objArray
 254   ldr(result, Address(result, ConstantPool::cache_offset()));
 255   ldr(result, Address(result, ConstantPoolCache::resolved_references_offset()));
 256   resolve_oop_handle(result, tmp, rscratch2);
 257   // Add in the index
 258   add(index, index, arrayOopDesc::base_offset_in_bytes(T_OBJECT) >> LogBytesPerHeapOop);
 259   load_heap_oop(result, Address(result, index, Address::uxtw(LogBytesPerHeapOop)), tmp, rscratch2);
 260 }
 261 
 262 void InterpreterMacroAssembler::load_resolved_klass_at_offset(
 263                              Register cpool, Register index, Register klass, Register temp) {
 264   add(temp, cpool, index, LSL, LogBytesPerWord);
 265   ldrh(temp, Address(temp, sizeof(ConstantPool))); // temp = resolved_klass_index
 266   ldr(klass, Address(cpool,  ConstantPool::resolved_klasses_offset())); // klass = cpool->_resolved_klasses
 267   add(klass, klass, temp, LSL, LogBytesPerWord);
 268   ldr(klass, Address(klass, Array<Klass*>::base_offset_in_bytes()));
 269 }
 270 
 271 // Generate a subtype check: branch to ok_is_subtype if sub_klass is a
 272 // subtype of super_klass.
 273 //
 274 // Args:
 275 //      r0: superklass
 276 //      Rsub_klass: subklass
 277 //
 278 // Kills:
 279 //      r2
 280 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass,
 281                                                   Label& ok_is_subtype,
 282                                                   bool profile) {
 283   assert(Rsub_klass != r0, "r0 holds superklass");
 284   assert(Rsub_klass != r2, "r2 holds 2ndary super array length");
 285 
 286   // Profile the not-null value's klass.
 287   if (profile) {
 288     profile_typecheck(r2, Rsub_klass); // blows r2
 289   }
 290   // Do the check.
 291   check_klass_subtype(Rsub_klass, r0, r2, ok_is_subtype); // blows r2
 292 }
 293 
 294 // Java Expression Stack
 295 
 296 void InterpreterMacroAssembler::pop_ptr(Register r) {
 297   ldr(r, post(esp, wordSize));
 298 }
 299 
 300 void InterpreterMacroAssembler::pop_i(Register r) {
 301   ldrw(r, post(esp, wordSize));
 302 }
 303 
 304 void InterpreterMacroAssembler::pop_l(Register r) {
 305   ldr(r, post(esp, 2 * Interpreter::stackElementSize));
 306 }
 307 
 308 void InterpreterMacroAssembler::push_ptr(Register r) {
 309   str(r, pre(esp, -wordSize));

 679     cmpw(rscratch1, (u1)StackOverflow::stack_guard_enabled);
 680     br(Assembler::EQ, no_reserved_zone_enabling);
 681 
 682     // look for an overflow into the stack reserved zone, i.e.
 683     // interpreter_frame_sender_sp <= JavaThread::reserved_stack_activation
 684     ldr(rscratch1, Address(rthread, JavaThread::reserved_stack_activation_offset()));
 685     cmp(rscratch2, rscratch1);
 686     br(Assembler::LS, no_reserved_zone_enabling);
 687 
 688     JFR_ONLY(leave_jfr_critical_section();)
 689 
 690     call_VM_leaf(
 691       CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), rthread);
 692     call_VM(noreg, CAST_FROM_FN_PTR(address,
 693                    InterpreterRuntime::throw_delayed_StackOverflowError));
 694     should_not_reach_here();
 695 
 696     bind(no_reserved_zone_enabling);
 697   }
 698 
 699   if (state == atos && InlineTypeReturnedAsFields) {
 700     Label skip;
 701     Label not_null;
 702     cbnz(r0, not_null);
 703     // Returned value is null, zero all return registers because they may belong to oop fields
 704     mov(j_rarg1, zr);
 705     mov(j_rarg2, zr);
 706     mov(j_rarg3, zr);
 707     mov(j_rarg4, zr);
 708     mov(j_rarg5, zr);
 709     mov(j_rarg6, zr);
 710     mov(j_rarg7, zr);
 711     b(skip);
 712     bind(not_null);
 713 
 714     // Check if we are returning a non-null inline type and load its fields into registers
 715     test_oop_is_not_inline_type(r0, rscratch2, skip, /* can_be_null= */ false);
 716 
 717     // Load fields from a buffered value with an inline class specific handler
 718     load_klass(rscratch1 /*dst*/, r0 /*src*/);
 719     ldr(rscratch1, Address(rscratch1, InlineKlass::adr_members_offset()));
 720     ldr(rscratch1, Address(rscratch1, InlineKlass::unpack_handler_offset()));
 721     // Unpack handler can be null if inline type is not scalarizable in returns
 722     cbz(rscratch1, skip);
 723 
 724     blr(rscratch1);
 725     bind(skip);
 726     // Check above kills sender esp in rscratch2. Reload it.
 727     ldr(rscratch2, Address(rfp, frame::interpreter_frame_sender_sp_offset * wordSize));
 728   }
 729 
 730   // remove frame anchor
 731   leave();
 732 
 733   JFR_ONLY(leave_jfr_critical_section();)
 734 
 735   // restore sender esp
 736   mov(esp, rscratch2);
 737 
 738   // If we're returning to interpreted code we will shortly be
 739   // adjusting SP to allow some space for ESP.  If we're returning to
 740   // compiled code the saved sender SP was saved in sender_sp, so this
 741   // restores it.
 742   andr(sp, esp, -16);
 743 }
 744 
 745 #if INCLUDE_JFR
 746 void InterpreterMacroAssembler::enter_jfr_critical_section() {
 747   const Address sampling_critical_section(rthread, in_bytes(SAMPLING_CRITICAL_SECTION_OFFSET_JFR));
 748   mov(rscratch1, true);
 749   strb(rscratch1, sampling_critical_section);

 987 }
 988 
 989 
 990 void InterpreterMacroAssembler::profile_taken_branch(Register mdp) {
 991   if (ProfileInterpreter) {
 992     Label profile_continue;
 993 
 994     // If no method data exists, go to profile_continue.
 995     test_method_data_pointer(mdp, profile_continue);
 996 
 997     // We are taking a branch.  Increment the taken count.
 998     increment_mdp_data_at(mdp, in_bytes(JumpData::taken_offset()));
 999 
1000     // The method data pointer needs to be updated to reflect the new target.
1001     update_mdp_by_offset(mdp, in_bytes(JumpData::displacement_offset()));
1002     bind(profile_continue);
1003   }
1004 }
1005 
1006 
1007 void InterpreterMacroAssembler::profile_not_taken_branch(Register mdp, bool acmp) {
1008   if (ProfileInterpreter) {
1009     Label profile_continue;
1010 
1011     // If no method data exists, go to profile_continue.
1012     test_method_data_pointer(mdp, profile_continue);
1013 
1014     // We are not taking a branch.  Increment the not taken count.
1015     increment_mdp_data_at(mdp, in_bytes(BranchData::not_taken_offset()));
1016 
1017     // The method data pointer needs to be updated to correspond to
1018     // the next bytecode
1019     update_mdp_by_constant(mdp, acmp ? in_bytes(ACmpData::acmp_data_size()) : in_bytes(BranchData::branch_data_size()));
1020     bind(profile_continue);
1021   }
1022 }
1023 
1024 
1025 void InterpreterMacroAssembler::profile_call(Register mdp) {
1026   if (ProfileInterpreter) {
1027     Label profile_continue;
1028 
1029     // If no method data exists, go to profile_continue.
1030     test_method_data_pointer(mdp, profile_continue);
1031 
1032     // We are making a call.  Increment the count.
1033     increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset()));
1034 
1035     // The method data pointer needs to be updated to reflect the new target.
1036     update_mdp_by_constant(mdp, in_bytes(CounterData::counter_data_size()));
1037     bind(profile_continue);
1038   }
1039 }

1185     // case_array_offset_in_bytes()
1186     movw(reg2, in_bytes(MultiBranchData::per_case_size()));
1187     movw(rscratch1, in_bytes(MultiBranchData::case_array_offset()));
1188     Assembler::maddw(index, index, reg2, rscratch1);
1189 
1190     // Update the case count
1191     increment_mdp_data_at(mdp,
1192                           index,
1193                           in_bytes(MultiBranchData::relative_count_offset()));
1194 
1195     // The method data pointer needs to be updated.
1196     update_mdp_by_offset(mdp,
1197                          index,
1198                          in_bytes(MultiBranchData::
1199                                   relative_displacement_offset()));
1200 
1201     bind(profile_continue);
1202   }
1203 }
1204 
1205 template <class ArrayData> void InterpreterMacroAssembler::profile_array_type(Register mdp,
1206                                                                               Register array,
1207                                                                               Register tmp) {
1208   if (ProfileInterpreter) {
1209     Label profile_continue;
1210 
1211     // If no method data exists, go to profile_continue.
1212     test_method_data_pointer(mdp, profile_continue);
1213 
1214     mov(tmp, array);
1215     profile_obj_type(tmp, Address(mdp, in_bytes(ArrayData::array_offset())));
1216 
1217     Label not_flat;
1218     test_non_flat_array_oop(array, tmp, not_flat);
1219 
1220     set_mdp_flag_at(mdp, ArrayData::flat_array_byte_constant());
1221 
1222     bind(not_flat);
1223 
1224     Label not_null_free;
1225     test_non_null_free_array_oop(array, tmp, not_null_free);
1226 
1227     set_mdp_flag_at(mdp, ArrayData::null_free_array_byte_constant());
1228 
1229     bind(not_null_free);
1230 
1231     bind(profile_continue);
1232   }
1233 }
1234 
1235 template void InterpreterMacroAssembler::profile_array_type<ArrayLoadData>(Register mdp,
1236                                                                            Register array,
1237                                                                            Register tmp);
1238 template void InterpreterMacroAssembler::profile_array_type<ArrayStoreData>(Register mdp,
1239                                                                             Register array,
1240                                                                             Register tmp);
1241 
1242 void InterpreterMacroAssembler::profile_multiple_element_types(Register mdp, Register element, Register tmp, const Register tmp2) {
1243   if (ProfileInterpreter) {
1244     Label profile_continue;
1245 
1246     // If no method data exists, go to profile_continue.
1247     test_method_data_pointer(mdp, profile_continue);
1248 
1249     Label done, update;
1250     cbnz(element, update);
1251     set_mdp_flag_at(mdp, BitData::null_seen_byte_constant());
1252     b(done);
1253 
1254     bind(update);
1255     load_klass(tmp, element);
1256 
1257     // Record the object type.
1258     profile_receiver_type(tmp, mdp, 0);
1259 
1260     bind(done);
1261 
1262     // The method data pointer needs to be updated.
1263     update_mdp_by_constant(mdp, in_bytes(ArrayStoreData::array_store_data_size()));
1264 
1265     bind(profile_continue);
1266   }
1267 }
1268 
1269 
1270 void InterpreterMacroAssembler::profile_element_type(Register mdp,
1271                                                      Register element,
1272                                                      Register tmp) {
1273   if (ProfileInterpreter) {
1274     Label profile_continue;
1275 
1276     // If no method data exists, go to profile_continue.
1277     test_method_data_pointer(mdp, profile_continue);
1278 
1279     mov(tmp, element);
1280     profile_obj_type(tmp, Address(mdp, in_bytes(ArrayLoadData::element_offset())));
1281 
1282     // The method data pointer needs to be updated.
1283     update_mdp_by_constant(mdp, in_bytes(ArrayLoadData::array_load_data_size()));
1284 
1285     bind(profile_continue);
1286   }
1287 }
1288 
1289 void InterpreterMacroAssembler::profile_acmp(Register mdp,
1290                                              Register left,
1291                                              Register right,
1292                                              Register tmp) {
1293   if (ProfileInterpreter) {
1294     Label profile_continue;
1295 
1296     // If no method data exists, go to profile_continue.
1297     test_method_data_pointer(mdp, profile_continue);
1298 
1299     mov(tmp, left);
1300     profile_obj_type(tmp, Address(mdp, in_bytes(ACmpData::left_offset())));
1301 
1302     Label left_not_inline_type;
1303     test_oop_is_not_inline_type(left, tmp, left_not_inline_type);
1304     set_mdp_flag_at(mdp, ACmpData::left_inline_type_byte_constant());
1305     bind(left_not_inline_type);
1306 
1307     mov(tmp, right);
1308     profile_obj_type(tmp, Address(mdp, in_bytes(ACmpData::right_offset())));
1309 
1310     Label right_not_inline_type;
1311     test_oop_is_not_inline_type(right, tmp, right_not_inline_type);
1312     set_mdp_flag_at(mdp, ACmpData::right_inline_type_byte_constant());
1313     bind(right_not_inline_type);
1314 
1315     bind(profile_continue);
1316   }
1317 }
1318 
1319 void InterpreterMacroAssembler::_interp_verify_oop(Register reg, TosState state, const char* file, int line) {
1320   if (state == atos) {
1321     MacroAssembler::_verify_oop_checked(reg, "broken oop", file, line);
1322   }
1323 }
1324 
1325 void InterpreterMacroAssembler::notify_method_entry() {
1326   // Whenever JVMTI is interp_only_mode, method entry/exit events are sent to
1327   // track stack depth.  If it is possible to enter interp_only_mode we add
1328   // the code to check if the event should be sent.
1329   if (JvmtiExport::can_post_interpreter_events()) {
1330     Label L;
1331     ldrw(r3, Address(rthread, JavaThread::interp_only_mode_offset()));
1332     cbzw(r3, L);
1333     call_VM(noreg, CAST_FROM_FN_PTR(address,
1334                                     InterpreterRuntime::post_method_entry));
1335     bind(L);
1336   }
1337 
1338   if (DTraceMethodProbes) {

1662         profile_obj_type(tmp, mdo_arg_addr);
1663 
1664         int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1665         off_to_args += to_add;
1666       }
1667 
1668       if (MethodData::profile_return()) {
1669         ldr(tmp, Address(mdp, in_bytes(TypeEntriesAtCall::cell_count_offset())));
1670         sub(tmp, tmp, TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1671       }
1672 
1673       add(rscratch1, mdp, off_to_args);
1674       bind(done);
1675       mov(mdp, rscratch1);
1676 
1677       if (MethodData::profile_return()) {
1678         // We're right after the type profile for the last
1679         // argument. tmp is the number of cells left in the
1680         // CallTypeData/VirtualCallTypeData to reach its end. Non null
1681         // if there's a return to profile.
1682         assert(SingleTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(), "can't move past ret type");
1683         add(mdp, mdp, tmp, LSL, exact_log2(DataLayout::cell_size));
1684       }
1685       str(mdp, Address(rfp, frame::interpreter_frame_mdp_offset * wordSize));
1686     } else {
1687       assert(MethodData::profile_return(), "either profile call args or call ret");
1688       update_mdp_by_constant(mdp, in_bytes(TypeEntriesAtCall::return_only_size()));
1689     }
1690 
1691     // mdp points right after the end of the
1692     // CallTypeData/VirtualCallTypeData, right after the cells for the
1693     // return value type if there's one
1694 
1695     bind(profile_continue);
1696   }
1697 }
1698 
1699 void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) {
1700   assert_different_registers(mdp, ret, tmp, rbcp);
1701   if (ProfileInterpreter && MethodData::profile_return()) {
1702     Label profile_continue, done;

1708 
1709       // If we don't profile all invoke bytecodes we must make sure
1710       // it's a bytecode we indeed profile. We can't go back to the
1711       // beginning of the ProfileData we intend to update to check its
1712       // type because we're right after it and we don't known its
1713       // length
1714       Label do_profile;
1715       ldrb(rscratch1, Address(rbcp, 0));
1716       cmp(rscratch1, (u1)Bytecodes::_invokedynamic);
1717       br(Assembler::EQ, do_profile);
1718       cmp(rscratch1, (u1)Bytecodes::_invokehandle);
1719       br(Assembler::EQ, do_profile);
1720       get_method(tmp);
1721       ldrh(rscratch1, Address(tmp, Method::intrinsic_id_offset()));
1722       subs(zr, rscratch1, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1723       br(Assembler::NE, profile_continue);
1724 
1725       bind(do_profile);
1726     }
1727 
1728     Address mdo_ret_addr(mdp, -in_bytes(SingleTypeEntry::size()));
1729     mov(tmp, ret);
1730     profile_obj_type(tmp, mdo_ret_addr);
1731 
1732     bind(profile_continue);
1733   }
1734 }
1735 
1736 void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2) {
1737   assert_different_registers(rscratch1, rscratch2, mdp, tmp1, tmp2);
1738   if (ProfileInterpreter && MethodData::profile_parameters()) {
1739     Label profile_continue, done;
1740 
1741     test_method_data_pointer(mdp, profile_continue);
1742 
1743     // Load the offset of the area within the MDO used for
1744     // parameters. If it's negative we're not profiling any parameters
1745     ldrw(tmp1, Address(mdp, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset())));
1746     tbnz(tmp1, 31, profile_continue);  // i.e. sign bit set
1747 
1748     // Compute a pointer to the area for parameters from the offset
< prev index next >