151 case T_INT : return new IntConstant (value.as_int ()); |
151 case T_INT : return new IntConstant (value.as_int ()); |
152 case T_LONG : return new LongConstant (value.as_long ()); |
152 case T_LONG : return new LongConstant (value.as_long ()); |
153 case T_FLOAT : return new FloatConstant (value.as_float ()); |
153 case T_FLOAT : return new FloatConstant (value.as_float ()); |
154 case T_DOUBLE : return new DoubleConstant(value.as_double()); |
154 case T_DOUBLE : return new DoubleConstant(value.as_double()); |
155 case T_ARRAY : // fall through (ciConstant doesn't have an array accessor) |
155 case T_ARRAY : // fall through (ciConstant doesn't have an array accessor) |
156 case T_OBJECT : return new ObjectConstant(value.as_object()); |
156 case T_OBJECT : { |
|
157 // TODO: Common the code with GraphBuilder::load_constant? |
|
158 ciObject* obj = value.as_object(); |
|
159 if (obj->is_null_object()) |
|
160 return objectNull; |
|
161 if (obj->is_loaded()) { |
|
162 if (obj->is_array()) |
|
163 return new ArrayConstant(obj->as_array()); |
|
164 else if (obj->is_instance()) |
|
165 return new InstanceConstant(obj->as_instance()); |
|
166 } |
|
167 return new ObjectConstant(obj); |
|
168 } |
157 } |
169 } |
158 ShouldNotReachHere(); |
170 ShouldNotReachHere(); |
159 return illegalType; |
171 return illegalType; |
160 } |
172 } |
161 |
173 |