[11] RFR (S): 8202465: C1: Casts should not be eliminated for interface types

John Rose john.r.rose at oracle.com
Thu May 3 02:46:40 UTC 2018


Never trust an interface – as a static type, that is.

IIRC we shook this class of bugs out of C2 in the early 2000's.

We should survey is_subtype_of calls for other uncritical
uses of static types which may be interfaces.  Calling is_loaded
probably a good indicator that the klass is being used as
a static type.

— John

On May 2, 2018, at 7:33 PM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
> http://cr.openjdk.java.net/~vlivanov/8202465/webrev.00
> https://bugs.openjdk.java.net/browse/JDK-8202465
> Interface casts can't be eliminated when there's no exact type known for the object and its declared type is interface as well. Verifier doesn't enforce interface types, so there are no guarantees at runtime that values have interface types as declared in bytecode.
> The fix checks that declared type of the object being casted is not an interface before performing subtype check.
> Also, refactored the test to use jasm instead of jcod.
> Testing: failing test, hs-precheckin-comp, hs-tier1, hs-tier2
> Thanks!
> Best regards,
> Vladimir Ivanov

More information about the hotspot-compiler-dev mailing list