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() {
3394 uint64_t con = (uint64_t)$src$$constant;
3395 if (con == 0) {
3396 __ mov(dst_reg, zr);
3397 } else {
3398 __ mov(dst_reg, con);
3399 }
3400 %}
3401
3402 enc_class aarch64_enc_mov_p(iRegP dst, immP src) %{
3403 Register dst_reg = as_Register($dst$$reg);
3404 address con = (address)$src$$constant;
3405 if (con == nullptr || con == (address)1) {
3406 ShouldNotReachHere();
3407 } else {
3408 relocInfo::relocType rtype = $src->constant_reloc();
3409 if (rtype == relocInfo::oop_type) {
3410 __ movoop(dst_reg, (jobject)con);
3411 } else if (rtype == relocInfo::metadata_type) {
3412 __ mov_metadata(dst_reg, (Metadata*)con);
3413 } else {
3414 assert(rtype == relocInfo::none, "unexpected reloc type");
3415 if (! __ is_valid_AArch64_address(con) ||
3416 con < (address)(uintptr_t)os::vm_page_size()) {
3417 __ mov(dst_reg, con);
3418 } else {
3419 uint64_t offset;
3420 __ adrp(dst_reg, con, offset);
3421 __ add(dst_reg, dst_reg, offset);
3422 }
3423 }
3424 }
3425 %}
3426
3427 enc_class aarch64_enc_mov_p0(iRegP dst, immP0 src) %{
3428 Register dst_reg = as_Register($dst$$reg);
3429 __ mov(dst_reg, zr);
3430 %}
3431
3432 enc_class aarch64_enc_mov_p1(iRegP dst, immP_1 src) %{
3433 Register dst_reg = as_Register($dst$$reg);
3434 __ mov(dst_reg, (uint64_t)1);
3435 %}
3436
3437 enc_class aarch64_enc_mov_byte_map_base(iRegP dst, immByteMapBase src) %{
3438 __ load_byte_map_base($dst$$Register);
3439 %}
3440
3441 enc_class aarch64_enc_mov_n(iRegN dst, immN src) %{
3442 Register dst_reg = as_Register($dst$$reg);
3443 address con = (address)$src$$constant;
3444 if (con == nullptr) {
3445 ShouldNotReachHere();
3446 } else {
3447 relocInfo::relocType rtype = $src->constant_reloc();
3448 assert(rtype == relocInfo::oop_type, "unexpected reloc type");
3449 __ set_narrow_oop(dst_reg, (jobject)con);
3450 }
3451 %}
3452
3453 enc_class aarch64_enc_mov_n0(iRegN dst, immN0 src) %{
3454 Register dst_reg = as_Register($dst$$reg);
3455 __ mov(dst_reg, zr);
3456 %}
3457
3458 enc_class aarch64_enc_mov_nk(iRegN dst, immNKlass src) %{
3459 Register dst_reg = as_Register($dst$$reg);
3460 address con = (address)$src$$constant;
4522 interface(CONST_INTER);
4523 %}
4524
4525 // Pointer Immediate One
4526 // this is used in object initialization (initial object header)
4527 operand immP_1()
4528 %{
4529 predicate(n->get_ptr() == 1);
4530 match(ConP);
4531
4532 op_cost(0);
4533 format %{ %}
4534 interface(CONST_INTER);
4535 %}
4536
4537 // Card Table Byte Map Base
4538 operand immByteMapBase()
4539 %{
4540 // Get base of card map
4541 predicate(BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) &&
4542 SHENANDOAHGC_ONLY(!BarrierSet::barrier_set()->is_a(BarrierSet::ShenandoahBarrierSet) &&)
4543 (CardTable::CardValue*)n->get_ptr() == ((CardTableBarrierSet*)(BarrierSet::barrier_set()))->card_table()->byte_map_base());
4544 match(ConP);
4545
4546 op_cost(0);
4547 format %{ %}
4548 interface(CONST_INTER);
4549 %}
4550
4551 // Float and Double operands
4552 // Double Immediate
4553 operand immD()
4554 %{
4555 match(ConD);
4556 op_cost(0);
4557 format %{ %}
4558 interface(CONST_INTER);
4559 %}
4560
4561 // Double Immediate: +0.0d
4562 operand immD0()
4563 %{
6817 %{
6818 match(Set dst con);
6819
6820 ins_cost(INSN_COST);
6821 format %{ "mov $dst, $con\t# nullptr ptr" %}
6822
6823 ins_encode(aarch64_enc_mov_p1(dst, con));
6824
6825 ins_pipe(ialu_imm);
6826 %}
6827
6828 // Load Byte Map Base Constant
6829
6830 instruct loadByteMapBase(iRegPNoSp dst, immByteMapBase con)
6831 %{
6832 match(Set dst con);
6833
6834 ins_cost(INSN_COST);
6835 format %{ "adr $dst, $con\t# Byte Map Base" %}
6836
6837 ins_encode(aarch64_enc_mov_byte_map_base(dst, con));
6838
6839 ins_pipe(ialu_imm);
6840 %}
6841
6842 // Load Narrow Pointer Constant
6843
6844 instruct loadConN(iRegNNoSp dst, immN con)
6845 %{
6846 match(Set dst con);
6847
6848 ins_cost(INSN_COST * 4);
6849 format %{ "mov $dst, $con\t# compressed ptr" %}
6850
6851 ins_encode(aarch64_enc_mov_n(dst, con));
6852
6853 ins_pipe(ialu_imm);
6854 %}
6855
6856 // Load Narrow Null Pointer Constant
6857
|
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() {
3394 uint64_t con = (uint64_t)$src$$constant;
3395 if (con == 0) {
3396 __ mov(dst_reg, zr);
3397 } else {
3398 __ mov(dst_reg, con);
3399 }
3400 %}
3401
3402 enc_class aarch64_enc_mov_p(iRegP dst, immP src) %{
3403 Register dst_reg = as_Register($dst$$reg);
3404 address con = (address)$src$$constant;
3405 if (con == nullptr || con == (address)1) {
3406 ShouldNotReachHere();
3407 } else {
3408 relocInfo::relocType rtype = $src->constant_reloc();
3409 if (rtype == relocInfo::oop_type) {
3410 __ movoop(dst_reg, (jobject)con);
3411 } else if (rtype == relocInfo::metadata_type) {
3412 __ mov_metadata(dst_reg, (Metadata*)con);
3413 } else {
3414 assert(rtype == relocInfo::none || rtype == relocInfo::external_word_type, "unexpected reloc type");
3415 if (! __ is_valid_AArch64_address(con) ||
3416 con < (address)(uintptr_t)os::vm_page_size()) {
3417 __ mov(dst_reg, con);
3418 } else {
3419 uint64_t offset;
3420 __ adrp(dst_reg, con, offset);
3421 __ add(dst_reg, dst_reg, offset);
3422 }
3423 }
3424 }
3425 %}
3426
3427 enc_class aarch64_enc_mov_p0(iRegP dst, immP0 src) %{
3428 Register dst_reg = as_Register($dst$$reg);
3429 __ mov(dst_reg, zr);
3430 %}
3431
3432 enc_class aarch64_enc_mov_p1(iRegP dst, immP_1 src) %{
3433 Register dst_reg = as_Register($dst$$reg);
3434 __ mov(dst_reg, (uint64_t)1);
3435 %}
3436
3437 enc_class aarch64_enc_mov_n(iRegN dst, immN src) %{
3438 Register dst_reg = as_Register($dst$$reg);
3439 address con = (address)$src$$constant;
3440 if (con == nullptr) {
3441 ShouldNotReachHere();
3442 } else {
3443 relocInfo::relocType rtype = $src->constant_reloc();
3444 assert(rtype == relocInfo::oop_type, "unexpected reloc type");
3445 __ set_narrow_oop(dst_reg, (jobject)con);
3446 }
3447 %}
3448
3449 enc_class aarch64_enc_mov_n0(iRegN dst, immN0 src) %{
3450 Register dst_reg = as_Register($dst$$reg);
3451 __ mov(dst_reg, zr);
3452 %}
3453
3454 enc_class aarch64_enc_mov_nk(iRegN dst, immNKlass src) %{
3455 Register dst_reg = as_Register($dst$$reg);
3456 address con = (address)$src$$constant;
4518 interface(CONST_INTER);
4519 %}
4520
4521 // Pointer Immediate One
4522 // this is used in object initialization (initial object header)
4523 operand immP_1()
4524 %{
4525 predicate(n->get_ptr() == 1);
4526 match(ConP);
4527
4528 op_cost(0);
4529 format %{ %}
4530 interface(CONST_INTER);
4531 %}
4532
4533 // Card Table Byte Map Base
4534 operand immByteMapBase()
4535 %{
4536 // Get base of card map
4537 predicate(BarrierSet::barrier_set()->is_a(BarrierSet::CardTableBarrierSet) &&
4538 is_card_table_address((address)(n->get_ptr())));
4539 match(ConP);
4540
4541 op_cost(0);
4542 format %{ %}
4543 interface(CONST_INTER);
4544 %}
4545
4546 // AOT Runtime Constants Address
4547 operand immAOTRuntimeConstantsAddress()
4548 %{
4549 // Check if the address is in the range of AOT Runtime Constants
4550 predicate(AOTRuntimeConstants::contains((address)(n->get_ptr())));
4551 match(ConP);
4552
4553 op_cost(0);
4554 format %{ %}
4555 interface(CONST_INTER);
4556 %}
4557
4558 // Float and Double operands
4559 // Double Immediate
4560 operand immD()
4561 %{
4562 match(ConD);
4563 op_cost(0);
4564 format %{ %}
4565 interface(CONST_INTER);
4566 %}
4567
4568 // Double Immediate: +0.0d
4569 operand immD0()
4570 %{
6824 %{
6825 match(Set dst con);
6826
6827 ins_cost(INSN_COST);
6828 format %{ "mov $dst, $con\t# nullptr ptr" %}
6829
6830 ins_encode(aarch64_enc_mov_p1(dst, con));
6831
6832 ins_pipe(ialu_imm);
6833 %}
6834
6835 // Load Byte Map Base Constant
6836
6837 instruct loadByteMapBase(iRegPNoSp dst, immByteMapBase con)
6838 %{
6839 match(Set dst con);
6840
6841 ins_cost(INSN_COST);
6842 format %{ "adr $dst, $con\t# Byte Map Base" %}
6843
6844 ins_encode %{
6845 __ load_byte_map_base($dst$$Register);
6846 %}
6847
6848 ins_pipe(ialu_imm);
6849 %}
6850
6851 instruct loadAOTRCAddress(iRegPNoSp dst, immAOTRuntimeConstantsAddress con)
6852 %{
6853 match(Set dst con);
6854
6855 ins_cost(INSN_COST);
6856 format %{ "adr $dst, $con\t# AOT Runtime Constants Address" %}
6857
6858 ins_encode %{
6859 __ load_aotrc_address($dst$$Register, (address)$con$$constant);
6860 %}
6861
6862 ins_pipe(ialu_imm);
6863 %}
6864
6865 // Load Narrow Pointer Constant
6866
6867 instruct loadConN(iRegNNoSp dst, immN con)
6868 %{
6869 match(Set dst con);
6870
6871 ins_cost(INSN_COST * 4);
6872 format %{ "mov $dst, $con\t# compressed ptr" %}
6873
6874 ins_encode(aarch64_enc_mov_n(dst, con));
6875
6876 ins_pipe(ialu_imm);
6877 %}
6878
6879 // Load Narrow Null Pointer Constant
6880
|