RFR (S) 8150102: C1 should fold arraylength for constant/trusted arrays

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Thu Feb 18 12:56:43 UTC 2016

>   http://cr.openjdk.java.net/~shade/8150102/webrev.01/
Why don't you fold as_LoadField into the assert?

Also, field->is_static() is redundant: ciField::initialize_from does all 
necessary checks.

Something like:
+  } else {
+    assert(x->array()->as_LoadField() == NULL || !field->is_constant(), 
"constant field loads are folded during parsing");
+  }

Best regards,
Vladimir Ivanov

PS: I noticed the following check in the original code:
- ciObject* c = field->constant_value().as_object();
- if (c->is_array()) {

I don't see how !c->is_array() is possible, so it looks like an 
unnecessary precaution.

More information about the hotspot-compiler-dev mailing list