< prev index next >

src/hotspot/share/ci/ciConstant.hpp

Print this page




  89   }
  90   jint      as_int() {
  91     assert(basic_type() == T_BOOLEAN || basic_type() == T_CHAR  ||
  92            basic_type() == T_BYTE    || basic_type() == T_SHORT ||
  93            basic_type() == T_INT, "wrong type");
  94     return _value._int;
  95   }
  96   jlong     as_long() {
  97     assert(basic_type() == T_LONG, "wrong type");
  98     return _value._long;
  99   }
 100   jfloat    as_float() {
 101     assert(basic_type() == T_FLOAT, "wrong type");
 102     return _value._float;
 103   }
 104   jdouble   as_double() {
 105     assert(basic_type() == T_DOUBLE, "wrong type");
 106     return _value._double;
 107   }
 108   ciObject* as_object() const {
 109     assert(basic_type() == T_OBJECT || basic_type() == T_ARRAY, "wrong type");
 110     return _value._object;
 111   }
 112 
 113   bool      is_null_or_zero() const {
 114     if (!is_java_primitive(basic_type())) {
 115       return as_object()->is_null_object();
 116     } else if (type2size[basic_type()] == 1) {
 117       // treat float bits as int, to avoid comparison with -0 and NaN
 118       return (_value._int == 0);
 119     } else if (type2size[basic_type()] == 2) {
 120       // treat double bits as long, to avoid comparison with -0 and NaN
 121       return (_value._long == 0);
 122     } else {
 123       return false;
 124     }
 125   }
 126 
 127   bool is_valid() const {
 128     return basic_type() != T_ILLEGAL;
 129   }


  89   }
  90   jint      as_int() {
  91     assert(basic_type() == T_BOOLEAN || basic_type() == T_CHAR  ||
  92            basic_type() == T_BYTE    || basic_type() == T_SHORT ||
  93            basic_type() == T_INT, "wrong type");
  94     return _value._int;
  95   }
  96   jlong     as_long() {
  97     assert(basic_type() == T_LONG, "wrong type");
  98     return _value._long;
  99   }
 100   jfloat    as_float() {
 101     assert(basic_type() == T_FLOAT, "wrong type");
 102     return _value._float;
 103   }
 104   jdouble   as_double() {
 105     assert(basic_type() == T_DOUBLE, "wrong type");
 106     return _value._double;
 107   }
 108   ciObject* as_object() const {
 109     assert(basic_type() == T_OBJECT || basic_type() == T_ARRAY || basic_type() == T_VALUETYPE, "wrong type");
 110     return _value._object;
 111   }
 112 
 113   bool      is_null_or_zero() const {
 114     if (!is_java_primitive(basic_type())) {
 115       return as_object()->is_null_object();
 116     } else if (type2size[basic_type()] == 1) {
 117       // treat float bits as int, to avoid comparison with -0 and NaN
 118       return (_value._int == 0);
 119     } else if (type2size[basic_type()] == 2) {
 120       // treat double bits as long, to avoid comparison with -0 and NaN
 121       return (_value._long == 0);
 122     } else {
 123       return false;
 124     }
 125   }
 126 
 127   bool is_valid() const {
 128     return basic_type() != T_ILLEGAL;
 129   }
< prev index next >