< prev index next >

src/hotspot/share/c1/c1_ValueType.cpp

Print this page




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

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

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


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