< prev index next >
src/hotspot/share/c1/c1_Canonicalizer.cpp
Print this page
@@ -647,11 +647,12 @@
void Canonicalizer::do_NewValueTypeInstance(NewValueTypeInstance* x) {}
void Canonicalizer::do_NewTypeArray (NewTypeArray* x) {}
void Canonicalizer::do_NewObjectArray (NewObjectArray* x) {}
void Canonicalizer::do_NewMultiArray (NewMultiArray* x) {}
void Canonicalizer::do_CheckCast (CheckCast* x) {
- if (x->klass()->is_loaded()) {
+ if (x->klass()->is_loaded() && !x->is_never_null()) {
+ // Don't canonicalize for non-nullable types -- we need to throw NPE.
Value obj = x->obj();
ciType* klass = obj->exact_type();
if (klass == NULL) {
klass = obj->declared_type();
}
< prev index next >