8158546: C1 compilation fails with "Constant field loads are folded during parsing"

Reviewed-by: kvn
This commit is contained in:
Vladimir Ivanov 2017-01-30 16:03:25 +03:00
parent 3f2d357f28
commit cdae3f8fba

View File

@ -248,7 +248,9 @@ void Canonicalizer::do_ArrayLength (ArrayLength* x) {
} else if ((lf = x->array()->as_LoadField()) != NULL) {
ciField* field = lf->field();
if (field->is_static_constant()) {
assert(PatchALot || ScavengeRootsInCode < 2, "Constant field loads are folded during parsing");
// Constant field loads are usually folded during parsing.
// But it doesn't happen with PatchALot, ScavengeRootsInCode < 2, or when
// holder class is being initialized during parsing (for static fields).
ciObject* c = field->constant_value().as_object();
if (!c->is_null_object()) {
set_constant(c->as_array()->length());