8043546: C1 optimizes @Stable instance fields with default values

Reviewed-by: kvn, jrose
This commit is contained in:
Vladimir Ivanov 2014-07-14 03:25:40 -07:00
parent 34bf429064
commit 3dd313825d
11 changed files with 819 additions and 515 deletions

View file

@ -1573,6 +1573,7 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
default:
constant = new Constant(as_ValueType(field_val));
}
// Stable static fields are checked for non-default values in ciField::initialize_from().
}
if (constant != NULL) {
push(type, append(constant));
@ -1614,6 +1615,10 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
default:
constant = new Constant(as_ValueType(field_val));
}
if (FoldStableValues && field->is_stable() && field_val.is_null_or_zero()) {
// Stable field with default value can't be constant.
constant = NULL;
}
} else {
// For CallSite objects treat the target field as a compile time constant.
if (const_oop->is_call_site()) {