8333649: Allow different NativeCall encodings

Reviewed-by: kvn, mli
This commit is contained in:
Robbin Ehn 2024-06-11 05:48:16 +00:00
parent fe9c63cf73
commit 4d6064a760
9 changed files with 12 additions and 3 deletions

View File

@ -168,6 +168,7 @@ public:
return_address_offset = 4
};
static int byte_size() { return instruction_size; }
address instruction_address() const { return addr_at(instruction_offset); }
address next_instruction_address() const { return addr_at(return_address_offset); }
int displacement() const { return (int_at(displacement_offset) << 6) >> 4; }

View File

@ -415,6 +415,7 @@ inline NativeJump* nativeJump_at(address address) {
class NativeCall: public RawNativeCall {
public:
static int byte_size() { return instruction_size; }
// NativeCall::next_instruction_address() is used only to define the
// range where to look for the relocation information. We need not
// walk over composed instructions (as long as the relocation information

View File

@ -137,6 +137,8 @@ class NativeCall: public NativeInstruction {
instruction_size = 16 // Used in shared code for calls with reloc_info.
};
static int byte_size() { return instruction_size; }
static bool is_call_at(address a) {
return Assembler::is_bl(*(int*)(a));
}

View File

@ -126,6 +126,7 @@ class NativeCall: public NativeInstruction {
return_address_offset = 4
};
static int byte_size() { return instruction_size; }
address instruction_address() const { return addr_at(instruction_offset); }
address next_instruction_address() const { return addr_at(return_address_offset); }
address return_address() const { return addr_at(return_address_offset); }

View File

@ -212,6 +212,7 @@ class NativeCall: public NativeInstruction {
call_far_pcrelative_displacement_alignment = 4
};
static int byte_size() { return instruction_size; }
// Maximum size (in bytes) of a call to an absolute address.
// Used when emitting call to deopt handler blob, which is a

View File

@ -160,6 +160,7 @@ class NativeCall: public NativeInstruction {
return_address_offset = 5
};
static int byte_size() { return instruction_size; }
address instruction_address() const { return addr_at(instruction_offset); }
address next_instruction_address() const { return addr_at(return_address_offset); }
int displacement() const { return (jint) int_at(displacement_offset); }

View File

@ -70,6 +70,8 @@ class NativeCall : public NativeInstruction {
instruction_size = 0 // not used within the interpreter
};
static int byte_size() { return instruction_size; }
address instruction_address() const {
ShouldNotCallThis();
return nullptr;

View File

@ -37,7 +37,7 @@ inline bool nmethod::is_deopt_pc(address pc) { return is_deopt_entry(pc) || is_d
inline bool nmethod::is_deopt_entry(address pc) {
return pc == deopt_handler_begin()
#if INCLUDE_JVMCI
|| (is_compiled_by_jvmci() && pc == (deopt_handler_begin() + NativeCall::instruction_size))
|| (is_compiled_by_jvmci() && pc == (deopt_handler_begin() + NativeCall::byte_size()))
#endif
;
}
@ -45,7 +45,7 @@ inline bool nmethod::is_deopt_entry(address pc) {
inline bool nmethod::is_deopt_mh_entry(address pc) {
return pc == deopt_mh_handler_begin()
#if INCLUDE_JVMCI
|| (is_compiled_by_jvmci() && pc == (deopt_mh_handler_begin() + NativeCall::instruction_size))
|| (is_compiled_by_jvmci() && pc == (deopt_mh_handler_begin() + NativeCall::byte_size()))
#endif
;
}

View File

@ -1321,7 +1321,7 @@ CodeBuffer* PhaseOutput::init_buffer() {
int code_req = _buf_sizes._code;
int const_req = _buf_sizes._const;
int pad_req = NativeCall::instruction_size;
int pad_req = NativeCall::byte_size();
BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
stub_req += bs->estimate_stub_size();