mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-25 05:45:11 +02:00
8043546: C1 optimizes @Stable instance fields with default values
Reviewed-by: kvn, jrose
This commit is contained in:
parent
34bf429064
commit
3dd313825d
11 changed files with 819 additions and 515 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue