--- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp Fri Jan 19 12:48:51 2018 +0100
+++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp Thu Feb 08 20:56:03 2018 +0100
@@ -3280,11 +3280,11 @@
transition(vtos, vtos);
assert(byte_no == f1_byte, "use this argument");
- prepare_invoke(byte_no, r0, rmethod, // get f1 Klass*, f2 itable index
+ prepare_invoke(byte_no, r0, rmethod, // get f1 Klass*, f2 Method*
r2, r3); // recv, flags
// r0: interface klass (from f1)
- // rmethod: itable index (from f2)
+ // rmethod: method (from f2)
// r2: receiver
// r3: flags
@@ -3303,10 +3303,27 @@
__ null_check(r2, oopDesc::klass_offset_in_bytes());
__ load_klass(r3, r2);
+ Label no_such_interface, no_such_method;
+
+ // Receiver subtype check against REFC.
+ // Superklass in r0. Subklass in r3. Blows rscratch2, r13
+ __ lookup_interface_method(// inputs: rec. class, interface, itable index
+ r3, r0, noreg,
+ // outputs: scan temp. reg, scan temp. reg
+ rscratch2, r13,
+ no_such_interface,
+ /*return_method=*/false);
+
// profile this call
__ profile_virtual_call(r3, r13, r19);
- Label no_such_interface, no_such_method;
+ // Get declaring interface class from method, and itable index
+ __ ldr(r0, Address(rmethod, Method::const_offset()));
+ __ ldr(r0, Address(r0, ConstMethod::constants_offset()));
+ __ ldr(r0, Address(r0, ConstantPool::pool_holder_offset_in_bytes()));
+ __ ldrw(rmethod, Address(rmethod, Method::itable_index_offset()));
+ __ subw(rmethod, rmethod, Method::itable_index_max);
+ __ negw(rmethod, rmethod);
__ lookup_interface_method(// inputs: rec. class, interface, itable index
r3, r0, rmethod,