Skip to content

Commit b3cabf0

Browse files
committed
Backport fef4c29e5a296c0c689abb25183c243326607614
1 parent 3a46af4 commit b3cabf0

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

src/hotspot/cpu/ppc/interp_masm_ppc.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class InterpreterMacroAssembler: public MacroAssembler {
3838
InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {}
3939

4040
void null_check_throw(Register a, int offset, Register temp_reg);
41+
void load_klass_check_null_throw(Register dst, Register src, Register temp_reg);
4142

4243
void jump_to_entry(address entry, Register Rscratch);
4344

src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ void InterpreterMacroAssembler::null_check_throw(Register a, int offset, Registe
5454
MacroAssembler::null_check_throw(a, offset, temp_reg, exception_entry);
5555
}
5656

57+
void InterpreterMacroAssembler::load_klass_check_null_throw(Register dst, Register src, Register temp_reg) {
58+
null_check_throw(src, oopDesc::klass_offset_in_bytes(), temp_reg);
59+
load_klass(dst, src);
60+
}
61+
5762
void InterpreterMacroAssembler::jump_to_entry(address entry, Register Rscratch) {
5863
assert(entry, "Entry must have been generated by now");
5964
if (is_within_range_of_b(entry, pc())) {

src/hotspot/cpu/ppc/methodHandles_ppc.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ void MethodHandles::generate_method_handle_dispatch(MacroAssembler* _masm,
348348
? -1 // enforce receiver null check
349349
: oopDesc::klass_offset_in_bytes(); // regular null-checking behavior
350350

351-
__ null_check_throw(receiver_reg, klass_offset, temp1, Interpreter::throw_NullPointerException_entry());
351+
address NullPointerException_entry = for_compiler_entry ? StubRoutines::throw_NullPointerException_at_call_entry()
352+
: Interpreter::throw_NullPointerException_entry();
353+
__ null_check_throw(receiver_reg, klass_offset, temp1, NullPointerException_entry);
352354

353355
if (iid != vmIntrinsics::_linkToSpecial || VerifyMethodHandles) {
354356
__ load_klass(temp1_recv_klass, receiver_reg);

src/hotspot/cpu/ppc/templateTable_ppc_64.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ void TemplateTable::bastore() {
10401040

10411041
// Need to check whether array is boolean or byte
10421042
// since both types share the bastore bytecode.
1043-
__ load_klass(Rscratch, Rarray);
1043+
__ load_klass_check_null_throw(Rscratch, Rarray, Rscratch);
10441044
__ lwz(Rscratch, in_bytes(Klass::layout_helper_offset()), Rscratch);
10451045
int diffbit = exact_log2(Klass::layout_helper_boolean_diffbit());
10461046
__ testbitdi(CCR0, R0, Rscratch, diffbit);
@@ -3440,8 +3440,7 @@ void TemplateTable::invokevirtual(int byte_no) {
34403440
__ load_dispatch_table(Rtable_addr, Interpreter::invoke_return_entry_table());
34413441
__ sldi(Rret_type, Rret_type, LogBytesPerWord);
34423442
__ ldx(Rret_addr, Rret_type, Rtable_addr);
3443-
__ null_check_throw(Rrecv, oopDesc::klass_offset_in_bytes(), R11_scratch1);
3444-
__ load_klass(Rrecv_klass, Rrecv);
3443+
__ load_klass_check_null_throw(Rrecv_klass, Rrecv, R11_scratch1);
34453444
__ verify_klass_ptr(Rrecv_klass);
34463445
__ profile_virtual_call(Rrecv_klass, R11_scratch1, R12_scratch2, false);
34473446

@@ -3578,8 +3577,7 @@ void TemplateTable::invokeinterface(int byte_no) {
35783577
// then regular interface method.
35793578

35803579
// Get receiver klass - this is also a null check
3581-
__ null_check_throw(Rreceiver, oopDesc::klass_offset_in_bytes(), Rscratch2);
3582-
__ load_klass(Rrecv_klass, Rreceiver);
3580+
__ load_klass_check_null_throw(Rrecv_klass, Rreceiver, Rscratch2);
35833581

35843582
// Check corner case object method.
35853583
// Special case of invokeinterface called for virtual method of

0 commit comments

Comments
 (0)