8179070: nashorn+octane's box2d causes c2 to crash with "Bad graph detected in compute_lca_of_uses"
authorroland
Tue, 25 Apr 2017 09:37:24 +0200
changeset 44996 072847273bae
parent 44995 cc6e047b8064
child 44997 3f875168ce21
8179070: nashorn+octane's box2d causes c2 to crash with "Bad graph detected in compute_lca_of_uses" Summary: ciTypeFlow speculates field is null but parsing uses non null constant because of concurrent class initialization Reviewed-by: thartmann
hotspot/src/share/vm/opto/parse3.cpp
--- a/hotspot/src/share/vm/opto/parse3.cpp	Thu May 04 17:54:34 2017 +0000
+++ b/hotspot/src/share/vm/opto/parse3.cpp	Tue Apr 25 09:37:24 2017 +0200
@@ -146,8 +146,16 @@
 
 
 void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) {
+  BasicType bt = field->layout_type();
+
   // Does this field have a constant value?  If so, just push the value.
-  if (field->is_constant()) {
+  if (field->is_constant() &&
+      // Keep consistent with types found by ciTypeFlow: for an
+      // unloaded field type, ciTypeFlow::StateVector::do_getstatic()
+      // speculates the field is null. The code in the rest of this
+      // method does the same. We must not bypass it and use a non
+      // null constant here.
+      (bt != T_OBJECT || field->type()->is_loaded())) {
     // final or stable field
     Node* con = make_constant_from_field(field, obj);
     if (con != NULL) {
@@ -163,7 +171,6 @@
   int offset = field->offset_in_bytes();
   const TypePtr* adr_type = C->alias_type(field)->adr_type();
   Node *adr = basic_plus_adr(obj, obj, offset);
-  BasicType bt = field->layout_type();
 
   // Build the resultant type of the load
   const Type *type;