Question on C1's as_ValueType(ciConstant value)
Krystal Mok
rednaxelafx at gmail.com
Mon Jun 8 05:47:38 UTC 2015
Hi compiler team,
I'd like to ask a question about a piece of code in C1. The code snippet
below is from the tip version of jdk9/hs-comp.
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.
Thanks,
Kris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20150607/e3544f28/attachment.html>
More information about the hotspot-compiler-dev
mailing list