538 // int value = *(Rcpool->int_at_addr(which));
539 // int resolved_klass_index = extract_low_short_from_int(value);
540 add(Roffset, Rcpool, Roffset);
541 #if defined(VM_LITTLE_ENDIAN)
542 lhz(Roffset, sizeof(ConstantPool), Roffset); // Roffset = resolved_klass_index
543 #else
544 lhz(Roffset, sizeof(ConstantPool) + 2, Roffset); // Roffset = resolved_klass_index
545 #endif
546
547 ld(Rklass, ConstantPool::resolved_klasses_offset(), Rcpool); // Rklass = Rcpool->_resolved_klasses
548
549 sldi(Roffset, Roffset, LogBytesPerWord);
550 addi(Roffset, Roffset, Array<Klass*>::base_offset_in_bytes());
551 isync(); // Order load of instance Klass wrt. tags.
552 ldx(Rklass, Rklass, Roffset);
553 }
554
555 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
556 // a subtype of super_klass. Blows registers Rsub_klass, tmp1, tmp2.
557 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, Register Rsuper_klass, Register Rtmp1,
558 Register Rtmp2, Register Rtmp3, Label &ok_is_subtype) {
559 // Profile the not-null value's klass.
560 profile_typecheck(Rsub_klass, Rtmp1, Rtmp2);
561 check_klass_subtype(Rsub_klass, Rsuper_klass, Rtmp1, Rtmp2, ok_is_subtype);
562 }
563
564 // Separate these two to allow for delay slot in middle.
565 // These are used to do a test and full jump to exception-throwing code.
566
567 // Check that index is in range for array, then shift index by index_shift,
568 // and put arrayOop + shifted_index into res.
569 // Note: res is still shy of address by array offset into object.
570
571 void InterpreterMacroAssembler::index_check_without_pop(Register Rarray, Register Rindex,
572 int index_shift, Register Rtmp, Register Rres) {
573 // Check that index is in range for array, then shift index by index_shift,
574 // and put arrayOop + shifted_index into res.
575 // Note: res is still shy of address by array offset into object.
576 // Kills:
577 // - Rindex
578 // Writes:
579 // - Rres: Address that corresponds to the array index if check was successful.
580 verify_oop(Rarray);
904
905 // Compare frame pointers. There is no good stack pointer, as with stack
906 // frame compression we can get different SPs when we do calls. A subsequent
907 // call could have a smaller SP, so that this compare succeeds for an
908 // inner call of the method annotated with ReservedStack.
909 ld_ptr(R0, JavaThread::reserved_stack_activation_offset(), R16_thread);
910 cmpld(CR0, fp, R0);
911 blt_predict_taken(CR0, no_reserved_zone_enabling);
912
913 JFR_ONLY(leave_jfr_critical_section();)
914
915 // Enable reserved zone again, throw stack overflow exception.
916 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), R16_thread);
917 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_delayed_StackOverflowError));
918
919 should_not_reach_here();
920
921 bind(no_reserved_zone_enabling);
922 }
923
924 verify_oop(R17_tos, state);
925
926 remove_top_frame_given_fp(fp, R21_sender_SP, R23_tmp3, /*return_pc*/ R0, R11_scratch1);
927 mtlr(R0);
928 pop_cont_fastpath();
929 JFR_ONLY(leave_jfr_critical_section();)
930
931 BLOCK_COMMENT("} remove_activation");
932 }
933
934 #if INCLUDE_JFR
935 void InterpreterMacroAssembler::enter_jfr_critical_section() {
936 li(R0, 1);
937 stb(R0, in_bytes(SAMPLING_CRITICAL_SECTION_OFFSET_JFR), R16_thread);
938 }
939
940 void InterpreterMacroAssembler::leave_jfr_critical_section() {
941 li(R0, 0);
942 stb(R0, in_bytes(SAMPLING_CRITICAL_SECTION_OFFSET_JFR), R16_thread);
943 }
1269 }
1270
1271 // Count a taken branch in the bytecodes.
1272 void InterpreterMacroAssembler::profile_taken_branch(Register scratch, Register bumped_count) {
1273 if (ProfileInterpreter) {
1274 Label profile_continue;
1275
1276 // If no method data exists, go to profile_continue.
1277 test_method_data_pointer(profile_continue);
1278
1279 // We are taking a branch. Increment the taken count.
1280 increment_mdp_data_at(in_bytes(JumpData::taken_offset()), scratch, bumped_count);
1281
1282 // The method data pointer needs to be updated to reflect the new target.
1283 update_mdp_by_offset(in_bytes(JumpData::displacement_offset()), scratch);
1284 bind (profile_continue);
1285 }
1286 }
1287
1288 // Count a not-taken branch in the bytecodes.
1289 void InterpreterMacroAssembler::profile_not_taken_branch(Register scratch1, Register scratch2) {
1290 if (ProfileInterpreter) {
1291 Label profile_continue;
1292
1293 // If no method data exists, go to profile_continue.
1294 test_method_data_pointer(profile_continue);
1295
1296 // We are taking a branch. Increment the not taken count.
1297 increment_mdp_data_at(in_bytes(BranchData::not_taken_offset()), scratch1, scratch2);
1298
1299 // The method data pointer needs to be updated to correspond to the
1300 // next bytecode.
1301 update_mdp_by_constant(in_bytes(BranchData::branch_data_size()));
1302 bind (profile_continue);
1303 }
1304 }
1305
1306 // Count a non-virtual call in the bytecodes.
1307 void InterpreterMacroAssembler::profile_call(Register scratch1, Register scratch2) {
1308 if (ProfileInterpreter) {
1309 Label profile_continue;
1310
1311 // If no method data exists, go to profile_continue.
1312 test_method_data_pointer(profile_continue);
1313
1314 // We are making a call. Increment the count.
1315 increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2);
1316
1317 // The method data pointer needs to be updated to reflect the new target.
1318 update_mdp_by_constant(in_bytes(CounterData::counter_data_size()));
1319 bind (profile_continue);
1320 }
1321 }
1443 // If no method data exists, go to profile_continue.
1444 test_method_data_pointer(profile_continue);
1445
1446 // Build the base (index * per_case_size_in_bytes()) + case_array_offset_in_bytes().
1447 li(scratch3, in_bytes(MultiBranchData::case_array_offset()));
1448
1449 assert (in_bytes(MultiBranchData::per_case_size()) == 16, "so that shladd works");
1450 sldi(scratch1, index, exact_log2(in_bytes(MultiBranchData::per_case_size())));
1451 add(scratch1, scratch1, scratch3);
1452
1453 // Update the case count.
1454 increment_mdp_data_at(scratch1, in_bytes(MultiBranchData::relative_count_offset()), scratch2, scratch3);
1455
1456 // The method data pointer needs to be updated.
1457 update_mdp_by_offset(scratch1, in_bytes(MultiBranchData::relative_displacement_offset()), scratch2);
1458
1459 bind (profile_continue);
1460 }
1461 }
1462
1463 void InterpreterMacroAssembler::profile_null_seen(Register Rscratch1, Register Rscratch2) {
1464 if (ProfileInterpreter) {
1465 assert_different_registers(Rscratch1, Rscratch2);
1466 Label profile_continue;
1467
1468 // If no method data exists, go to profile_continue.
1469 test_method_data_pointer(profile_continue);
1470
1471 set_mdp_flag_at(BitData::null_seen_byte_constant(), Rscratch1);
1472
1473 // The method data pointer needs to be updated.
1474 int mdp_delta = in_bytes(BitData::bit_data_size());
1475 if (TypeProfileCasts) {
1476 mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size());
1477 }
1478 update_mdp_by_constant(mdp_delta);
1479
1480 bind (profile_continue);
1481 }
1482 }
1580
1581 profile_obj_type(tmp1, R28_mdx, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args, tmp2, tmp1);
1582
1583 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1584 addi(R28_mdx, R28_mdx, to_add);
1585 off_to_args += to_add;
1586 }
1587
1588 if (MethodData::profile_return()) {
1589 ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx);
1590 addi(tmp1, tmp1, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1591 }
1592
1593 bind(done);
1594
1595 if (MethodData::profile_return()) {
1596 // We're right after the type profile for the last
1597 // argument. tmp1 is the number of cells left in the
1598 // CallTypeData/VirtualCallTypeData to reach its end. Non null
1599 // if there's a return to profile.
1600 assert(ReturnTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(),
1601 "can't move past ret type");
1602 sldi(tmp1, tmp1, exact_log2(DataLayout::cell_size));
1603 add(R28_mdx, tmp1, R28_mdx);
1604 }
1605 } else {
1606 assert(MethodData::profile_return(), "either profile call args or call ret");
1607 update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size()));
1608 }
1609
1610 // Mdp points right after the end of the
1611 // CallTypeData/VirtualCallTypeData, right after the cells for the
1612 // return value type if there's one.
1613 align(32, 12);
1614 bind(profile_continue);
1615 }
1616 }
1617
1618 void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1, Register tmp2) {
1619 assert_different_registers(ret, tmp1, tmp2);
1620 if (ProfileInterpreter && MethodData::profile_return()) {
1621 Label profile_continue;
1622
1623 test_method_data_pointer(profile_continue);
1624
1625 if (MethodData::profile_return_jsr292_only()) {
1626 // If we don't profile all invoke bytecodes we must make sure
1627 // it's a bytecode we indeed profile. We can't go back to the
1628 // beginning of the ProfileData we intend to update to check its
1629 // type because we're right after it and we don't known its
1630 // length.
1631 lbz(tmp1, 0, R14_bcp);
1632 lbz(tmp2, in_bytes(Method::intrinsic_id_offset()), R19_method);
1633 cmpwi(CR0, tmp1, Bytecodes::_invokedynamic);
1634 cmpwi(CR1, tmp1, Bytecodes::_invokehandle);
1635 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1636 cmpwi(CR1, tmp2, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1637 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1638 bne(CR0, profile_continue);
1639 }
1640
1641 profile_obj_type(ret, R28_mdx, -in_bytes(ReturnTypeEntry::size()), tmp1, tmp2);
1642
1643 align(32, 12);
1644 bind(profile_continue);
1645 }
1646 }
1647
1648 void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register tmp2,
1649 Register tmp3, Register tmp4) {
1650 if (ProfileInterpreter && MethodData::profile_parameters()) {
1651 Label profile_continue, done;
1652
1653 test_method_data_pointer(profile_continue);
1654
1655 // Load the offset of the area within the MDO used for
1656 // parameters. If it's negative we're not profiling any parameters.
1657 lwz(tmp1, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()), R28_mdx);
1658 cmpwi(CR0, tmp1, 0);
1659 blt(CR0, profile_continue);
1660
1661 // Compute a pointer to the area for parameters from the offset
2270 ld(R11_scratch1, in_bytes(JavaThread::jvmti_thread_state_offset()), R16_thread);
2271 cmpdi(CR0, R11_scratch1, 0);
2272 beq(CR0, jvmti_post_done);
2273
2274 // if (interp_only_mode() == false && frame_pop_cnt() == 0) exit;
2275 lwz(R12_scratch2, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread);
2276 lwz(R11_scratch1, in_bytes(JvmtiThreadState::frame_pop_cnt_offset()), R11_scratch1);
2277 or_(R0, R11_scratch1, R12_scratch2);
2278 beq(CR0, jvmti_post_done);
2279
2280 if (!is_native_method) { push(state); } // Expose tos to GC.
2281 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit), check_exceptions);
2282 if (!is_native_method) { pop(state); }
2283
2284 align(32, 12);
2285 bind(jvmti_post_done);
2286 }
2287
2288 // Dtrace support not implemented.
2289 }
|
538 // int value = *(Rcpool->int_at_addr(which));
539 // int resolved_klass_index = extract_low_short_from_int(value);
540 add(Roffset, Rcpool, Roffset);
541 #if defined(VM_LITTLE_ENDIAN)
542 lhz(Roffset, sizeof(ConstantPool), Roffset); // Roffset = resolved_klass_index
543 #else
544 lhz(Roffset, sizeof(ConstantPool) + 2, Roffset); // Roffset = resolved_klass_index
545 #endif
546
547 ld(Rklass, ConstantPool::resolved_klasses_offset(), Rcpool); // Rklass = Rcpool->_resolved_klasses
548
549 sldi(Roffset, Roffset, LogBytesPerWord);
550 addi(Roffset, Roffset, Array<Klass*>::base_offset_in_bytes());
551 isync(); // Order load of instance Klass wrt. tags.
552 ldx(Rklass, Rklass, Roffset);
553 }
554
555 // Generate a subtype check: branch to ok_is_subtype if sub_klass is
556 // a subtype of super_klass. Blows registers Rsub_klass, tmp1, tmp2.
557 void InterpreterMacroAssembler::gen_subtype_check(Register Rsub_klass, Register Rsuper_klass, Register Rtmp1,
558 Register Rtmp2, Register Rtmp3, Label &ok_is_subtype, bool profile) {
559 // Profile the not-null value's klass.
560 if (profile) {
561 profile_typecheck(Rsub_klass, Rtmp1, Rtmp2);
562 }
563 check_klass_subtype(Rsub_klass, Rsuper_klass, Rtmp1, Rtmp2, ok_is_subtype);
564 }
565
566 // Separate these two to allow for delay slot in middle.
567 // These are used to do a test and full jump to exception-throwing code.
568
569 // Check that index is in range for array, then shift index by index_shift,
570 // and put arrayOop + shifted_index into res.
571 // Note: res is still shy of address by array offset into object.
572
573 void InterpreterMacroAssembler::index_check_without_pop(Register Rarray, Register Rindex,
574 int index_shift, Register Rtmp, Register Rres) {
575 // Check that index is in range for array, then shift index by index_shift,
576 // and put arrayOop + shifted_index into res.
577 // Note: res is still shy of address by array offset into object.
578 // Kills:
579 // - Rindex
580 // Writes:
581 // - Rres: Address that corresponds to the array index if check was successful.
582 verify_oop(Rarray);
906
907 // Compare frame pointers. There is no good stack pointer, as with stack
908 // frame compression we can get different SPs when we do calls. A subsequent
909 // call could have a smaller SP, so that this compare succeeds for an
910 // inner call of the method annotated with ReservedStack.
911 ld_ptr(R0, JavaThread::reserved_stack_activation_offset(), R16_thread);
912 cmpld(CR0, fp, R0);
913 blt_predict_taken(CR0, no_reserved_zone_enabling);
914
915 JFR_ONLY(leave_jfr_critical_section();)
916
917 // Enable reserved zone again, throw stack overflow exception.
918 call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), R16_thread);
919 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_delayed_StackOverflowError));
920
921 should_not_reach_here();
922
923 bind(no_reserved_zone_enabling);
924 }
925
926 if (state == atos && InlineTypeReturnedAsFields) {
927 Label skip, not_null;
928 cmpdi(CR0, R17_tos, 0);
929 bne(CR0, not_null);
930
931 untested("remove_activation InlineTypeReturnedAsFields null");
932 // Returned value is null, zero all return registers because they may belong to oop fields
933 li(R3_ARG1, 0);
934 li(R4_ARG2, 0);
935 li(R5_ARG3, 0);
936 li(R6_ARG4, 0);
937 li(R7_ARG5, 0);
938 li(R8_ARG6, 0);
939 li(R9_ARG7, 0);
940 li(R10_ARG8, 0);
941 b(skip);
942
943 bind(not_null);
944
945 // Check if we are returning an non-null inline type and load its fields into registers
946 test_oop_is_not_inline_type(R17_tos, skip, /* can_be_null= */ false);
947
948 // Load fields from a buffered value with an inline class specific handler
949 load_klass(R11_scratch1, R17_tos);
950 ld(R11_scratch1, InlineKlass::adr_members_offset(), R11_scratch1);
951 ld(R11_scratch1, InlineKlass::unpack_handler_offset(), R11_scratch1);
952 // Unpack handler can be null if inline type is not scalarizable in returns
953 cmpdi(CR0, R11_scratch1, 0);
954 beq(CR0, skip);
955 mtctr(R11_scratch1);
956 bctrl();
957
958 bind(skip);
959 }
960
961 verify_oop(R17_tos, state);
962
963 remove_top_frame_given_fp(fp, R21_sender_SP, R23_tmp3, /*return_pc*/ R0, R11_scratch1);
964 mtlr(R0);
965 pop_cont_fastpath();
966 JFR_ONLY(leave_jfr_critical_section();)
967
968 BLOCK_COMMENT("} remove_activation");
969 }
970
971 #if INCLUDE_JFR
972 void InterpreterMacroAssembler::enter_jfr_critical_section() {
973 li(R0, 1);
974 stb(R0, in_bytes(SAMPLING_CRITICAL_SECTION_OFFSET_JFR), R16_thread);
975 }
976
977 void InterpreterMacroAssembler::leave_jfr_critical_section() {
978 li(R0, 0);
979 stb(R0, in_bytes(SAMPLING_CRITICAL_SECTION_OFFSET_JFR), R16_thread);
980 }
1306 }
1307
1308 // Count a taken branch in the bytecodes.
1309 void InterpreterMacroAssembler::profile_taken_branch(Register scratch, Register bumped_count) {
1310 if (ProfileInterpreter) {
1311 Label profile_continue;
1312
1313 // If no method data exists, go to profile_continue.
1314 test_method_data_pointer(profile_continue);
1315
1316 // We are taking a branch. Increment the taken count.
1317 increment_mdp_data_at(in_bytes(JumpData::taken_offset()), scratch, bumped_count);
1318
1319 // The method data pointer needs to be updated to reflect the new target.
1320 update_mdp_by_offset(in_bytes(JumpData::displacement_offset()), scratch);
1321 bind (profile_continue);
1322 }
1323 }
1324
1325 // Count a not-taken branch in the bytecodes.
1326 void InterpreterMacroAssembler::profile_not_taken_branch(Register scratch1, Register scratch2, bool acmp) {
1327 if (ProfileInterpreter) {
1328 Label profile_continue;
1329
1330 // If no method data exists, go to profile_continue.
1331 test_method_data_pointer(profile_continue);
1332
1333 // We are taking a branch. Increment the not taken count.
1334 increment_mdp_data_at(in_bytes(BranchData::not_taken_offset()), scratch1, scratch2);
1335
1336 // The method data pointer needs to be updated to correspond to the
1337 // next bytecode.
1338 update_mdp_by_constant(acmp ? in_bytes(ACmpData::acmp_data_size()) : in_bytes(BranchData::branch_data_size()));
1339 bind (profile_continue);
1340 }
1341 }
1342
1343 // Count a non-virtual call in the bytecodes.
1344 void InterpreterMacroAssembler::profile_call(Register scratch1, Register scratch2) {
1345 if (ProfileInterpreter) {
1346 Label profile_continue;
1347
1348 // If no method data exists, go to profile_continue.
1349 test_method_data_pointer(profile_continue);
1350
1351 // We are making a call. Increment the count.
1352 increment_mdp_data_at(in_bytes(CounterData::count_offset()), scratch1, scratch2);
1353
1354 // The method data pointer needs to be updated to reflect the new target.
1355 update_mdp_by_constant(in_bytes(CounterData::counter_data_size()));
1356 bind (profile_continue);
1357 }
1358 }
1480 // If no method data exists, go to profile_continue.
1481 test_method_data_pointer(profile_continue);
1482
1483 // Build the base (index * per_case_size_in_bytes()) + case_array_offset_in_bytes().
1484 li(scratch3, in_bytes(MultiBranchData::case_array_offset()));
1485
1486 assert (in_bytes(MultiBranchData::per_case_size()) == 16, "so that shladd works");
1487 sldi(scratch1, index, exact_log2(in_bytes(MultiBranchData::per_case_size())));
1488 add(scratch1, scratch1, scratch3);
1489
1490 // Update the case count.
1491 increment_mdp_data_at(scratch1, in_bytes(MultiBranchData::relative_count_offset()), scratch2, scratch3);
1492
1493 // The method data pointer needs to be updated.
1494 update_mdp_by_offset(scratch1, in_bytes(MultiBranchData::relative_displacement_offset()), scratch2);
1495
1496 bind (profile_continue);
1497 }
1498 }
1499
1500 template <class ArrayData> void InterpreterMacroAssembler::profile_array_type(Register array,
1501 Register tmp1,
1502 Register tmp2) {
1503 if (ProfileInterpreter) {
1504 Label profile_continue;
1505 assert_different_registers(array, tmp1, tmp2);
1506
1507 // If no method data exists, go to profile_continue.
1508 test_method_data_pointer(profile_continue);
1509
1510 profile_obj_type(array, R28_mdx, in_bytes(ArrayData::array_offset()), tmp1, tmp2);
1511
1512 Label not_flat;
1513 test_non_flat_array_oop(array, tmp1, not_flat);
1514 set_mdp_flag_at(ArrayData::flat_array_byte_constant(), tmp1);
1515 bind(not_flat);
1516
1517 Label not_null_free;
1518 test_non_null_free_array_oop(array, tmp1, not_null_free);
1519 set_mdp_flag_at(ArrayData::null_free_array_byte_constant(), tmp1);
1520 bind(not_null_free);
1521
1522 bind(profile_continue);
1523 }
1524 }
1525
1526 template void InterpreterMacroAssembler::profile_array_type<ArrayLoadData>(Register array,
1527 Register tmp1,
1528 Register tmp2);
1529 template void InterpreterMacroAssembler::profile_array_type<ArrayStoreData>(Register array,
1530 Register tmp1,
1531 Register tmp2);
1532
1533 void InterpreterMacroAssembler::profile_multiple_element_types(Register element, Register tmp1, Register tmp2, Register tmp3) {
1534 if (ProfileInterpreter) {
1535 Label profile_continue;
1536
1537 // If no method data exists, go to profile_continue.
1538 test_method_data_pointer(profile_continue);
1539
1540 Label done, update;
1541 cmpdi(CR0, element, 0);
1542 bne(CR0, update);
1543 set_mdp_flag_at(BitData::null_seen_byte_constant(), tmp1);
1544 b(done);
1545
1546 bind(update);
1547 load_klass(tmp1, element);
1548
1549 // Record the object type.
1550 profile_receiver_type(tmp1, R28_mdx, 0, tmp2, tmp3);
1551
1552 bind(done);
1553
1554 // The method data pointer needs to be updated.
1555 update_mdp_by_constant(in_bytes(ArrayStoreData::array_store_data_size()));
1556
1557 bind(profile_continue);
1558 }
1559 }
1560
1561
1562 void InterpreterMacroAssembler::profile_element_type(Register element, Register tmp1, Register tmp2) {
1563 if (ProfileInterpreter) {
1564 Label profile_continue;
1565
1566 // If no method data exists, go to profile_continue.
1567 test_method_data_pointer(profile_continue);
1568
1569 profile_obj_type(element, R28_mdx, in_bytes(ArrayLoadData::element_offset()), tmp1, tmp2);
1570
1571 // The method data pointer needs to be updated.
1572 update_mdp_by_constant(in_bytes(ArrayLoadData::array_load_data_size()));
1573
1574 bind(profile_continue);
1575 }
1576 }
1577
1578 void InterpreterMacroAssembler::profile_acmp(Register left,
1579 Register right,
1580 Register tmp1,
1581 Register tmp2) {
1582 if (ProfileInterpreter) {
1583 Label profile_continue;
1584 assert_different_registers(left, right, tmp1, tmp2);
1585
1586 // If no method data exists, go to profile_continue.
1587 test_method_data_pointer(profile_continue);
1588
1589 profile_obj_type(left, R28_mdx, in_bytes(ACmpData::left_offset()), tmp1, tmp2);
1590
1591 Label left_not_inline_type;
1592 test_oop_is_not_inline_type(left, left_not_inline_type);
1593 set_mdp_flag_at(ACmpData::left_inline_type_byte_constant(), tmp1);
1594 bind(left_not_inline_type);
1595
1596 profile_obj_type(right, R28_mdx, in_bytes(ACmpData::right_offset()), tmp1, tmp2);
1597
1598 test_oop_is_not_inline_type(right, profile_continue);
1599 set_mdp_flag_at(ACmpData::right_inline_type_byte_constant(), tmp1);
1600
1601 bind(profile_continue);
1602 }
1603 }
1604
1605 void InterpreterMacroAssembler::profile_null_seen(Register Rscratch1, Register Rscratch2) {
1606 if (ProfileInterpreter) {
1607 assert_different_registers(Rscratch1, Rscratch2);
1608 Label profile_continue;
1609
1610 // If no method data exists, go to profile_continue.
1611 test_method_data_pointer(profile_continue);
1612
1613 set_mdp_flag_at(BitData::null_seen_byte_constant(), Rscratch1);
1614
1615 // The method data pointer needs to be updated.
1616 int mdp_delta = in_bytes(BitData::bit_data_size());
1617 if (TypeProfileCasts) {
1618 mdp_delta = in_bytes(VirtualCallData::virtual_call_data_size());
1619 }
1620 update_mdp_by_constant(mdp_delta);
1621
1622 bind (profile_continue);
1623 }
1624 }
1722
1723 profile_obj_type(tmp1, R28_mdx, in_bytes(TypeEntriesAtCall::argument_type_offset(i))-off_to_args, tmp2, tmp1);
1724
1725 int to_add = in_bytes(TypeStackSlotEntries::per_arg_size());
1726 addi(R28_mdx, R28_mdx, to_add);
1727 off_to_args += to_add;
1728 }
1729
1730 if (MethodData::profile_return()) {
1731 ld(tmp1, in_bytes(TypeEntriesAtCall::cell_count_offset())-off_to_args, R28_mdx);
1732 addi(tmp1, tmp1, -TypeProfileArgsLimit*TypeStackSlotEntries::per_arg_count());
1733 }
1734
1735 bind(done);
1736
1737 if (MethodData::profile_return()) {
1738 // We're right after the type profile for the last
1739 // argument. tmp1 is the number of cells left in the
1740 // CallTypeData/VirtualCallTypeData to reach its end. Non null
1741 // if there's a return to profile.
1742 assert(SingleTypeEntry::static_cell_count() < TypeStackSlotEntries::per_arg_count(),
1743 "can't move past ret type");
1744 sldi(tmp1, tmp1, exact_log2(DataLayout::cell_size));
1745 add(R28_mdx, tmp1, R28_mdx);
1746 }
1747 } else {
1748 assert(MethodData::profile_return(), "either profile call args or call ret");
1749 update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size()));
1750 }
1751
1752 // Mdp points right after the end of the
1753 // CallTypeData/VirtualCallTypeData, right after the cells for the
1754 // return value type if there's one.
1755 align(32, 12);
1756 bind(profile_continue);
1757 }
1758 }
1759
1760 void InterpreterMacroAssembler::profile_return_type(Register ret, Register tmp1, Register tmp2) {
1761 assert_different_registers(ret, tmp1, tmp2);
1762 if (ProfileInterpreter && MethodData::profile_return()) {
1763 Label profile_continue;
1764
1765 test_method_data_pointer(profile_continue);
1766
1767 if (MethodData::profile_return_jsr292_only()) {
1768 // If we don't profile all invoke bytecodes we must make sure
1769 // it's a bytecode we indeed profile. We can't go back to the
1770 // beginning of the ProfileData we intend to update to check its
1771 // type because we're right after it and we don't known its
1772 // length.
1773 lbz(tmp1, 0, R14_bcp);
1774 lbz(tmp2, in_bytes(Method::intrinsic_id_offset()), R19_method);
1775 cmpwi(CR0, tmp1, Bytecodes::_invokedynamic);
1776 cmpwi(CR1, tmp1, Bytecodes::_invokehandle);
1777 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1778 cmpwi(CR1, tmp2, static_cast<int>(vmIntrinsics::_compiledLambdaForm));
1779 cror(CR0, Assembler::equal, CR1, Assembler::equal);
1780 bne(CR0, profile_continue);
1781 }
1782
1783 profile_obj_type(ret, R28_mdx, -in_bytes(SingleTypeEntry::size()), tmp1, tmp2);
1784
1785 align(32, 12);
1786 bind(profile_continue);
1787 }
1788 }
1789
1790 void InterpreterMacroAssembler::profile_parameters_type(Register tmp1, Register tmp2,
1791 Register tmp3, Register tmp4) {
1792 if (ProfileInterpreter && MethodData::profile_parameters()) {
1793 Label profile_continue, done;
1794
1795 test_method_data_pointer(profile_continue);
1796
1797 // Load the offset of the area within the MDO used for
1798 // parameters. If it's negative we're not profiling any parameters.
1799 lwz(tmp1, in_bytes(MethodData::parameters_type_data_di_offset()) - in_bytes(MethodData::data_offset()), R28_mdx);
1800 cmpwi(CR0, tmp1, 0);
1801 blt(CR0, profile_continue);
1802
1803 // Compute a pointer to the area for parameters from the offset
2412 ld(R11_scratch1, in_bytes(JavaThread::jvmti_thread_state_offset()), R16_thread);
2413 cmpdi(CR0, R11_scratch1, 0);
2414 beq(CR0, jvmti_post_done);
2415
2416 // if (interp_only_mode() == false && frame_pop_cnt() == 0) exit;
2417 lwz(R12_scratch2, in_bytes(JavaThread::interp_only_mode_offset()), R16_thread);
2418 lwz(R11_scratch1, in_bytes(JvmtiThreadState::frame_pop_cnt_offset()), R11_scratch1);
2419 or_(R0, R11_scratch1, R12_scratch2);
2420 beq(CR0, jvmti_post_done);
2421
2422 if (!is_native_method) { push(state); } // Expose tos to GC.
2423 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::post_method_exit), check_exceptions);
2424 if (!is_native_method) { pop(state); }
2425
2426 align(32, 12);
2427 bind(jvmti_post_done);
2428 }
2429
2430 // Dtrace support not implemented.
2431 }
2432
2433 void InterpreterMacroAssembler::read_flat_field(Register entry, Register obj) {
2434 call_VM(obj, CAST_FROM_FN_PTR(address, InterpreterRuntime::read_flat_field), obj, entry);
2435 }
2436
2437 void InterpreterMacroAssembler::write_flat_field(Register entry, Register tmp1, Register tmp2,
2438 Register obj, Register field_offset, Register value) {
2439 assert_different_registers(entry, field_offset, tmp1, tmp2, obj, value);
2440 Label slow_path, done;
2441
2442 lbz(tmp1, in_bytes(ResolvedFieldEntry::flags_offset()), entry);
2443 test_field_is_not_null_free_inline_type(tmp1, slow_path);
2444
2445 null_check_throw(value, -1, tmp1);
2446
2447 add(obj, obj, field_offset);
2448
2449 load_klass(tmp1, value);
2450 payload_address(value, value, tmp1, tmp2);
2451
2452 Register layout_info = field_offset;
2453 lbz(tmp1, in_bytes(ResolvedFieldEntry::field_index_offset()), entry);
2454 ld(tmp2, in_bytes(ResolvedFieldEntry::field_holder_offset()), entry);
2455 inline_layout_info(tmp2, tmp1, layout_info);
2456
2457 flat_field_copy(IN_HEAP, value, obj, layout_info);
2458 b(done);
2459
2460 bind(slow_path);
2461 call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::write_flat_field), obj, value, entry);
2462 bind(done);
2463 }
|