[Nestmates] RFR (S): 8197915: [Nestmates] Implement receiver typecheck for private invokeinterface use
david.holmes at oracle.com
Thu May 3 10:21:15 UTC 2018
bug id: https://bugs.openjdk.java.net/browse/JDK-8197915
JDK-8174962 implemented receiver typechecks for invokeinterface within
the interpreter (templateTable), compilers and for MethodHandles. In
nestmates invokeinterface can now be used for private interface methods
- which result in direct calls. So we need to extend the receiver
subtype checks to cover the new cases.
Summary of changes:
In the templateTable the 8174962 checks come after the private interface
method invocation logic ("vfinal") we already had in place for the
nestmate changes, and they rely on itable information that doesn't exist
for private methods. So we insert a direct subtype check.
I've provided code for all CPU's but only x86 and sparc have been
tested. I'll be soliciting aid on the other ports before nestmates goes
to mainline later this month.
We have to pass the interface klass* so it's available for the typecheck.
Updated a comment that's no longer accurate.
This code was provided by Vladimir Ivanov (thank you!) and expands the
existing "invokespecial" support for receiver typechecks in C2, to
"invokeinterface" as well.
Aside: no changes were needed for C1. It's seems all the receiver
typechecks for C1 are being handled at a higher level (through
linkResolver and/or cpCache logic).
Comment clarifying JVM_REF_invokeSpecial doesn't necessarily mean it
relates to an actual "invokespecial" - it is used for all direct calls.
Add clarifying comments regarding how "kind" can vary if a direct call
Expand the condition to switch from LF_INVSPECIAL to LF_INVSPECIAL_IFC
(which adds the additional receiver typecheck) to account for the
New test for invokeinterface semantics that mirrors the existing
SpecialInterfaceCall test for invokespecial.
This is the last of the significant functional changes for nestmates.
More information about the valhalla-dev