< prev index next >
src/hotspot/share/c1/c1_LIRGenerator.cpp
Print this page
*** 1541,1551 ****
#endif
if (x->needs_null_check() &&
(needs_patching ||
MacroAssembler::needs_explicit_null_check(x->offset()))) {
! if (needs_patching && x->field()->is_q_type()) {
// We are storing a field of type "QT;" into holder class H, but H is not yet
// loaded. (If H had been loaded, then T must also have already been loaded
// due to the "Q" signature, and needs_patching would be false).
assert(!x->field()->holder()->is_loaded(), "must be");
// We don't know the offset of this field. Let's deopt and recompile.
--- 1541,1551 ----
#endif
if (x->needs_null_check() &&
(needs_patching ||
MacroAssembler::needs_explicit_null_check(x->offset()))) {
! if (needs_patching && x->field()->is_flattenable()) {
// We are storing a field of type "QT;" into holder class H, but H is not yet
// loaded. (If H had been loaded, then T must also have already been loaded
// due to the "Q" signature, and needs_patching would be false).
assert(!x->field()->holder()->is_loaded(), "must be");
// We don't know the offset of this field. Let's deopt and recompile.
*** 1869,1879 ****
}
return _barrier_set->resolve(this, decorators, obj);
}
! Value LIRGenerator::q_type_load_field_prolog(LoadField* x, CodeEmitInfo* info) {
ciField* field = x->field();
ciInstanceKlass* holder = field->holder();
Value default_value = NULL;
// Unloaded "QV;" klasses are represented by a ciInstanceKlass
--- 1869,1879 ----
}
return _barrier_set->resolve(this, decorators, obj);
}
! Value LIRGenerator::flattenable_load_field_prolog(LoadField* x, CodeEmitInfo* info) {
ciField* field = x->field();
ciInstanceKlass* holder = field->holder();
Value default_value = NULL;
// Unloaded "QV;" klasses are represented by a ciInstanceKlass
*** 1882,1919 ****
// Check for edge cases (1), (2) and (3) for getstatic and getfield
bool deopt = false;
bool need_default = false;
if (field->is_static()) {
// (1) holder is unloaded -- no problem: it will be loaded by patching, and field offset will be determined.
if (field_type_unloaded) {
// (2) field type is unloaded -- problem: we don't know what the default value is. Let's deopt.
// FIXME: consider getting the default value in patching code.
deopt = true;
} else {
need_default = true;
}
! // (3) field is not flattenable -- we don't care: static fields are never flattened.
} else {
if (!holder->is_loaded()) {
// (1) holder is unloaded -- problem: we needed the field offset back in GraphBuilder::access_field()
// FIXME: consider getting field offset in patching code (but only if the field
// type was loaded at compilation time).
deopt = true;
} else if (field_type_unloaded) {
! // (2) field type is unloaded -- problem: we don't whether it's flattened or not. Let's deopt
deopt = true;
} else if (!field->is_flattened()) {
! // (3) field is not flattenable -- need default value in cases of uninitialized field
need_default = true;
}
}
- assert(!(deopt && need_default), "cannot both be true");
-
if (deopt) {
assert(x->needs_patching(), "must be");
assert(info != NULL, "must be");
CodeStub* stub = new DeoptimizeStub(new CodeEmitInfo(info),
Deoptimization::Reason_unloaded,
Deoptimization::Action_make_not_entrant);
--- 1882,1920 ----
// Check for edge cases (1), (2) and (3) for getstatic and getfield
bool deopt = false;
bool need_default = false;
if (field->is_static()) {
// (1) holder is unloaded -- no problem: it will be loaded by patching, and field offset will be determined.
+ // No check needed here.
if (field_type_unloaded) {
// (2) field type is unloaded -- problem: we don't know what the default value is. Let's deopt.
// FIXME: consider getting the default value in patching code.
deopt = true;
} else {
need_default = true;
}
! // (3) field is not flattened -- we don't care: static fields are never flattened.
! // No check needed here.
} else {
if (!holder->is_loaded()) {
// (1) holder is unloaded -- problem: we needed the field offset back in GraphBuilder::access_field()
// FIXME: consider getting field offset in patching code (but only if the field
// type was loaded at compilation time).
deopt = true;
} else if (field_type_unloaded) {
! // (2) field type is unloaded -- problem: we don't know whether it's flattened or not. Let's deopt
deopt = true;
} else if (!field->is_flattened()) {
! // (3) field is not flattened -- need default value in cases of uninitialized field
need_default = true;
}
}
if (deopt) {
+ assert(!need_default, "deopt and need_default cannot both be true");
assert(x->needs_patching(), "must be");
assert(info != NULL, "must be");
CodeStub* stub = new DeoptimizeStub(new CodeEmitInfo(info),
Deoptimization::Reason_unloaded,
Deoptimization::Action_make_not_entrant);
*** 1972,1983 ****
x->is_static() ? "static" : "field", x->printable_bci());
}
#endif
Value default_value = NULL;
! if (x->field()->is_q_type()) {
! default_value = q_type_load_field_prolog(x, info);
}
bool stress_deopt = StressLoopInvariantCodeMotion && info && info->deoptimize_on_exception();
if (x->needs_null_check() &&
(needs_patching ||
--- 1973,1984 ----
x->is_static() ? "static" : "field", x->printable_bci());
}
#endif
Value default_value = NULL;
! if (x->field()->is_flattenable()) {
! default_value = flattenable_load_field_prolog(x, info);
}
bool stress_deopt = StressLoopInvariantCodeMotion && info && info->deoptimize_on_exception();
if (x->needs_null_check() &&
(needs_patching ||
< prev index next >