220 array_klass = con; // Use cast value moving forward
221 }
222 }
223
224 // Come here for polymorphic array klasses
225
226 // Extract the array element class
227 int element_klass_offset = in_bytes(ArrayKlass::element_klass_offset());
228
229 Node *p2 = basic_plus_adr(array_klass, array_klass, element_klass_offset);
230 // We are allowed to use the constant type only if cast succeeded. If always_see_exact_class is true,
231 // we must set a control edge from the IfTrue node created by the uncommon_trap above to the
232 // LoadKlassNode.
233 Node* a_e_klass = _gvn.transform(LoadKlassNode::make(_gvn, always_see_exact_class ? control() : NULL,
234 immutable_memory(), p2, tak));
235
236 // Handle value type arrays
237 const Type* elemtype = _gvn.type(ary)->is_aryptr()->elem();
238 if (elemtype->isa_valuetype() != NULL || elemtype->is_valuetypeptr()) {
239 // We statically know that this is a value type array, use precise klass ptr
240 ciValueKlass* vk = elemtype->isa_valuetype() ? elemtype->is_valuetype()->value_klass() : elemtype->value_klass();
241 a_e_klass = makecon(TypeKlassPtr::make(vk));
242 }
243
244 // Check (the hard way) and throw if not a subklass.
245 return gen_checkcast(obj, a_e_klass);
246 }
247
248
249 void Parse::emit_guard_for_new(ciInstanceKlass* klass) {
250 if ((!klass->is_initialized() && !klass->is_being_initialized()) ||
251 klass->is_abstract() || klass->is_interface() ||
252 klass->name() == ciSymbol::java_lang_Class() ||
253 iter().is_unresolved_klass()) {
254 uncommon_trap(Deoptimization::Reason_uninitialized,
255 Deoptimization::Action_reinterpret,
256 klass);
257 } if (klass->is_being_initialized()) {
258 // Emit guarded new
259 // if (klass->_init_thread != current_thread ||
260 // klass->_init_state != being_initialized)
261 // uncommon_trap
|
220 array_klass = con; // Use cast value moving forward
221 }
222 }
223
224 // Come here for polymorphic array klasses
225
226 // Extract the array element class
227 int element_klass_offset = in_bytes(ArrayKlass::element_klass_offset());
228
229 Node *p2 = basic_plus_adr(array_klass, array_klass, element_klass_offset);
230 // We are allowed to use the constant type only if cast succeeded. If always_see_exact_class is true,
231 // we must set a control edge from the IfTrue node created by the uncommon_trap above to the
232 // LoadKlassNode.
233 Node* a_e_klass = _gvn.transform(LoadKlassNode::make(_gvn, always_see_exact_class ? control() : NULL,
234 immutable_memory(), p2, tak));
235
236 // Handle value type arrays
237 const Type* elemtype = _gvn.type(ary)->is_aryptr()->elem();
238 if (elemtype->isa_valuetype() != NULL || elemtype->is_valuetypeptr()) {
239 // We statically know that this is a value type array, use precise klass ptr
240 a_e_klass = makecon(TypeKlassPtr::make(elemtype->value_klass()));
241 }
242
243 // Check (the hard way) and throw if not a subklass.
244 return gen_checkcast(obj, a_e_klass);
245 }
246
247
248 void Parse::emit_guard_for_new(ciInstanceKlass* klass) {
249 if ((!klass->is_initialized() && !klass->is_being_initialized()) ||
250 klass->is_abstract() || klass->is_interface() ||
251 klass->name() == ciSymbol::java_lang_Class() ||
252 iter().is_unresolved_klass()) {
253 uncommon_trap(Deoptimization::Reason_uninitialized,
254 Deoptimization::Action_reinterpret,
255 klass);
256 } if (klass->is_being_initialized()) {
257 // Emit guarded new
258 // if (klass->_init_thread != current_thread ||
259 // klass->_init_state != being_initialized)
260 // uncommon_trap
|