JDK-8202465 : C1: Casts should not be eliminated for interface types
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 10,11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-05-01
  • Updated: 2018-05-11
  • Resolved: 2018-05-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b13Fixed
Related Reports
Relates :  
Relates :  
Description
From the review for JDK-8200167, Vladimir writes:

src/hotspot/share/c1/c1_Canonicalizer.cpp
...
 void Canonicalizer::do_CheckCast      (CheckCast*       x) {
-  if (x->klass()->is_loaded()) {
+  if (x->klass()->is_loaded() && !x->is_invokespecial_receiver_check())

It seems like it's not something specific to invokespecial, but a generic problem in how interface casts are handled in C1: it's not correct to eliminate the cast if obj->declared_type() is an interface. I assume that's what happens in your case. FTR I'm fine with handling it separately.

Comments
Vladimir, could you please have a look?
02-05-2018

ILW = C1 incorrectly eliminates interface casts, never showed up, disable compilation with C1 = HLM = P3
02-05-2018