< prev index next > src/hotspot/share/c1/c1_Canonicalizer.cpp
Print this page
IntConstant* index = x->index()->type()->as_IntConstant();
assert(array == nullptr || FoldStableValues, "not enabled");
// Constant fold loads from stable arrays.
- if (!x->mismatched() && array != nullptr && index != nullptr) {
+ if (!x->should_profile() && !x->mismatched() && array != nullptr && index != nullptr) {
jint idx = index->value();
if (idx < 0 || idx >= array->value()->length()) {
// Leave the load as is. The range check will handle it.
return;
}
if (klass != nullptr && klass->is_loaded()) {
bool is_interface = klass->is_instance_klass() &&
klass->as_instance_klass()->is_interface();
// Interface casts can't be statically optimized away since verifier doesn't
// enforce interface types in bytecode.
- if (!is_interface && klass->is_subtype_of(x->klass())) {
+ if (!is_interface && klass->is_subtype_of(x->klass()) && (!x->is_null_free() || obj->is_null_free())) {
+ assert(!x->klass()->is_inlinetype() || x->klass() == klass, "Inline klasses can't have subtypes");
set_canonical(obj);
return;
}
}
- // checkcast of null returns null
- if (obj->as_Constant() && obj->type()->as_ObjectType()->constant_value()->is_null_object()) {
+ // checkcast of null returns null for non null-free klasses
+ if (!x->is_null_free() && obj->is_null_obj()) {
set_canonical(obj);
}
}
}
void Canonicalizer::do_InstanceOf (InstanceOf* x) {
if (exact != nullptr && exact->is_loaded() && (obj->as_NewInstance() || obj->as_NewArray())) {
set_constant(exact->is_subtype_of(x->klass()) ? 1 : 0);
return;
}
// instanceof null returns false
- if (obj->as_Constant() && obj->type()->as_ObjectType()->constant_value()->is_null_object()) {
+ if (obj->as_Constant() && obj->is_null_obj()) {
set_constant(0);
}
}
}
void Canonicalizer::do_UnsafeGet (UnsafeGet* x) {}
void Canonicalizer::do_UnsafePut (UnsafePut* x) {}
void Canonicalizer::do_UnsafeGetAndSet(UnsafeGetAndSet* x) {}
void Canonicalizer::do_ProfileCall (ProfileCall* x) {}
void Canonicalizer::do_ProfileReturnType(ProfileReturnType* x) {}
- void Canonicalizer::do_ProfileInvoke (ProfileInvoke* x) {}
- void Canonicalizer::do_RuntimeCall (RuntimeCall* x) {}
+ void Canonicalizer::do_ProfileInvoke (ProfileInvoke* x) {}
+ void Canonicalizer::do_ProfileACmpTypes (ProfileACmpTypes* x) {}
+ void Canonicalizer::do_RuntimeCall (RuntimeCall* x) {}
void Canonicalizer::do_RangeCheckPredicate(RangeCheckPredicate* x) {}
#ifdef ASSERT
void Canonicalizer::do_Assert (Assert* x) {}
#endif
void Canonicalizer::do_MemBar (MemBar* x) {}
< prev index next >