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;
4507 interface(CONST_INTER);
4508 %}
4509
4510 // Pointer Immediate One
4511 // this is used in object initialization (initial object header)
4512 operand immP_1()
4513 %{
4514 predicate(n->get_ptr() == 1);
4515 match(ConP);
4516
4517 op_cost(0);
4518 format %{ %}
4519 interface(CONST_INTER);
4520 %}
4521
4522 // Card Table Byte Map Base
4523 operand immByteMapBase()
4524 %{
4525 // Get base of card map
4526 predicate(BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) &&
4527 (CardTable::CardValue*)n->get_ptr() == ((CardTableBarrierSet*)(BarrierSet::barrier_set()))->card_table()->byte_map_base());
4528 match(ConP);
4529
4530 op_cost(0);
4531 format %{ %}
4532 interface(CONST_INTER);
4533 %}
4534
4535 // Float and Double operands
4536 // Double Immediate
4537 operand immD()
4538 %{
4539 match(ConD);
4540 op_cost(0);
4541 format %{ %}
4542 interface(CONST_INTER);
4543 %}
4544
4545 // Double Immediate: +0.0d
4546 operand immD0()
4547 %{
6801 %{
6802 match(Set dst con);
6803
6804 ins_cost(INSN_COST);
6805 format %{ "mov $dst, $con\t# nullptr ptr" %}
6806
6807 ins_encode(aarch64_enc_mov_p1(dst, con));
6808
6809 ins_pipe(ialu_imm);
6810 %}
6811
6812 // Load Byte Map Base Constant
6813
6814 instruct loadByteMapBase(iRegPNoSp dst, immByteMapBase con)
6815 %{
6816 match(Set dst con);
6817
6818 ins_cost(INSN_COST);
6819 format %{ "adr $dst, $con\t# Byte Map Base" %}
6820
6821 ins_encode(aarch64_enc_mov_byte_map_base(dst, con));
6822
6823 ins_pipe(ialu_imm);
6824 %}
6825
6826 // Load Narrow Pointer Constant
6827
6828 instruct loadConN(iRegNNoSp dst, immN con)
6829 %{
6830 match(Set dst con);
6831
6832 ins_cost(INSN_COST * 4);
6833 format %{ "mov $dst, $con\t# compressed ptr" %}
6834
6835 ins_encode(aarch64_enc_mov_n(dst, con));
6836
6837 ins_pipe(ialu_imm);
6838 %}
6839
6840 // Load Narrow Null Pointer Constant
6841
|
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;
4503 interface(CONST_INTER);
4504 %}
4505
4506 // Pointer Immediate One
4507 // this is used in object initialization (initial object header)
4508 operand immP_1()
4509 %{
4510 predicate(n->get_ptr() == 1);
4511 match(ConP);
4512
4513 op_cost(0);
4514 format %{ %}
4515 interface(CONST_INTER);
4516 %}
4517
4518 // Card Table Byte Map Base
4519 operand immByteMapBase()
4520 %{
4521 // Get base of card map
4522 predicate(BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) &&
4523 is_card_table_address((address)(n->get_ptr())));
4524 match(ConP);
4525
4526 op_cost(0);
4527 format %{ %}
4528 interface(CONST_INTER);
4529 %}
4530
4531 // AOT Runtime Constants Address
4532 operand immAOTRuntimeConstantsAddress()
4533 %{
4534 // Check if the address is in the range of AOT Runtime Constants
4535 predicate(AOTRuntimeConstants::contains((address)(n->get_ptr())));
4536 match(ConP);
4537
4538 op_cost(0);
4539 format %{ %}
4540 interface(CONST_INTER);
4541 %}
4542
4543 // Float and Double operands
4544 // Double Immediate
4545 operand immD()
4546 %{
4547 match(ConD);
4548 op_cost(0);
4549 format %{ %}
4550 interface(CONST_INTER);
4551 %}
4552
4553 // Double Immediate: +0.0d
4554 operand immD0()
4555 %{
6809 %{
6810 match(Set dst con);
6811
6812 ins_cost(INSN_COST);
6813 format %{ "mov $dst, $con\t# nullptr ptr" %}
6814
6815 ins_encode(aarch64_enc_mov_p1(dst, con));
6816
6817 ins_pipe(ialu_imm);
6818 %}
6819
6820 // Load Byte Map Base Constant
6821
6822 instruct loadByteMapBase(iRegPNoSp dst, immByteMapBase con)
6823 %{
6824 match(Set dst con);
6825
6826 ins_cost(INSN_COST);
6827 format %{ "adr $dst, $con\t# Byte Map Base" %}
6828
6829 ins_encode %{
6830 __ load_byte_map_base($dst$$Register);
6831 %}
6832
6833 ins_pipe(ialu_imm);
6834 %}
6835
6836 instruct loadAOTRCAddress(iRegPNoSp dst, immAOTRuntimeConstantsAddress con)
6837 %{
6838 match(Set dst con);
6839
6840 ins_cost(INSN_COST);
6841 format %{ "adr $dst, $con\t# AOT Runtime Constants Address" %}
6842
6843 ins_encode %{
6844 __ load_aotrc_address($dst$$Register, (address)$con$$constant);
6845 %}
6846
6847 ins_pipe(ialu_imm);
6848 %}
6849
6850 // Load Narrow Pointer Constant
6851
6852 instruct loadConN(iRegNNoSp dst, immN con)
6853 %{
6854 match(Set dst con);
6855
6856 ins_cost(INSN_COST * 4);
6857 format %{ "mov $dst, $con\t# compressed ptr" %}
6858
6859 ins_encode(aarch64_enc_mov_n(dst, con));
6860
6861 ins_pipe(ialu_imm);
6862 %}
6863
6864 // Load Narrow Null Pointer Constant
6865
|