Skip to content

Commit

Permalink
v0
Browse files Browse the repository at this point in the history
  • Loading branch information
reinrich committed Dec 15, 2023
1 parent bdebf19 commit 210ec38
Show file tree
Hide file tree
Showing 30 changed files with 91 additions and 150 deletions.
2 changes: 0 additions & 2 deletions src/hotspot/cpu/aarch64/frame_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@
static void verify_deopt_original_pc( CompiledMethod* nm, intptr_t* unextended_sp);
#endif

const ImmutableOopMap* get_oop_map() const;

public:
// Constructors

Expand Down
14 changes: 0 additions & 14 deletions src/hotspot/cpu/aarch64/frame_aarch64.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,20 +359,6 @@ inline int frame::sender_sp_ret_address_offset() {
return frame::sender_sp_offset - frame::return_addr_offset;
}

inline const ImmutableOopMap* frame::get_oop_map() const {
if (_cb == nullptr) return nullptr;
if (_cb->oop_maps() != nullptr) {
NativePostCallNop* nop = nativePostCallNop_at(_pc);
if (nop != nullptr && nop->displacement() != 0) {
int slot = ((nop->displacement() >> 24) & 0xff);
return _cb->oop_map_for_slot(slot, _pc);
}
const ImmutableOopMap* oop_map = OopMapSet::find_map(this);
return oop_map;
}
return nullptr;
}

//------------------------------------------------------------------------------
// frame::sender
inline frame frame::sender(RegisterMap* map) const {
Expand Down
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
2 changes: 0 additions & 2 deletions src/hotspot/cpu/arm/frame_arm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@
}
#endif

const ImmutableOopMap* get_oop_map() const;

public:
// Constructors

Expand Down
14 changes: 0 additions & 14 deletions src/hotspot/cpu/arm/frame_arm.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,6 @@ inline int frame::frame_size() const {
return sender_sp() - sp();
}

inline const ImmutableOopMap* frame::get_oop_map() const {
if (_cb == nullptr) return nullptr;
if (_cb->oop_maps() != nullptr) {
NativePostCallNop* nop = nativePostCallNop_at(_pc);
if (nop != nullptr && nop->displacement() != 0) {
int slot = ((nop->displacement() >> 24) & 0xff);
return _cb->oop_map_for_slot(slot, _pc);
}
const ImmutableOopMap* oop_map = OopMapSet::find_map(this);
return oop_map;
}
return nullptr;
}

inline int frame::compiled_frame_stack_argsize() const {
Unimplemented();
return 0;
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/cpu/arm/nativeInst_arm_32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,6 @@ void NativePostCallNop::make_deopt() {
NativeDeoptInstruction::insert(addr_at(0));
}

void NativePostCallNop::patch(jint diff) {
// unsupported for now
}

void NativeDeoptInstruction::verify() {
}

Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/cpu/arm/nativeInst_arm_32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,10 @@ inline NativeCall* nativeCall_before(address return_address) {

class NativePostCallNop: public NativeInstruction {
public:
// Currently no data is encoded
bool check() const { return is_nop(); }
int displacement() const { return 0; }
void patch(jint diff);
bool decode(int32_t& oopmap_slot, int32_t& cb_offset) const { return false; }
bool patch(int32_t oopmap_slot, int32_t cb_offset) { return true; }
void make_deopt();
};

Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/cpu/ppc/frame_ppc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,6 @@

public:

const ImmutableOopMap* get_oop_map() const;

// Constructors
inline frame(intptr_t* sp, intptr_t* fp, address pc);
inline frame(intptr_t* sp, address pc, intptr_t* unextended_sp = nullptr, intptr_t* fp = nullptr, CodeBlob* cb = nullptr);
Expand Down
14 changes: 0 additions & 14 deletions src/hotspot/cpu/ppc/frame_ppc.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,20 +361,6 @@ inline void frame::set_saved_oop_result(RegisterMap* map, oop obj) {
*result_adr = obj;
}

inline const ImmutableOopMap* frame::get_oop_map() const {
if (_cb == nullptr) return nullptr;
if (_cb->oop_maps() != nullptr) {
NativePostCallNop* nop = nativePostCallNop_at(_pc);
if (nop != nullptr && nop->displacement() != 0) {
int slot = ((nop->displacement() >> 24) & 0xff);
return _cb->oop_map_for_slot(slot, _pc);
}
const ImmutableOopMap* oop_map = OopMapSet::find_map(this);
return oop_map;
}
return nullptr;
}

inline int frame::compiled_frame_stack_argsize() const {
assert(cb()->is_compiled(), "");
return (cb()->as_compiled_method()->method()->num_stack_arg_slots() * VMRegImpl::stack_slot_size) >> LogBytesPerWord;
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/cpu/ppc/nativeInst_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,6 @@ void NativePostCallNop::make_deopt() {
NativeDeoptInstruction::insert(addr_at(0));
}

void NativePostCallNop::patch(jint diff) {
// unsupported for now
}

void NativeDeoptInstruction::verify() {
}

Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/cpu/ppc/nativeInst_ppc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,10 @@ class NativeMovRegMem: public NativeInstruction {

class NativePostCallNop: public NativeInstruction {
public:
// Currently no data is encoded
bool check() const { return is_nop(); }
int displacement() const { return 0; }
void patch(jint diff);
bool decode(int32_t& oopmap_slot, int32_t& cb_offset) const { return false; }
bool patch(int32_t oopmap_slot, int32_t cb_offset) { return true; }
void make_deopt();
};

Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/cpu/riscv/frame_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@
static void verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp);
#endif

const ImmutableOopMap* get_oop_map() const;

public:
// Constructors

Expand Down
14 changes: 0 additions & 14 deletions src/hotspot/cpu/riscv/frame_riscv.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,20 +345,6 @@ inline int frame::sender_sp_ret_address_offset() {
return frame::sender_sp_offset - frame::return_addr_offset;
}

inline const ImmutableOopMap* frame::get_oop_map() const {
if (_cb == nullptr) return nullptr;
if (_cb->oop_maps() != nullptr) {
NativePostCallNop* nop = nativePostCallNop_at(_pc);
if (nop != nullptr && nop->displacement() != 0) {
int slot = ((nop->displacement() >> 24) & 0xff);
return _cb->oop_map_for_slot(slot, _pc);
}
const ImmutableOopMap* oop_map = OopMapSet::find_map(this);
return oop_map;
}
return nullptr;
}

//------------------------------------------------------------------------------
// frame::sender
frame frame::sender(RegisterMap* map) const {
Expand Down
21 changes: 16 additions & 5 deletions src/hotspot/cpu/riscv/nativeInst_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,16 +451,27 @@ void NativePostCallNop::make_deopt() {
NativeDeoptInstruction::insert(addr_at(0));
}

int NativePostCallNop::displacement() const {
bool NativePostCallNop::decode(int32_t& oopmap_slot, int32_t& cb_offset) const {
// Discard the high 32 bits
return (int)(intptr_t)MacroAssembler::get_target_of_li32(addr_at(4));
int32_t data = (int32_t)(intptr_t)MacroAssembler::get_target_of_li32(addr_at(4));
if (data == 0) {
return false; // no information encoded
}
cb_offset = (data & 0xffffff);
oopmap_slot = (data >> 24) & 0xff;
return true; // decoding succeeded
}

void NativePostCallNop::patch(jint diff) {
assert(diff != 0, "must be");
bool NativePostCallNop::patch(int32_t oopmap_slot, int32_t cb_offset) {
if (((oopmap_slot & 0xff) != oopmap_slot) || ((cb_offset & 0xffffff) != cb_offset)) {
return false;
}
int32_t data = (oopmap_slot << 24) | cb_offset;
assert(data != 0, "must be");
assert(is_lui_to_zr_at(addr_at(4)) && is_addiw_to_zr_at(addr_at(8)), "must be");

MacroAssembler::patch_imm_in_li32(addr_at(4), diff);
MacroAssembler::patch_imm_in_li32(addr_at(4), data);
return true;
}

void NativeDeoptInstruction::verify() {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/riscv/nativeInst_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ class NativePostCallNop: public NativeInstruction {
// an addiw as well.
return is_nop() && is_lui_to_zr_at(addr_at(4));
}
int displacement() const;
void patch(jint diff);
bool decode(int32_t& oopmap_slot, int32_t& cb_offset) const;
bool patch(int32_t oopmap_slot, int32_t cb_offset);
void make_deopt();
};

Expand Down
1 change: 0 additions & 1 deletion src/hotspot/cpu/s390/frame_s390.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,6 @@

// Initialize frame members (_pc and _sp must be given)
inline void setup();
const ImmutableOopMap* get_oop_map() const;

// Constructors

Expand Down
14 changes: 0 additions & 14 deletions src/hotspot/cpu/s390/frame_s390.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,20 +292,6 @@ inline intptr_t* frame::real_fp() const {
return fp();
}

inline const ImmutableOopMap* frame::get_oop_map() const {
if (_cb == nullptr) return nullptr;
if (_cb->oop_maps() != nullptr) {
NativePostCallNop* nop = nativePostCallNop_at(_pc);
if (nop != nullptr && nop->displacement() != 0) {
int slot = ((nop->displacement() >> 24) & 0xff);
return _cb->oop_map_for_slot(slot, _pc);
}
const ImmutableOopMap* oop_map = OopMapSet::find_map(this);
return oop_map;
}
return nullptr;
}

inline int frame::compiled_frame_stack_argsize() const {
Unimplemented();
return 0;
Expand Down
6 changes: 3 additions & 3 deletions src/hotspot/cpu/s390/nativeInst_s390.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,9 +657,9 @@ class NativeGeneralJump: public NativeInstruction {
class NativePostCallNop: public NativeInstruction {
public:
bool check() const { Unimplemented(); return false; }
int displacement() const { return 0; }
void patch(jint diff) { Unimplemented(); }
void make_deopt() { Unimplemented(); }
bool decode(int32_t& oopmap_slot, int32_t& cb_offset) const { return false; }
bool patch(int32_t oopmap_slot, int32_t cb_offset) { Unimplemented() ; return false; }
void make_deopt();
};

inline NativePostCallNop* nativePostCallNop_at(address address) {
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/cpu/x86/frame_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,6 @@
static void verify_deopt_original_pc(CompiledMethod* nm, intptr_t* unextended_sp);
#endif

const ImmutableOopMap* get_oop_map() const;

public:
// Constructors

Expand Down
14 changes: 0 additions & 14 deletions src/hotspot/cpu/x86/frame_x86.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,20 +343,6 @@ inline int frame::sender_sp_ret_address_offset() {
return frame::sender_sp_offset - frame::return_addr_offset;
}

inline const ImmutableOopMap* frame::get_oop_map() const {
if (_cb == nullptr) return nullptr;
if (_cb->oop_maps() != nullptr) {
NativePostCallNop* nop = nativePostCallNop_at(_pc);
if (nop != nullptr && nop->displacement() != 0) {
int slot = ((nop->displacement() >> 24) & 0xff);
return _cb->oop_map_for_slot(slot, _pc);
}
const ImmutableOopMap* oop_map = OopMapSet::find_map(this);
return oop_map;
}
return nullptr;
}

//------------------------------------------------------------------------------
// frame::sender

Expand Down
11 changes: 8 additions & 3 deletions src/hotspot/cpu/x86/nativeInst_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,10 +684,15 @@ void NativePostCallNop::make_deopt() {
ICache::invalidate_range(instr_addr, instruction_size);
}

void NativePostCallNop::patch(jint diff) {
assert(diff != 0, "must be");
bool NativePostCallNop::patch(int32_t oopmap_slot, int32_t cb_offset) {
if (((oopmap_slot & 0xff) != oopmap_slot) || ((cb_offset & 0xffffff) != cb_offset)) {
return false;
}
int32_t data = (oopmap_slot << 24) | cb_offset;
assert(data != 0, "must be");
int32_t *code_pos = (int32_t *) addr_at(displacement_offset);
*((int32_t *)(code_pos)) = (int32_t) diff;
*((int32_t *)(code_pos)) = (int32_t) data;
return true;
}

void NativeDeoptInstruction::verify() {
Expand Down
12 changes: 10 additions & 2 deletions src/hotspot/cpu/x86/nativeInst_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,16 @@ class NativePostCallNop: public NativeInstruction {
};

bool check() const { return int_at(0) == 0x841f0f; }
int displacement() const { return (jint) int_at(displacement_offset); }
void patch(jint diff);
bool decode(int32_t& oopmap_slot, int32_t& cb_offset) const {
int32_t data = int_at(displacement_offset);
if (data == 0) {
return false; // information not found
}
cb_offset = (data & 0xffffff);
oopmap_slot = (data >> 24) & 0xff;
return true; // decoding succeeded
}
bool patch(int32_t oopmap_slot, int32_t cb_offset);
void make_deopt();
};

Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/cpu/zero/frame_zero.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
align_wiggle = 1
};

const ImmutableOopMap* get_oop_map() const;

// Constructor
public:
frame(ZeroFrame* zeroframe, intptr_t* sp);
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/zero/frame_zero.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,6 @@ inline intptr_t* frame::unextended_sp() const {
return (intptr_t *) -1;
}

inline const ImmutableOopMap* frame::get_oop_map() const {
Unimplemented();
return nullptr;
}

inline int frame::compiled_frame_stack_argsize() const {
Unimplemented();
return 0;
Expand Down
Loading

0 comments on commit 210ec38

Please sign in to comment.