Fri, 24 Jul 2015 21:29:11 -0400
8131782: C1 Class.cast optimization breaks when Class is loaded from static final
Summary: change as_ValueType() to return InstanceConstant when appropriate
Reviewed-by: jrose
src/share/vm/c1/c1_ValueType.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/c1/c1_ValueType.cpp Fri Dec 18 10:58:25 2015 -0800 1.2 +++ b/src/share/vm/c1/c1_ValueType.cpp Fri Jul 24 21:29:11 2015 -0400 1.3 @@ -153,7 +153,19 @@ 1.4 case T_FLOAT : return new FloatConstant (value.as_float ()); 1.5 case T_DOUBLE : return new DoubleConstant(value.as_double()); 1.6 case T_ARRAY : // fall through (ciConstant doesn't have an array accessor) 1.7 - case T_OBJECT : return new ObjectConstant(value.as_object()); 1.8 + case T_OBJECT : { 1.9 + // TODO: Common the code with GraphBuilder::load_constant? 1.10 + ciObject* obj = value.as_object(); 1.11 + if (obj->is_null_object()) 1.12 + return objectNull; 1.13 + if (obj->is_loaded()) { 1.14 + if (obj->is_array()) 1.15 + return new ArrayConstant(obj->as_array()); 1.16 + else if (obj->is_instance()) 1.17 + return new InstanceConstant(obj->as_instance()); 1.18 + } 1.19 + return new ObjectConstant(obj); 1.20 + } 1.21 } 1.22 ShouldNotReachHere(); 1.23 return illegalType;