JDK-8202399 : [C1] LIRGenerator::do_CheckCast needs to exclude is_invokespecial_receiver_check() when using PatchAlot
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-04-29
  • Updated: 2018-05-09
  • Resolved: 2018-05-01
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 b12Fixed
Related Reports
Relates :  
Relates :  
Description
JDK-8168699 introduced  a special case for is_invokespecial_receiver_check() in LIRGenerator::do_CheckCast:

  } else if (x->is_invokespecial_receiver_check()) {
    assert(patching_info == NULL, "can't patch this");
    stub = new DeoptimizeStub(info_for_exception,
                              Deoptimization::Reason_class_check,
                              Deoptimization::Action_none);

but overlooked a potential bad interaction with PatchAlot. This can lead to  the assertion failure as observed during testing for JDK-8200167 with Graal. The proposed fix is quite simple but needs to be applied to each of the CPU specific files:

diff --git a/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp b/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp
--- a/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp
+++ b/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp
@@ -1314,7 +1314,7 @@
    LIRItem obj(x->obj(), this);

    CodeEmitInfo* patching_info = NULL;
-  if (!x->klass()->is_loaded() || (PatchALot && !x->is_incompatible_class_change_check())) {
+  if (!x->klass()->is_loaded() || (PatchALot && !x->is_incompatible_class_change_check() && !x->is_invokespecial_receiver_check())) {
      // must do this before locking the destination register as an oop register,
      // and before the obj is loaded (the latter is for deoptimization)
      patching_info = state_for(x, x->state_before()); 

Comments
ILW = crash in C1 - LIRGenerator::do_CheckCast(); rare, with PatchAlot; disable PatchAlot! = HLM
30-04-2018