< prev index next >
src/hotspot/share/c1/c1_GraphBuilder.cpp
Print this page
*** 1662,1702 ****
ciField* field = stream()->get_field(will_link);
ciInstanceKlass* holder = field->holder();
BasicType field_type = field->type()->basic_type();
ValueType* type = as_ValueType(field_type);
- // Null check and deopt for getting static value field
- ciValueKlass* value_klass = NULL;
- Value default_value = NULL;
- bool needs_deopt = false;
- if (code == Bytecodes::_getstatic && !field->is_static_constant() &&
- field->layout_type() == T_VALUETYPE && field->is_flattenable()) {
- value_klass = field->type()->as_value_klass();
- if (holder->is_loaded()) {
- ciInstance* mirror = field->holder()->java_mirror();
- ciObject* val = mirror->field_value(field).as_object();
- if (val->is_null_object()) {
- // This is a non-nullable static field, but it's not initialized.
- // We need to do a null check, and replace it with the default value.
- } else {
- // No need to perform null check on this static field
- value_klass = NULL;
- }
- }
- if (value_klass != NULL) {
- if (value_klass->is_loaded()) {
- default_value = new Constant(new InstanceConstant(value_klass->default_value_instance()));
- } else {
- needs_deopt = true;
- }
- }
- }
-
// call will_link again to determine if the field is valid.
const bool needs_patching = !holder->is_loaded() ||
!field->will_link(method(), code) ||
- needs_deopt ||
PatchALot;
ValueStack* state_before = NULL;
if (!holder->is_initialized() || needs_patching) {
// save state before instruction for debug info when
--- 1662,1674 ----
*** 1741,1753 ****
} else {
if (state_before == NULL) {
state_before = copy_state_for_exception();
}
LoadField* load_field = new LoadField(append(obj), offset, field, true,
! state_before, needs_patching,
! value_klass, default_value);
! if (field->layout_type() == T_VALUETYPE && field->is_flattenable()) {
load_field->set_never_null(true);
}
push(type, append(load_field));
}
break;
--- 1713,1724 ----
} else {
if (state_before == NULL) {
state_before = copy_state_for_exception();
}
LoadField* load_field = new LoadField(append(obj), offset, field, true,
! state_before, needs_patching);
! if (field->is_never_null()) {
load_field->set_never_null(true);
}
push(type, append(load_field));
}
break;
< prev index next >