130 }
131 }
132
133 return false;
134 }
135
136 bool Instruction::is_loaded_flattened_array() const {
137 if (ValueArrayFlatten) {
138 ciType* type = declared_type();
139 if (type != NULL && type->is_value_array_klass()) {
140 ciValueKlass* element_klass = type->as_value_array_klass()->element_klass()->as_value_klass();
141 if (element_klass->is_loaded() && element_klass->flatten_array()) {
142 return true;
143 }
144 }
145 }
146
147 return false;
148 }
149
150 bool Instruction::maybe_flattened_array() const {
151 if (ValueArrayFlatten) {
152 ciType* type = declared_type();
153 if (type != NULL) {
154 if (type->is_value_array_klass()) {
155 ciValueKlass* element_klass = type->as_value_array_klass()->element_klass()->as_value_klass();
156 if (!element_klass->is_loaded() || element_klass->flatten_array()) {
157 // For unloaded value arrays, we will add a runtime check for flat-ness.
158 return true;
159 }
160 } else if (type->is_obj_array_klass()) {
161 ciKlass* element_klass = type->as_obj_array_klass()->element_klass();
162 if (element_klass->is_java_lang_Object() || element_klass->is_interface()) {
163 // Array covariance:
164 // (ValueType[] <: Object[])
165 // (ValueType[] <: <any interface>[])
166 // We will add a runtime check for flat-ness.
167 return true;
168 }
169 }
170 }
171 }
172
173 return false;
174 }
175
176 #ifndef PRODUCT
177 void Instruction::check_state(ValueStack* state) {
178 if (state != NULL) {
179 state->verify();
180 }
181 }
182
183
184 void Instruction::print() {
185 InstructionPrinter ip;
186 print(ip);
187 }
188
189
|
130 }
131 }
132
133 return false;
134 }
135
136 bool Instruction::is_loaded_flattened_array() const {
137 if (ValueArrayFlatten) {
138 ciType* type = declared_type();
139 if (type != NULL && type->is_value_array_klass()) {
140 ciValueKlass* element_klass = type->as_value_array_klass()->element_klass()->as_value_klass();
141 if (element_klass->is_loaded() && element_klass->flatten_array()) {
142 return true;
143 }
144 }
145 }
146
147 return false;
148 }
149
150 bool Instruction::maybe_flattened_array() {
151 if (ValueArrayFlatten) {
152 ciType* type = declared_type();
153 if (type != NULL) {
154 if (type->is_value_array_klass()) {
155 ciValueKlass* element_klass = type->as_value_array_klass()->element_klass()->as_value_klass();
156 if (!element_klass->is_loaded() || element_klass->flatten_array()) {
157 // For unloaded value arrays, we will add a runtime check for flat-ness.
158 return true;
159 }
160 } else if (type->is_obj_array_klass()) {
161 ciKlass* element_klass = type->as_obj_array_klass()->element_klass();
162 if (element_klass->is_java_lang_Object() || element_klass->is_interface()) {
163 // Array covariance:
164 // (ValueType[] <: Object[])
165 // (ValueType[] <: <any interface>[])
166 // We will add a runtime check for flat-ness.
167 return true;
168 }
169 }
170 } else if (as_Phi() != NULL) {
171 // Type info gets lost during Phi merging, but we might be storing into a
172 // flattened array, so we should do a runtime check.
173 return true;
174 }
175 }
176
177 return false;
178 }
179
180 #ifndef PRODUCT
181 void Instruction::check_state(ValueStack* state) {
182 if (state != NULL) {
183 state->verify();
184 }
185 }
186
187
188 void Instruction::print() {
189 InstructionPrinter ip;
190 print(ip);
191 }
192
193
|