< prev index next >

src/hotspot/share/c1/c1_ValueType.cpp

Print this page

112   return constant_value()->is_loaded();
113 }
114 
115 ciObject* ObjectConstant::constant_value() const                   { return _value; }
116 ciObject* ArrayConstant::constant_value() const                    { return _value; }
117 ciObject* InstanceConstant::constant_value() const                 { return _value; }
118 
119 ValueType* as_ValueType(BasicType type) {
120   switch (type) {
121     case T_VOID   : return voidType;
122     case T_BYTE   : // fall through
123     case T_CHAR   : // fall through
124     case T_SHORT  : // fall through
125     case T_BOOLEAN: // fall through
126     case T_INT    : return intType;
127     case T_LONG   : return longType;
128     case T_FLOAT  : return floatType;
129     case T_DOUBLE : return doubleType;
130     case T_ARRAY  : return arrayType;
131     case T_OBJECT : return objectType;

132     case T_ADDRESS: return addressType;
133     case T_ILLEGAL: return illegalType;
134     default       : ShouldNotReachHere();
135                     return illegalType;
136   }
137 }
138 
139 
140 ValueType* as_ValueType(ciConstant value) {
141   switch (value.basic_type()) {
142     case T_BYTE   : // fall through
143     case T_CHAR   : // fall through
144     case T_SHORT  : // fall through
145     case T_BOOLEAN: // fall through
146     case T_INT    : return new IntConstant   (value.as_int   ());
147     case T_LONG   : return new LongConstant  (value.as_long  ());
148     case T_FLOAT  : return new FloatConstant (value.as_float ());
149     case T_DOUBLE : return new DoubleConstant(value.as_double());
150     case T_ARRAY  : // fall through (ciConstant doesn't have an array accessor)

151     case T_OBJECT : {
152       // TODO: Common the code with GraphBuilder::load_constant?
153       ciObject* obj = value.as_object();
154       if (obj->is_null_object())
155         return objectNull;
156       if (obj->is_loaded()) {
157         if (obj->is_array())
158           return new ArrayConstant(obj->as_array());
159         else if (obj->is_instance())
160           return new InstanceConstant(obj->as_instance());
161       }
162       return new ObjectConstant(obj);
163     }
164     default       : ShouldNotReachHere();
165                     return illegalType;
166   }
167 }
168 
169 
170 BasicType as_BasicType(ValueType* type) {

112   return constant_value()->is_loaded();
113 }
114 
115 ciObject* ObjectConstant::constant_value() const                   { return _value; }
116 ciObject* ArrayConstant::constant_value() const                    { return _value; }
117 ciObject* InstanceConstant::constant_value() const                 { return _value; }
118 
119 ValueType* as_ValueType(BasicType type) {
120   switch (type) {
121     case T_VOID   : return voidType;
122     case T_BYTE   : // fall through
123     case T_CHAR   : // fall through
124     case T_SHORT  : // fall through
125     case T_BOOLEAN: // fall through
126     case T_INT    : return intType;
127     case T_LONG   : return longType;
128     case T_FLOAT  : return floatType;
129     case T_DOUBLE : return doubleType;
130     case T_ARRAY  : return arrayType;
131     case T_OBJECT : return objectType;
132     case T_INLINE_TYPE: return objectType;
133     case T_ADDRESS: return addressType;
134     case T_ILLEGAL: return illegalType;
135     default       : ShouldNotReachHere();
136                     return illegalType;
137   }
138 }
139 
140 
141 ValueType* as_ValueType(ciConstant value) {
142   switch (value.basic_type()) {
143     case T_BYTE   : // fall through
144     case T_CHAR   : // fall through
145     case T_SHORT  : // fall through
146     case T_BOOLEAN: // fall through
147     case T_INT    : return new IntConstant   (value.as_int   ());
148     case T_LONG   : return new LongConstant  (value.as_long  ());
149     case T_FLOAT  : return new FloatConstant (value.as_float ());
150     case T_DOUBLE : return new DoubleConstant(value.as_double());
151     case T_ARRAY  : // fall through (ciConstant doesn't have an array accessor)
152     case T_INLINE_TYPE: // fall through
153     case T_OBJECT : {
154       // TODO: Common the code with GraphBuilder::load_constant?
155       ciObject* obj = value.as_object();
156       if (obj->is_null_object())
157         return objectNull;
158       if (obj->is_loaded()) {
159         if (obj->is_array())
160           return new ArrayConstant(obj->as_array());
161         else if (obj->is_instance())
162           return new InstanceConstant(obj->as_instance());
163       }
164       return new ObjectConstant(obj);
165     }
166     default       : ShouldNotReachHere();
167                     return illegalType;
168   }
169 }
170 
171 
172 BasicType as_BasicType(ValueType* type) {
< prev index next >