Mercurial > hg > graal-jvmci-8
comparison src/share/vm/ci/ciConstant.hpp @ 12190:edb5ab0f3fe5
8001107: @Stable annotation for constant folding of lazily evaluated variables
Reviewed-by: rbackman, twisti, kvn
Contributed-by: john.r.rose@oracle.com, vladimir.x.ivanov@oracle.com
author | vlivanov |
---|---|
date | Tue, 10 Sep 2013 14:51:48 -0700 |
parents | f6f3bb0ee072 |
children | de6a9e811145 |
comparison
equal
deleted
inserted
replaced
12188:cd16d587b0fa | 12190: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 |