46 // real hardware we will need to pull taht code into here
47
48 #include "immediate_aarch64.hpp"
49
50 // #include "gc_interface/collectedHeap.inline.hpp"
51 // #include "interpreter/interpreter.hpp"
52 // #include "memory/cardTableModRefBS.hpp"
53 // #include "prims/methodHandles.hpp"
54 // #include "runtime/biasedLocking.hpp"
55 // #include "runtime/interfaceSupport.hpp"
56 // #include "runtime/objectMonitor.hpp"
57 // #include "runtime/os.hpp"
58 // #include "runtime/sharedRuntime.hpp"
59 // #include "runtime/stubRoutines.hpp"
60 // #if INCLUDE_ALL_GCS
61 // #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
62 // #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
63 // #include "gc_implementation/g1/heapRegion.hpp"
64 // #endif
65
66
67 extern "C" void entry(CodeBuffer *cb);
68
69 #define __ _masm.
70 #ifdef PRODUCT
71 #define BLOCK_COMMENT(str) /* nothing */
72 #else
73 #define BLOCK_COMMENT(str) block_comment(str)
74 #endif
75
76 #define BIND(label) bind(label); __ BLOCK_COMMENT(#label ":")
77
78 static float unpack(unsigned value);
79
80 void entry(CodeBuffer *cb) {
81
82 // {
83 // for (int i = 0; i < 256; i+=16)
84 // {
85 // printf("\"%20.20g\", ", unpack(i));
86 // printf("\"%20.20g\", ", unpack(i+1));
1345
1346 void Assembler::b(const Address &dest) {
1347 code_section()->relocate(pc(), dest.rspec());
1348 b(dest.target());
1349 }
1350
1351 void Assembler::bl(const Address &dest) {
1352 code_section()->relocate(pc(), dest.rspec());
1353 bl(dest.target());
1354 }
1355
1356 void Assembler::adr(Register r, const Address &dest) {
1357 code_section()->relocate(pc(), dest.rspec());
1358 adr(r, dest.target());
1359 }
1360
1361 void Assembler::br(Condition cc, Label &L) {
1362 if (L.is_bound()) {
1363 br(cc, target(L));
1364 } else {
1365 InstructionMark im(this);
1366 L.add_patch_at(code(), locator());
1367 br(cc, pc());
1368 }
1369 }
1370
1371 void Assembler::wrap_label(Label &L,
1372 Assembler::uncond_branch_insn insn) {
1373 if (L.is_bound()) {
1374 (this->*insn)(target(L));
1375 } else {
1376 InstructionMark im(this);
1377 L.add_patch_at(code(), locator());
1378 (this->*insn)(pc());
1379 }
1380 }
1381
1382 void Assembler::wrap_label(Register r, Label &L,
1383 compare_and_branch_insn insn) {
1384 if (L.is_bound()) {
1385 (this->*insn)(r, target(L));
1386 } else {
1387 InstructionMark im(this);
1388 L.add_patch_at(code(), locator());
1389 (this->*insn)(r, pc());
1390 }
1391 }
1392
1393 void Assembler::wrap_label(Register r, int bitpos, Label &L,
1394 test_and_branch_insn insn) {
1395 if (L.is_bound()) {
1396 (this->*insn)(r, bitpos, target(L));
1397 } else {
1398 InstructionMark im(this);
1399 L.add_patch_at(code(), locator());
1400 (this->*insn)(r, bitpos, pc());
1401 }
1402 }
1403
1404 void Assembler::wrap_label(Label &L, prfop op, prefetch_insn insn) {
1405 if (L.is_bound()) {
1406 (this->*insn)(target(L), op);
1407 } else {
1408 InstructionMark im(this);
1409 L.add_patch_at(code(), locator());
1410 (this->*insn)(pc(), op);
1411 }
1412 }
1413
1414 // An "all-purpose" add/subtract immediate, per ARM documentation:
1415 // A "programmer-friendly" assembler may accept a negative immediate
1416 // between -(2^24 -1) and -1 inclusive, causing it to convert a
1417 // requested ADD operation to a SUB, or vice versa, and then encode
1418 // the absolute value of the immediate as for uimm24.
1419 void Assembler::add_sub_immediate(Register Rd, Register Rn, unsigned uimm, int op,
1420 int negated_op) {
1421 bool sets_flags = op & 1; // this op sets flags
1422 union {
1423 unsigned u;
1424 int imm;
1425 };
1426 u = uimm;
1427 bool shift = false;
1428 bool neg = imm < 0;
|
46 // real hardware we will need to pull taht code into here
47
48 #include "immediate_aarch64.hpp"
49
50 // #include "gc_interface/collectedHeap.inline.hpp"
51 // #include "interpreter/interpreter.hpp"
52 // #include "memory/cardTableModRefBS.hpp"
53 // #include "prims/methodHandles.hpp"
54 // #include "runtime/biasedLocking.hpp"
55 // #include "runtime/interfaceSupport.hpp"
56 // #include "runtime/objectMonitor.hpp"
57 // #include "runtime/os.hpp"
58 // #include "runtime/sharedRuntime.hpp"
59 // #include "runtime/stubRoutines.hpp"
60 // #if INCLUDE_ALL_GCS
61 // #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
62 // #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
63 // #include "gc_implementation/g1/heapRegion.hpp"
64 // #endif
65
66 extern "C" void entry(CodeBuffer *cb);
67
68 #define __ _masm.
69 #ifdef PRODUCT
70 #define BLOCK_COMMENT(str) /* nothing */
71 #else
72 #define BLOCK_COMMENT(str) block_comment(str)
73 #endif
74
75 #define BIND(label) bind(label); __ BLOCK_COMMENT(#label ":")
76
77 static float unpack(unsigned value);
78
79 void entry(CodeBuffer *cb) {
80
81 // {
82 // for (int i = 0; i < 256; i+=16)
83 // {
84 // printf("\"%20.20g\", ", unpack(i));
85 // printf("\"%20.20g\", ", unpack(i+1));
1344
1345 void Assembler::b(const Address &dest) {
1346 code_section()->relocate(pc(), dest.rspec());
1347 b(dest.target());
1348 }
1349
1350 void Assembler::bl(const Address &dest) {
1351 code_section()->relocate(pc(), dest.rspec());
1352 bl(dest.target());
1353 }
1354
1355 void Assembler::adr(Register r, const Address &dest) {
1356 code_section()->relocate(pc(), dest.rspec());
1357 adr(r, dest.target());
1358 }
1359
1360 void Assembler::br(Condition cc, Label &L) {
1361 if (L.is_bound()) {
1362 br(cc, target(L));
1363 } else {
1364 L.add_patch_at(code(), locator());
1365 br(cc, pc());
1366 }
1367 }
1368
1369 void Assembler::wrap_label(Label &L,
1370 Assembler::uncond_branch_insn insn) {
1371 if (L.is_bound()) {
1372 (this->*insn)(target(L));
1373 } else {
1374 L.add_patch_at(code(), locator());
1375 (this->*insn)(pc());
1376 }
1377 }
1378
1379 void Assembler::wrap_label(Register r, Label &L,
1380 compare_and_branch_insn insn) {
1381 if (L.is_bound()) {
1382 (this->*insn)(r, target(L));
1383 } else {
1384 L.add_patch_at(code(), locator());
1385 (this->*insn)(r, pc());
1386 }
1387 }
1388
1389 void Assembler::wrap_label(Register r, int bitpos, Label &L,
1390 test_and_branch_insn insn) {
1391 if (L.is_bound()) {
1392 (this->*insn)(r, bitpos, target(L));
1393 } else {
1394 L.add_patch_at(code(), locator());
1395 (this->*insn)(r, bitpos, pc());
1396 }
1397 }
1398
1399 void Assembler::wrap_label(Label &L, prfop op, prefetch_insn insn) {
1400 if (L.is_bound()) {
1401 (this->*insn)(target(L), op);
1402 } else {
1403 L.add_patch_at(code(), locator());
1404 (this->*insn)(pc(), op);
1405 }
1406 }
1407
1408 // An "all-purpose" add/subtract immediate, per ARM documentation:
1409 // A "programmer-friendly" assembler may accept a negative immediate
1410 // between -(2^24 -1) and -1 inclusive, causing it to convert a
1411 // requested ADD operation to a SUB, or vice versa, and then encode
1412 // the absolute value of the immediate as for uimm24.
1413 void Assembler::add_sub_immediate(Register Rd, Register Rn, unsigned uimm, int op,
1414 int negated_op) {
1415 bool sets_flags = op & 1; // this op sets flags
1416 union {
1417 unsigned u;
1418 int imm;
1419 };
1420 u = uimm;
1421 bool shift = false;
1422 bool neg = imm < 0;
|