8131782: C1 Class.cast optimization breaks when Class is loaded from static final
Change as_ValueType() to return InstanceConstant when appropriate Reviewed-by: jrose
This commit is contained in:
parent
71716bea0b
commit
88a6ccaaa2
@ -153,7 +153,19 @@ ValueType* as_ValueType(ciConstant value) {
|
|||||||
case T_FLOAT : return new FloatConstant (value.as_float ());
|
case T_FLOAT : return new FloatConstant (value.as_float ());
|
||||||
case T_DOUBLE : return new DoubleConstant(value.as_double());
|
case T_DOUBLE : return new DoubleConstant(value.as_double());
|
||||||
case T_ARRAY : // fall through (ciConstant doesn't have an array accessor)
|
case T_ARRAY : // fall through (ciConstant doesn't have an array accessor)
|
||||||
case T_OBJECT : return new ObjectConstant(value.as_object());
|
case T_OBJECT : {
|
||||||
|
// TODO: Common the code with GraphBuilder::load_constant?
|
||||||
|
ciObject* obj = value.as_object();
|
||||||
|
if (obj->is_null_object())
|
||||||
|
return objectNull;
|
||||||
|
if (obj->is_loaded()) {
|
||||||
|
if (obj->is_array())
|
||||||
|
return new ArrayConstant(obj->as_array());
|
||||||
|
else if (obj->is_instance())
|
||||||
|
return new InstanceConstant(obj->as_instance());
|
||||||
|
}
|
||||||
|
return new ObjectConstant(obj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ShouldNotReachHere();
|
ShouldNotReachHere();
|
||||||
return illegalType;
|
return illegalType;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user