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