Question on C1's as_ValueType(ciConstant value)
Roland Westrelin
roland.westrelin at oracle.com
Tue Jun 9 10:49:22 UTC 2015
Hi Kris,
> 145 ValueType* as_ValueType(ciConstant value) {
> 146 switch (value.basic_type()) {
> 147 case T_BYTE : // fall through
> 148 case T_CHAR : // fall through
> 149 case T_SHORT : // fall through
> 150 case T_BOOLEAN: // fall through
> 151 case T_INT : return new IntConstant (value.as_int ());
> 152 case T_LONG : return new LongConstant (value.as_long ());
> 153 case T_FLOAT : return new FloatConstant (value.as_float ());
> 154 case T_DOUBLE : return new DoubleConstant(value.as_double());
> 155 case T_ARRAY : // fall through (ciConstant doesn't have an array accessor)
> 156 case T_OBJECT : return new ObjectConstant(value.as_object());
> 157 }
> 158 ShouldNotReachHere();
> 159 return illegalType;
> 160 }
>
> On lines 155 and 156, both basic types T_ARRAY and T_OBJECT turns into a ObjectConstant.
> That's not consistent with the handling in GraphKit::load_constant(), where ArrayConstant, InstanceConstant and ObjectConstant are treated separately.
>
> I ran into this inconsistency when I wanted to try out something with array constants. But I was only able to reach the constant from an ObjectConstant, instead of an ArrayConstant like I was expecting.
>
> If people agree that this inconsistency should be fixed, I'd be happy to provide a patch and test it.
Strange inconsistency indeed. I think it makes sense to fix this. Please go ahead with the patch. I’ll sponsor it.
Roland.
More information about the hotspot-compiler-dev
mailing list