Skip to content

Commit

Permalink
8289743: AArch64: Clean up patching logic
Browse files Browse the repository at this point in the history
Reviewed-by: adinn, ngasson
  • Loading branch information
Andrew Haley committed Jul 20, 2022
1 parent 011958d commit 1c05507
Show file tree
Hide file tree
Showing 6 changed files with 453 additions and 183 deletions.
6 changes: 1 addition & 5 deletions src/hotspot/cpu/aarch64/assembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ void Address::lea(MacroAssembler *as, Register r) const {
}
}

void Assembler::adrp(Register reg1, const Address &dest, uint64_t &byte_offset) {
ShouldNotReachHere();
}

#undef __

#define starti Instruction_aarch64 current_insn(this);
Expand Down Expand Up @@ -189,7 +185,7 @@ void Assembler::adrp(Register reg1, const Address &dest, uint64_t &byte_offset)
offset >>= 2;
starti;
f(1, 31), f(offset_lo, 30, 29), f(0b10000, 28, 24), sf(offset, 23, 5);
rf(Rd, 0);
zrf(Rd, 0);
}

// An "all-purpose" add/subtract immediate, per ARM documentation:
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/aarch64/assembler_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class Instruction_aarch64 {
return extend(uval, msb - lsb);
}

static void patch(address a, int msb, int lsb, uint64_t val) {
static ALWAYSINLINE void patch(address a, int msb, int lsb, uint64_t val) {
int nbits = msb - lsb + 1;
guarantee(val < (1ULL << nbits), "Field too big for insn");
assert_cond(msb >= lsb);
Expand Down Expand Up @@ -718,7 +718,7 @@ class Assembler : public AbstractAssembler {
wrap_label(Rd, L, &Assembler::_adrp);
}

void adrp(Register Rd, const Address &dest, uint64_t &offset);
void adrp(Register Rd, const Address &dest, uint64_t &offset) = delete;

#undef INSN

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2690,7 +2690,7 @@ void LIR_Assembler::emit_updatecrc32(LIR_OpUpdateCRC32* op) {
assert_different_registers(val, crc, res);
uint64_t offset;
__ adrp(res, ExternalAddress(StubRoutines::crc_table_addr()), offset);
if (offset) __ add(res, res, offset);
__ add(res, res, offset);

__ mvnw(crc, crc); // ~crc
__ update_byte_crc32(crc, val, res);
Expand Down
7 changes: 6 additions & 1 deletion src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,12 @@ void InterpreterMacroAssembler::get_unsigned_2_byte_index_at_bcp(
void InterpreterMacroAssembler::get_dispatch() {
uint64_t offset;
adrp(rdispatch, ExternalAddress((address)Interpreter::dispatch_table()), offset);
lea(rdispatch, Address(rdispatch, offset));
// Use add() here after ARDP, rather than lea().
// lea() does not generate anything if its offset is zero.
// However, relocs expect to find either an ADD or a load/store
// insn after an ADRP. add() always generates an ADD insn, even
// for add(Rn, Rn, 0).
add(rdispatch, rdispatch, offset);
}

void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index,
Expand Down

1 comment on commit 1c05507

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.