Skip to content

Commit

Permalink
Query throught static method size of NativeCall in shared code
Browse files Browse the repository at this point in the history
  • Loading branch information
robehn committed Jun 5, 2024
1 parent 3cbdf8d commit 6d35a9c
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,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); }
int displacement() const { return (int_at(displacement_offset) << 6) >> 4; }
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/cpu/arm/nativeInst_arm_32.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/cpu/ppc/nativeInst_ppc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/cpu/riscv/nativeInst_riscv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/cpu/s390/nativeInst_s390.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/cpu/x86/nativeInst_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/cpu/zero/nativeInst_zero.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/code/nmethod.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ 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
;
}

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
;
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/opto/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6d35a9c

Please sign in to comment.