< prev index next >

src/hotspot/share/c1/c1_Instruction.cpp

Print this page
rev 52693 : 8214352: C1: Unnecessary "compilation bailout: block join failed" with JVMTI
Summary: Invalidate Phi functions for conflicting types and avoid bailout.
Reviewed-by:

@@ -825,14 +825,21 @@
       }
 
       for_each_local_value(existing_state, index, existing_value) {
         Value new_value = new_state->local_at(index);
         if (new_value == NULL || new_value->type()->tag() != existing_value->type()->tag()) {
-          // The old code invalidated the phi function here
-          // Because dead locals are replaced with NULL, this is a very rare case now, so simply bail out
+          Phi* existing_phi = existing_value->as_Phi();
+          if (existing_phi == NULL) {
           return false; // BAILOUT in caller
         }
+          // Invalidate the phi function here. This case is very rare except for
+          // JVMTI capability "can_access_local_variables".
+          // In really rare cases we will bail out in LIRGenerator::move_to_phi.
+          existing_phi->make_illegal();
+          existing_state->invalidate_local(index);
+          TRACE_PHI(tty->print_cr("invalidating local %d because of type mismatch", index));
+        }
       }
 
 #ifdef ASSERT
       // check that all necessary phi functions are present
       for_each_stack_value(existing_state, index, existing_value) {
< prev index next >