@@ -1204,14 +1204,19 @@ void LIRGenerator::do_NewObjectArray(NewObjectArray* x) {
1204
1204
length.load_item_force (FrameMap::r19_opr);
1205
1205
LIR_Opr len = length.result ();
1206
1206
1207
- ciKlass* obj = (ciKlass*) x->exact_type ();
1208
- CodeStub* slow_path = new NewObjectArrayStub (klass_reg, len, reg, info, x->is_null_free ());
1207
+ ciKlass* obj = ciArrayKlass::make (x->klass (), false , true , true );
1208
+
1209
+ // TODO 8265122 Implement a fast path for this
1210
+ bool is_flat = obj->is_loaded () && obj->is_flat_array_klass ();
1211
+ bool is_null_free = obj->is_loaded () && obj->as_array_klass ()->is_elem_null_free ();
1212
+
1213
+ CodeStub* slow_path = new NewObjectArrayStub (klass_reg, len, reg, info, is_null_free);
1209
1214
if (obj == ciEnv::unloaded_ciobjarrayklass ()) {
1210
1215
BAILOUT (" encountered unloaded_ciobjarrayklass due to out of memory error" );
1211
1216
}
1212
1217
1213
1218
klass2reg_with_patching (klass_reg, obj, patching_info);
1214
- __ allocate_array (reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path, true , x-> is_null_free () );
1219
+ __ allocate_array (reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path, true , is_null_free || is_flat );
1215
1220
1216
1221
LIR_Opr result = rlock_result (x);
1217
1222
__ move (reg, result);
@@ -1287,9 +1292,6 @@ void LIRGenerator::do_CheckCast(CheckCast* x) {
1287
1292
CodeEmitInfo* info_for_exception =
1288
1293
(x->needs_exception_state () ? state_for (x) :
1289
1294
state_for (x, x->state_before (), true /* ignore_xhandler*/ ));
1290
- if (x->is_null_free ()) {
1291
- __ null_check (obj.result (), new CodeEmitInfo (info_for_exception));
1292
- }
1293
1295
1294
1296
CodeStub* stub;
1295
1297
if (x->is_incompatible_class_change_check ()) {
0 commit comments