Skip to content

Commit

Permalink
aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
reinrich committed Dec 1, 2023
1 parent b80d37d commit ed6d3c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
13 changes: 9 additions & 4 deletions src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,18 +560,23 @@ static bool is_movk_to_zr(uint32_t insn) {
}
#endif

void NativePostCallNop::patch(jint diff) {
bool NativePostCallNop::patch(int32_t oopmap_slot, int32_t cb_offset) {
if (((oopmap_slot & 0xff) != oopmap_slot) || ((cb_offset & 0xffffff) != cb_offset)) {
return false;
}
uint32_t data = (oopmap_slot << 24) | cb_offset;
#ifdef ASSERT
assert(diff != 0, "must be");
assert(data != 0, "must be");
uint32_t insn1 = uint_at(4);
uint32_t insn2 = uint_at(8);
assert (is_movk_to_zr(insn1) && is_movk_to_zr(insn2), "must be");
#endif

uint32_t lo = diff & 0xffff;
uint32_t hi = (uint32_t)diff >> 16;
uint32_t lo = data & 0xffff;
uint32_t hi = data >> 16;
Instruction_aarch64::patch(addr_at(4), 20, 5, lo);
Instruction_aarch64::patch(addr_at(8), 20, 5, hi);
return true;
}

void NativeDeoptInstruction::verify() {
Expand Down
14 changes: 9 additions & 5 deletions src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,16 +691,20 @@ class NativePostCallNop: public NativeInstruction {
return (insns & 0xffe0001fffffffff) == 0xf280001fd503201f;
}

jint displacement() const {
bool decode(int32_t& oopmap_slot, int32_t& cb_offset) const {
uint64_t movk_insns = *(uint64_t*)addr_at(4);
uint32_t lo = (movk_insns >> 5) & 0xffff;
uint32_t hi = (movk_insns >> (5 + 32)) & 0xffff;
uint32_t result = (hi << 16) | lo;

return (jint)result;
uint32_t data = (hi << 16) | lo;
if (data == 0) {
return false; // information not found
}
cb_offset = (data & 0xffffff);
oopmap_slot = (data >> 24) & 0xff;
return true; // decoding succeeded
}

void patch(jint diff);
bool patch(int32_t oopmap_slot, int32_t cb_offset);
void make_deopt();
};

Expand Down

0 comments on commit ed6d3c7

Please sign in to comment.