8151818: C1: LIRGenerator::move_to_phi can't deal with illegal phi
authormdoerr
Wed, 23 Mar 2016 15:35:38 -0700
changeset 36817 57ce0a76b6b0
parent 36811 721b2da25ee1
child 36818 b40330c06dea
8151818: C1: LIRGenerator::move_to_phi can't deal with illegal phi Reviewed-by: iveresov, kvn
hotspot/src/share/vm/c1/c1_LIRGenerator.cpp
hotspot/src/share/vm/c1/c1_ValueStack.hpp
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Fri Mar 18 15:54:47 2016 +0100
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Mar 23 15:35:38 2016 -0700
@@ -999,8 +999,16 @@
   Phi* phi = sux_val->as_Phi();
   // cur_val can be null without phi being null in conjunction with inlining
   if (phi != NULL && cur_val != NULL && cur_val != phi && !phi->is_illegal()) {
+    Phi* cur_phi = cur_val->as_Phi();
+    if (cur_phi != NULL && cur_phi->is_illegal()) {
+      // Phi and local would need to get invalidated
+      // (which is unexpected for Linear Scan).
+      // But this case is very rare so we simply bail out.
+      bailout("propagation of illegal phi");
+      return;
+    }
     LIR_Opr operand = cur_val->operand();
-    if (cur_val->operand()->is_illegal()) {
+    if (operand->is_illegal()) {
       assert(cur_val->as_Constant() != NULL || cur_val->as_Local() != NULL,
              "these can be produced lazily");
       operand = operand_for_instruction(cur_val);
--- a/hotspot/src/share/vm/c1/c1_ValueStack.hpp	Fri Mar 18 15:54:47 2016 +0100
+++ b/hotspot/src/share/vm/c1/c1_ValueStack.hpp	Wed Mar 23 15:35:38 2016 -0700
@@ -99,14 +99,14 @@
   void clear_locals();                           // sets all locals to NULL;
 
   void invalidate_local(int i) {
-    assert(_locals.at(i)->type()->is_single_word() ||
+    assert(!_locals.at(i)->type()->is_double_word() ||
            _locals.at(i + 1) == NULL, "hi-word of doubleword value must be NULL");
     _locals.at_put(i, NULL);
   }
 
   Value local_at(int i) const {
     Value x = _locals.at(i);
-    assert(x == NULL || x->type()->is_single_word() ||
+    assert(x == NULL || !x->type()->is_double_word() ||
            _locals.at(i + 1) == NULL, "hi-word of doubleword value must be NULL");
     return x;
   }
@@ -131,7 +131,7 @@
   // stack access
   Value stack_at(int i) const {
     Value x = _stack.at(i);
-    assert(x->type()->is_single_word() ||
+    assert(!x->type()->is_double_word() ||
            _stack.at(i + 1) == NULL, "hi-word of doubleword value must be NULL");
     return x;
   }