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() {
3379 uint64_t con = (uint64_t)$src$$constant;
3380 if (con == 0) {
3381 __ mov(dst_reg, zr);
3382 } else {
3383 __ mov(dst_reg, con);
3384 }
3385 %}
3386
3387 enc_class aarch64_enc_mov_p(iRegP dst, immP src) %{
3388 Register dst_reg = as_Register($dst$$reg);
3389 address con = (address)$src$$constant;
3390 if (con == nullptr || con == (address)1) {
3391 ShouldNotReachHere();
3392 } else {
3393 relocInfo::relocType rtype = $src->constant_reloc();
3394 if (rtype == relocInfo::oop_type) {
3395 __ movoop(dst_reg, (jobject)con);
3396 } else if (rtype == relocInfo::metadata_type) {
3397 __ mov_metadata(dst_reg, (Metadata*)con);
3398 } else {
3399 assert(rtype == relocInfo::none, "unexpected reloc type");
3400 if (! __ is_valid_AArch64_address(con) ||
3401 con < (address)(uintptr_t)os::vm_page_size()) {
3402 __ mov(dst_reg, con);
3403 } else {
3404 uint64_t offset;
3405 __ adrp(dst_reg, con, offset);
3406 __ add(dst_reg, dst_reg, offset);
3407 }
3408 }
3409 }
3410 %}
3411
3412 enc_class aarch64_enc_mov_p0(iRegP dst, immP0 src) %{
3413 Register dst_reg = as_Register($dst$$reg);
3414 __ mov(dst_reg, zr);
3415 %}
3416
3417 enc_class aarch64_enc_mov_p1(iRegP dst, immP_1 src) %{
3418 Register dst_reg = as_Register($dst$$reg);
3419 __ mov(dst_reg, (uint64_t)1);
3420 %}
3421
3422 enc_class aarch64_enc_mov_byte_map_base(iRegP dst, immByteMapBase src) %{
3423 __ load_byte_map_base($dst$$Register);
3424 %}
3425
3426 enc_class aarch64_enc_mov_n(iRegN dst, immN src) %{
3427 Register dst_reg = as_Register($dst$$reg);
3428 address con = (address)$src$$constant;
3429 if (con == nullptr) {
3430 ShouldNotReachHere();
3431 } else {
3432 relocInfo::relocType rtype = $src->constant_reloc();
3433 assert(rtype == relocInfo::oop_type, "unexpected reloc type");
3434 __ set_narrow_oop(dst_reg, (jobject)con);
3435 }
3436 %}
3437
3438 enc_class aarch64_enc_mov_n0(iRegN dst, immN0 src) %{
3439 Register dst_reg = as_Register($dst$$reg);
3440 __ mov(dst_reg, zr);
3441 %}
3442
3443 enc_class aarch64_enc_mov_nk(iRegN dst, immNKlass src) %{
3444 Register dst_reg = as_Register($dst$$reg);
3445 address con = (address)$src$$constant;
4508 interface(CONST_INTER);
4509 %}
4510
4511 // Pointer Immediate One
4512 // this is used in object initialization (initial object header)
4513 operand immP_1()
4514 %{
4515 predicate(n->get_ptr() == 1);
4516 match(ConP);
4517
4518 op_cost(0);
4519 format %{ %}
4520 interface(CONST_INTER);
4521 %}
4522
4523 // Card Table Byte Map Base
4524 operand immByteMapBase()
4525 %{
4526 // Get base of card map
4527 predicate(BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) &&
4528 (CardTable::CardValue*)n->get_ptr() == ((CardTableBarrierSet*)(BarrierSet::barrier_set()))->card_table()->byte_map_base());
4529 match(ConP);
4530
4531 op_cost(0);
4532 format %{ %}
4533 interface(CONST_INTER);
4534 %}
4535
4536 // Float and Double operands
4537 // Double Immediate
4538 operand immD()
4539 %{
4540 match(ConD);
4541 op_cost(0);
4542 format %{ %}
4543 interface(CONST_INTER);
4544 %}
4545
4546 // Double Immediate: +0.0d
4547 operand immD0()
4548 %{
6765 %{
6766 match(Set dst con);
6767
6768 ins_cost(INSN_COST);
6769 format %{ "mov $dst, $con\t# nullptr ptr" %}
6770
6771 ins_encode(aarch64_enc_mov_p1(dst, con));
6772
6773 ins_pipe(ialu_imm);
6774 %}
6775
6776 // Load Byte Map Base Constant
6777
6778 instruct loadByteMapBase(iRegPNoSp dst, immByteMapBase con)
6779 %{
6780 match(Set dst con);
6781
6782 ins_cost(INSN_COST);
6783 format %{ "adr $dst, $con\t# Byte Map Base" %}
6784
6785 ins_encode(aarch64_enc_mov_byte_map_base(dst, con));
6786
6787 ins_pipe(ialu_imm);
6788 %}
6789
6790 // Load Narrow Pointer Constant
6791
6792 instruct loadConN(iRegNNoSp dst, immN con)
6793 %{
6794 match(Set dst con);
6795
6796 ins_cost(INSN_COST * 4);
6797 format %{ "mov $dst, $con\t# compressed ptr" %}
6798
6799 ins_encode(aarch64_enc_mov_n(dst, con));
6800
6801 ins_pipe(ialu_imm);
6802 %}
6803
6804 // Load Narrow Null Pointer Constant
6805
|
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() {
3379 uint64_t con = (uint64_t)$src$$constant;
3380 if (con == 0) {
3381 __ mov(dst_reg, zr);
3382 } else {
3383 __ mov(dst_reg, con);
3384 }
3385 %}
3386
3387 enc_class aarch64_enc_mov_p(iRegP dst, immP src) %{
3388 Register dst_reg = as_Register($dst$$reg);
3389 address con = (address)$src$$constant;
3390 if (con == nullptr || con == (address)1) {
3391 ShouldNotReachHere();
3392 } else {
3393 relocInfo::relocType rtype = $src->constant_reloc();
3394 if (rtype == relocInfo::oop_type) {
3395 __ movoop(dst_reg, (jobject)con);
3396 } else if (rtype == relocInfo::metadata_type) {
3397 __ mov_metadata(dst_reg, (Metadata*)con);
3398 } else {
3399 assert(rtype == relocInfo::none || rtype == relocInfo::external_word_type, "unexpected reloc type");
3400 if (! __ is_valid_AArch64_address(con) ||
3401 con < (address)(uintptr_t)os::vm_page_size()) {
3402 __ mov(dst_reg, con);
3403 } else {
3404 uint64_t offset;
3405 __ adrp(dst_reg, con, offset);
3406 __ add(dst_reg, dst_reg, offset);
3407 }
3408 }
3409 }
3410 %}
3411
3412 enc_class aarch64_enc_mov_p0(iRegP dst, immP0 src) %{
3413 Register dst_reg = as_Register($dst$$reg);
3414 __ mov(dst_reg, zr);
3415 %}
3416
3417 enc_class aarch64_enc_mov_p1(iRegP dst, immP_1 src) %{
3418 Register dst_reg = as_Register($dst$$reg);
3419 __ mov(dst_reg, (uint64_t)1);
3420 %}
3421
3422 enc_class aarch64_enc_mov_n(iRegN dst, immN src) %{
3423 Register dst_reg = as_Register($dst$$reg);
3424 address con = (address)$src$$constant;
3425 if (con == nullptr) {
3426 ShouldNotReachHere();
3427 } else {
3428 relocInfo::relocType rtype = $src->constant_reloc();
3429 assert(rtype == relocInfo::oop_type, "unexpected reloc type");
3430 __ set_narrow_oop(dst_reg, (jobject)con);
3431 }
3432 %}
3433
3434 enc_class aarch64_enc_mov_n0(iRegN dst, immN0 src) %{
3435 Register dst_reg = as_Register($dst$$reg);
3436 __ mov(dst_reg, zr);
3437 %}
3438
3439 enc_class aarch64_enc_mov_nk(iRegN dst, immNKlass src) %{
3440 Register dst_reg = as_Register($dst$$reg);
3441 address con = (address)$src$$constant;
4504 interface(CONST_INTER);
4505 %}
4506
4507 // Pointer Immediate One
4508 // this is used in object initialization (initial object header)
4509 operand immP_1()
4510 %{
4511 predicate(n->get_ptr() == 1);
4512 match(ConP);
4513
4514 op_cost(0);
4515 format %{ %}
4516 interface(CONST_INTER);
4517 %}
4518
4519 // Card Table Byte Map Base
4520 operand immByteMapBase()
4521 %{
4522 // Get base of card map
4523 predicate(BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) &&
4524 is_card_table_address((address)(n->get_ptr())));
4525 match(ConP);
4526
4527 op_cost(0);
4528 format %{ %}
4529 interface(CONST_INTER);
4530 %}
4531
4532 // AOT Runtime Constants Address
4533 operand immAOTRuntimeConstantsAddress()
4534 %{
4535 // Check if the address is in the range of AOT Runtime Constants
4536 predicate(AOTRuntimeConstants::contains((address)(n->get_ptr())));
4537 match(ConP);
4538
4539 op_cost(0);
4540 format %{ %}
4541 interface(CONST_INTER);
4542 %}
4543
4544 // Float and Double operands
4545 // Double Immediate
4546 operand immD()
4547 %{
4548 match(ConD);
4549 op_cost(0);
4550 format %{ %}
4551 interface(CONST_INTER);
4552 %}
4553
4554 // Double Immediate: +0.0d
4555 operand immD0()
4556 %{
6773 %{
6774 match(Set dst con);
6775
6776 ins_cost(INSN_COST);
6777 format %{ "mov $dst, $con\t# nullptr ptr" %}
6778
6779 ins_encode(aarch64_enc_mov_p1(dst, con));
6780
6781 ins_pipe(ialu_imm);
6782 %}
6783
6784 // Load Byte Map Base Constant
6785
6786 instruct loadByteMapBase(iRegPNoSp dst, immByteMapBase con)
6787 %{
6788 match(Set dst con);
6789
6790 ins_cost(INSN_COST);
6791 format %{ "adr $dst, $con\t# Byte Map Base" %}
6792
6793 ins_encode %{
6794 __ load_byte_map_base($dst$$Register);
6795 %}
6796
6797 ins_pipe(ialu_imm);
6798 %}
6799
6800 instruct loadAOTRCAddress(iRegPNoSp dst, immAOTRuntimeConstantsAddress con)
6801 %{
6802 match(Set dst con);
6803
6804 ins_cost(INSN_COST);
6805 format %{ "adr $dst, $con\t# AOT Runtime Constants Address" %}
6806
6807 ins_encode %{
6808 __ load_aotrc_address($dst$$Register, (address)$con$$constant);
6809 %}
6810
6811 ins_pipe(ialu_imm);
6812 %}
6813
6814 // Load Narrow Pointer Constant
6815
6816 instruct loadConN(iRegNNoSp dst, immN con)
6817 %{
6818 match(Set dst con);
6819
6820 ins_cost(INSN_COST * 4);
6821 format %{ "mov $dst, $con\t# compressed ptr" %}
6822
6823 ins_encode(aarch64_enc_mov_n(dst, con));
6824
6825 ins_pipe(ialu_imm);
6826 %}
6827
6828 // Load Narrow Null Pointer Constant
6829
|