(original) (raw)
Oops, s/GraphKit/GraphBuilder/ in my last email.
Thanks,
Kris
On Sun, Jun 7, 2015 at 10:47 PM, Krystal Mok <rednaxelafx@gmail.com> wrote:
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 through148 case T\_CHAR : // fall through149 case T\_SHORT : // fall through150 case T\_BOOLEAN: // fall through151 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