1124 #include "opto/convertnode.hpp"
1125 #include "runtime/objectMonitor.hpp"
1126
1127 extern RegMask _ANY_REG32_mask;
1128 extern RegMask _ANY_REG_mask;
1129 extern RegMask _PTR_REG_mask;
1130 extern RegMask _NO_SPECIAL_REG32_mask;
1131 extern RegMask _NO_SPECIAL_REG_mask;
1132 extern RegMask _NO_SPECIAL_PTR_REG_mask;
1133 extern RegMask _NO_SPECIAL_NO_RFP_PTR_REG_mask;
1134
1135 class CallStubImpl {
1136
1137 //--------------------------------------------------------------
1138 //---< Used for optimization in Compile::shorten_branches >---
1139 //--------------------------------------------------------------
1140
1141 public:
1142 // Size of call trampoline stub.
1143 static uint size_call_trampoline() {
1144 return 0; // no call trampolines on this platform
1145 }
1146
1147 // number of relocations needed by a call trampoline stub
1148 static uint reloc_call_trampoline() {
1149 return 0; // no call trampolines on this platform
1150 }
1151 };
1152
1153 class HandlerImpl {
1154
1155 public:
1156
1157 static int emit_exception_handler(C2_MacroAssembler *masm);
1158 static int emit_deopt_handler(C2_MacroAssembler* masm);
1159
1160 static uint size_exception_handler() {
1161 return MacroAssembler::far_codestub_branch_size();
1162 }
1163
1164 static uint size_deopt_handler() {
3414 uint64_t con = (uint64_t)$src$$constant;
3415 if (con == 0) {
3416 __ mov(dst_reg, zr);
3417 } else {
3418 __ mov(dst_reg, con);
3419 }
3420 %}
3421
3422 enc_class aarch64_enc_mov_p(iRegP dst, immP src) %{
3423 Register dst_reg = as_Register($dst$$reg);
3424 address con = (address)$src$$constant;
3425 if (con == nullptr || con == (address)1) {
3426 ShouldNotReachHere();
3427 } else {
3428 relocInfo::relocType rtype = $src->constant_reloc();
3429 if (rtype == relocInfo::oop_type) {
3430 __ movoop(dst_reg, (jobject)con);
3431 } else if (rtype == relocInfo::metadata_type) {
3432 __ mov_metadata(dst_reg, (Metadata*)con);
3433 } else {
3434 assert(rtype == relocInfo::none, "unexpected reloc type");
3435 if (! __ is_valid_AArch64_address(con) ||
3436 con < (address)(uintptr_t)os::vm_page_size()) {
3437 __ mov(dst_reg, con);
3438 } else {
3439 uint64_t offset;
3440 __ adrp(dst_reg, con, offset);
3441 __ add(dst_reg, dst_reg, offset);
3442 }
3443 }
3444 }
3445 %}
3446
3447 enc_class aarch64_enc_mov_p0(iRegP dst, immP0 src) %{
3448 Register dst_reg = as_Register($dst$$reg);
3449 __ mov(dst_reg, zr);
3450 %}
3451
3452 enc_class aarch64_enc_mov_p1(iRegP dst, immP_1 src) %{
3453 Register dst_reg = as_Register($dst$$reg);
3454 __ mov(dst_reg, (uint64_t)1);
3455 %}
3456
3457 enc_class aarch64_enc_mov_byte_map_base(iRegP dst, immByteMapBase src) %{
3458 __ load_byte_map_base($dst$$Register);
3459 %}
3460
3461 enc_class aarch64_enc_mov_n(iRegN dst, immN src) %{
3462 Register dst_reg = as_Register($dst$$reg);
3463 address con = (address)$src$$constant;
3464 if (con == nullptr) {
3465 ShouldNotReachHere();
3466 } else {
3467 relocInfo::relocType rtype = $src->constant_reloc();
3468 assert(rtype == relocInfo::oop_type, "unexpected reloc type");
3469 __ set_narrow_oop(dst_reg, (jobject)con);
3470 }
3471 %}
3472
3473 enc_class aarch64_enc_mov_n0(iRegN dst, immN0 src) %{
3474 Register dst_reg = as_Register($dst$$reg);
3475 __ mov(dst_reg, zr);
3476 %}
3477
3478 enc_class aarch64_enc_mov_nk(iRegN dst, immNKlass src) %{
3479 Register dst_reg = as_Register($dst$$reg);
3480 address con = (address)$src$$constant;
4542 interface(CONST_INTER);
4543 %}
4544
4545 // Pointer Immediate One
4546 // this is used in object initialization (initial object header)
4547 operand immP_1()
4548 %{
4549 predicate(n->get_ptr() == 1);
4550 match(ConP);
4551
4552 op_cost(0);
4553 format %{ %}
4554 interface(CONST_INTER);
4555 %}
4556
4557 // Card Table Byte Map Base
4558 operand immByteMapBase()
4559 %{
4560 // Get base of card map
4561 predicate(BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) &&
4562 SHENANDOAHGC_ONLY(!BarrierSet::barrier_set()->is_a(BarrierSet::ShenandoahBarrierSet) &&)
4563 (CardTable::CardValue*)n->get_ptr() == ((CardTableBarrierSet*)(BarrierSet::barrier_set()))->card_table()->byte_map_base());
4564 match(ConP);
4565
4566 op_cost(0);
4567 format %{ %}
4568 interface(CONST_INTER);
4569 %}
4570
4571 // Float and Double operands
4572 // Double Immediate
4573 operand immD()
4574 %{
4575 match(ConD);
4576 op_cost(0);
4577 format %{ %}
4578 interface(CONST_INTER);
4579 %}
4580
4581 // Double Immediate: +0.0d
4582 operand immD0()
4583 %{
6846 %{
6847 match(Set dst con);
6848
6849 ins_cost(INSN_COST);
6850 format %{ "mov $dst, $con\t# nullptr ptr" %}
6851
6852 ins_encode(aarch64_enc_mov_p1(dst, con));
6853
6854 ins_pipe(ialu_imm);
6855 %}
6856
6857 // Load Byte Map Base Constant
6858
6859 instruct loadByteMapBase(iRegPNoSp dst, immByteMapBase con)
6860 %{
6861 match(Set dst con);
6862
6863 ins_cost(INSN_COST);
6864 format %{ "adr $dst, $con\t# Byte Map Base" %}
6865
6866 ins_encode(aarch64_enc_mov_byte_map_base(dst, con));
6867
6868 ins_pipe(ialu_imm);
6869 %}
6870
6871 // Load Narrow Pointer Constant
6872
6873 instruct loadConN(iRegNNoSp dst, immN con)
6874 %{
6875 match(Set dst con);
6876
6877 ins_cost(INSN_COST * 4);
6878 format %{ "mov $dst, $con\t# compressed ptr" %}
6879
6880 ins_encode(aarch64_enc_mov_n(dst, con));
6881
6882 ins_pipe(ialu_imm);
6883 %}
6884
6885 // Load Narrow Null Pointer Constant
6886
|
1124 #include "opto/convertnode.hpp"
1125 #include "runtime/objectMonitor.hpp"
1126
1127 extern RegMask _ANY_REG32_mask;
1128 extern RegMask _ANY_REG_mask;
1129 extern RegMask _PTR_REG_mask;
1130 extern RegMask _NO_SPECIAL_REG32_mask;
1131 extern RegMask _NO_SPECIAL_REG_mask;
1132 extern RegMask _NO_SPECIAL_PTR_REG_mask;
1133 extern RegMask _NO_SPECIAL_NO_RFP_PTR_REG_mask;
1134
1135 class CallStubImpl {
1136
1137 //--------------------------------------------------------------
1138 //---< Used for optimization in Compile::shorten_branches >---
1139 //--------------------------------------------------------------
1140
1141 public:
1142 // Size of call trampoline stub.
1143 static uint size_call_trampoline() {
1144 return MacroAssembler::max_trampoline_stub_size(); // no call trampolines on this platform
1145 }
1146
1147 // number of relocations needed by a call trampoline stub
1148 static uint reloc_call_trampoline() {
1149 return 0; // no call trampolines on this platform
1150 }
1151 };
1152
1153 class HandlerImpl {
1154
1155 public:
1156
1157 static int emit_exception_handler(C2_MacroAssembler *masm);
1158 static int emit_deopt_handler(C2_MacroAssembler* masm);
1159
1160 static uint size_exception_handler() {
1161 return MacroAssembler::far_codestub_branch_size();
1162 }
1163
1164 static uint size_deopt_handler() {
3414 uint64_t con = (uint64_t)$src$$constant;
3415 if (con == 0) {
3416 __ mov(dst_reg, zr);
3417 } else {
3418 __ mov(dst_reg, con);
3419 }
3420 %}
3421
3422 enc_class aarch64_enc_mov_p(iRegP dst, immP src) %{
3423 Register dst_reg = as_Register($dst$$reg);
3424 address con = (address)$src$$constant;
3425 if (con == nullptr || con == (address)1) {
3426 ShouldNotReachHere();
3427 } else {
3428 relocInfo::relocType rtype = $src->constant_reloc();
3429 if (rtype == relocInfo::oop_type) {
3430 __ movoop(dst_reg, (jobject)con);
3431 } else if (rtype == relocInfo::metadata_type) {
3432 __ mov_metadata(dst_reg, (Metadata*)con);
3433 } else {
3434 assert(rtype == relocInfo::none || rtype == relocInfo::external_word_type, "unexpected reloc type");
3435 if (! __ is_valid_AArch64_address(con) ||
3436 con < (address)(uintptr_t)os::vm_page_size()) {
3437 __ mov(dst_reg, con);
3438 } else {
3439 uint64_t offset;
3440 __ adrp(dst_reg, con, offset);
3441 __ add(dst_reg, dst_reg, offset);
3442 }
3443 }
3444 }
3445 %}
3446
3447 enc_class aarch64_enc_mov_p0(iRegP dst, immP0 src) %{
3448 Register dst_reg = as_Register($dst$$reg);
3449 __ mov(dst_reg, zr);
3450 %}
3451
3452 enc_class aarch64_enc_mov_p1(iRegP dst, immP_1 src) %{
3453 Register dst_reg = as_Register($dst$$reg);
3454 __ mov(dst_reg, (uint64_t)1);
3455 %}
3456
3457 enc_class aarch64_enc_mov_n(iRegN dst, immN src) %{
3458 Register dst_reg = as_Register($dst$$reg);
3459 address con = (address)$src$$constant;
3460 if (con == nullptr) {
3461 ShouldNotReachHere();
3462 } else {
3463 relocInfo::relocType rtype = $src->constant_reloc();
3464 assert(rtype == relocInfo::oop_type, "unexpected reloc type");
3465 __ set_narrow_oop(dst_reg, (jobject)con);
3466 }
3467 %}
3468
3469 enc_class aarch64_enc_mov_n0(iRegN dst, immN0 src) %{
3470 Register dst_reg = as_Register($dst$$reg);
3471 __ mov(dst_reg, zr);
3472 %}
3473
3474 enc_class aarch64_enc_mov_nk(iRegN dst, immNKlass src) %{
3475 Register dst_reg = as_Register($dst$$reg);
3476 address con = (address)$src$$constant;
4538 interface(CONST_INTER);
4539 %}
4540
4541 // Pointer Immediate One
4542 // this is used in object initialization (initial object header)
4543 operand immP_1()
4544 %{
4545 predicate(n->get_ptr() == 1);
4546 match(ConP);
4547
4548 op_cost(0);
4549 format %{ %}
4550 interface(CONST_INTER);
4551 %}
4552
4553 // Card Table Byte Map Base
4554 operand immByteMapBase()
4555 %{
4556 // Get base of card map
4557 predicate(BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) &&
4558 is_card_table_address((address)(n->get_ptr())));
4559 match(ConP);
4560
4561 op_cost(0);
4562 format %{ %}
4563 interface(CONST_INTER);
4564 %}
4565
4566 // AOT Runtime Constants Address
4567 operand immAOTRuntimeConstantsAddress()
4568 %{
4569 // Check if the address is in the range of AOT Runtime Constants
4570 predicate(AOTRuntimeConstants::contains((address)(n->get_ptr())));
4571 match(ConP);
4572
4573 op_cost(0);
4574 format %{ %}
4575 interface(CONST_INTER);
4576 %}
4577
4578 // Float and Double operands
4579 // Double Immediate
4580 operand immD()
4581 %{
4582 match(ConD);
4583 op_cost(0);
4584 format %{ %}
4585 interface(CONST_INTER);
4586 %}
4587
4588 // Double Immediate: +0.0d
4589 operand immD0()
4590 %{
6853 %{
6854 match(Set dst con);
6855
6856 ins_cost(INSN_COST);
6857 format %{ "mov $dst, $con\t# nullptr ptr" %}
6858
6859 ins_encode(aarch64_enc_mov_p1(dst, con));
6860
6861 ins_pipe(ialu_imm);
6862 %}
6863
6864 // Load Byte Map Base Constant
6865
6866 instruct loadByteMapBase(iRegPNoSp dst, immByteMapBase con)
6867 %{
6868 match(Set dst con);
6869
6870 ins_cost(INSN_COST);
6871 format %{ "adr $dst, $con\t# Byte Map Base" %}
6872
6873 ins_encode %{
6874 __ load_byte_map_base($dst$$Register);
6875 %}
6876
6877 ins_pipe(ialu_imm);
6878 %}
6879
6880 instruct loadAOTRCAddress(iRegPNoSp dst, immAOTRuntimeConstantsAddress con)
6881 %{
6882 match(Set dst con);
6883
6884 ins_cost(INSN_COST);
6885 format %{ "adr $dst, $con\t# AOT Runtime Constants Address" %}
6886
6887 ins_encode %{
6888 __ load_aotrc_address($dst$$Register, (address)$con$$constant);
6889 %}
6890
6891 ins_pipe(ialu_imm);
6892 %}
6893
6894 // Load Narrow Pointer Constant
6895
6896 instruct loadConN(iRegNNoSp dst, immN con)
6897 %{
6898 match(Set dst con);
6899
6900 ins_cost(INSN_COST * 4);
6901 format %{ "mov $dst, $con\t# compressed ptr" %}
6902
6903 ins_encode(aarch64_enc_mov_n(dst, con));
6904
6905 ins_pipe(ialu_imm);
6906 %}
6907
6908 // Load Narrow Null Pointer Constant
6909
|