1 /*
2 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, Red Hat Inc. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
1110
1111 length.load_item_force(FrameMap::r19_opr);
1112 LIR_Opr len = length.result();
1113
1114 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
1115 ciKlass* obj = (ciKlass*) ciObjArrayKlass::make(x->klass());
1116 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
1117 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
1118 }
1119 klass2reg_with_patching(klass_reg, obj, patching_info);
1120 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
1121
1122 LIR_Opr result = rlock_result(x);
1123 __ move(reg, result);
1124 }
1125
1126
1127 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1128 Values* dims = x->dims();
1129 int i = dims->length();
1130 LIRItemList* items = new LIRItemList(dims->length(), NULL);
1131 while (i-- > 0) {
1132 LIRItem* size = new LIRItem(dims->at(i), this);
1133 items->at_put(i, size);
1134 }
1135
1136 // Evaluate state_for early since it may emit code.
1137 CodeEmitInfo* patching_info = NULL;
1138 if (!x->klass()->is_loaded() || PatchALot) {
1139 patching_info = state_for(x, x->state_before());
1140
1141 // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
1142 // clone all handlers (NOTE: Usually this is handled transparently
1143 // by the CodeEmitInfo cloning logic in CodeStub constructors but
1144 // is done explicitly here because a stub isn't being used).
1145 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
1146 }
1147 CodeEmitInfo* info = state_for(x, x->state());
1148
1149 i = dims->length();
1150 while (i-- > 0) {
|
1 /*
2 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, Red Hat Inc. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
1110
1111 length.load_item_force(FrameMap::r19_opr);
1112 LIR_Opr len = length.result();
1113
1114 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
1115 ciKlass* obj = (ciKlass*) ciObjArrayKlass::make(x->klass());
1116 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
1117 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
1118 }
1119 klass2reg_with_patching(klass_reg, obj, patching_info);
1120 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
1121
1122 LIR_Opr result = rlock_result(x);
1123 __ move(reg, result);
1124 }
1125
1126
1127 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1128 Values* dims = x->dims();
1129 int i = dims->length();
1130 LIRItemList* items = new LIRItemList(i, i, NULL);
1131 while (i-- > 0) {
1132 LIRItem* size = new LIRItem(dims->at(i), this);
1133 items->at_put(i, size);
1134 }
1135
1136 // Evaluate state_for early since it may emit code.
1137 CodeEmitInfo* patching_info = NULL;
1138 if (!x->klass()->is_loaded() || PatchALot) {
1139 patching_info = state_for(x, x->state_before());
1140
1141 // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
1142 // clone all handlers (NOTE: Usually this is handled transparently
1143 // by the CodeEmitInfo cloning logic in CodeStub constructors but
1144 // is done explicitly here because a stub isn't being used).
1145 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
1146 }
1147 CodeEmitInfo* info = state_for(x, x->state());
1148
1149 i = dims->length();
1150 while (i-- > 0) {
|