1 /*
2 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1243
1244 length.load_item_force(FrameMap::rbx_opr);
1245 LIR_Opr len = length.result();
1246
1247 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
1248 ciKlass* obj = (ciKlass*) ciObjArrayKlass::make(x->klass());
1249 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
1250 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
1251 }
1252 klass2reg_with_patching(klass_reg, obj, patching_info);
1253 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
1254
1255 LIR_Opr result = rlock_result(x);
1256 __ move(reg, result);
1257 }
1258
1259
1260 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1261 Values* dims = x->dims();
1262 int i = dims->length();
1263 LIRItemList* items = new LIRItemList(dims->length(), NULL);
1264 while (i-- > 0) {
1265 LIRItem* size = new LIRItem(dims->at(i), this);
1266 items->at_put(i, size);
1267 }
1268
1269 // Evaluate state_for early since it may emit code.
1270 CodeEmitInfo* patching_info = NULL;
1271 if (!x->klass()->is_loaded() || PatchALot) {
1272 patching_info = state_for(x, x->state_before());
1273
1274 // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
1275 // clone all handlers (NOTE: Usually this is handled transparently
1276 // by the CodeEmitInfo cloning logic in CodeStub constructors but
1277 // is done explicitly here because a stub isn't being used).
1278 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
1279 }
1280 CodeEmitInfo* info = state_for(x, x->state());
1281
1282 i = dims->length();
1283 while (i-- > 0) {
|
1 /*
2 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
1243
1244 length.load_item_force(FrameMap::rbx_opr);
1245 LIR_Opr len = length.result();
1246
1247 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
1248 ciKlass* obj = (ciKlass*) ciObjArrayKlass::make(x->klass());
1249 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
1250 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
1251 }
1252 klass2reg_with_patching(klass_reg, obj, patching_info);
1253 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
1254
1255 LIR_Opr result = rlock_result(x);
1256 __ move(reg, result);
1257 }
1258
1259
1260 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1261 Values* dims = x->dims();
1262 int i = dims->length();
1263 LIRItemList* items = new LIRItemList(i, i, NULL);
1264 while (i-- > 0) {
1265 LIRItem* size = new LIRItem(dims->at(i), this);
1266 items->at_put(i, size);
1267 }
1268
1269 // Evaluate state_for early since it may emit code.
1270 CodeEmitInfo* patching_info = NULL;
1271 if (!x->klass()->is_loaded() || PatchALot) {
1272 patching_info = state_for(x, x->state_before());
1273
1274 // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
1275 // clone all handlers (NOTE: Usually this is handled transparently
1276 // by the CodeEmitInfo cloning logic in CodeStub constructors but
1277 // is done explicitly here because a stub isn't being used).
1278 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
1279 }
1280 CodeEmitInfo* info = state_for(x, x->state());
1281
1282 i = dims->length();
1283 while (i-- > 0) {
|