src/share/vm/ci/ciConstant.hpp

changeset 5658
edb5ab0f3fe5
parent 3138
f6f3bb0ee072
child 6198
55fb97c4c58d
equal deleted inserted replaced
5656:cd16d587b0fa 5658:edb5ab0f3fe5
39 39
40 BasicType _type; 40 BasicType _type;
41 union { 41 union {
42 jint _int; 42 jint _int;
43 jlong _long; 43 jlong _long;
44 jint _long_half[2];
45 jfloat _float; 44 jfloat _float;
46 jdouble _double; 45 jdouble _double;
47 ciObject* _object; 46 ciObject* _object;
48 } _value; 47 } _value;
49 48
109 ciObject* as_object() const { 108 ciObject* as_object() const {
110 assert(basic_type() == T_OBJECT || basic_type() == T_ARRAY, "wrong type"); 109 assert(basic_type() == T_OBJECT || basic_type() == T_ARRAY, "wrong type");
111 return _value._object; 110 return _value._object;
112 } 111 }
113 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
114 // Debugging output 127 // Debugging output
115 void print(); 128 void print();
116 }; 129 };
117 130
118 #endif // SHARE_VM_CI_CICONSTANT_HPP 131 #endif // SHARE_VM_CI_CICONSTANT_HPP

mercurial