1 /*
2 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2015 SAP SE. 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.
1038
1039 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
1040 ciMetadata* obj = ciObjArrayKlass::make(x->klass());
1041 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
1042 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
1043 }
1044 klass2reg_with_patching(klass_reg, obj, patching_info);
1045 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
1046
1047 // Must prevent reordering of stores for object initialization
1048 // with stores that publish the new object.
1049 __ membar_storestore();
1050 LIR_Opr result = rlock_result(x);
1051 __ move(reg, result);
1052 }
1053
1054
1055 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1056 Values* dims = x->dims();
1057 int i = dims->length();
1058 LIRItemList* items = new LIRItemList(dims->length(), NULL);
1059 while (i-- > 0) {
1060 LIRItem* size = new LIRItem(dims->at(i), this);
1061 items->at_put(i, size);
1062 }
1063
1064 // Evaluate state_for early since it may emit code.
1065 CodeEmitInfo* patching_info = NULL;
1066 if (!x->klass()->is_loaded() || PatchALot) {
1067 patching_info = state_for(x, x->state_before());
1068
1069 // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
1070 // clone all handlers (NOTE: Usually this is handled transparently
1071 // by the CodeEmitInfo cloning logic in CodeStub constructors but
1072 // is done explicitly here because a stub isn't being used).
1073 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
1074 }
1075 CodeEmitInfo* info = state_for(x, x->state());
1076
1077 i = dims->length();
1078 while (i-- > 0) {
|
1 /*
2 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2015 SAP SE. 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.
1038
1039 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
1040 ciMetadata* obj = ciObjArrayKlass::make(x->klass());
1041 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
1042 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
1043 }
1044 klass2reg_with_patching(klass_reg, obj, patching_info);
1045 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
1046
1047 // Must prevent reordering of stores for object initialization
1048 // with stores that publish the new object.
1049 __ membar_storestore();
1050 LIR_Opr result = rlock_result(x);
1051 __ move(reg, result);
1052 }
1053
1054
1055 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1056 Values* dims = x->dims();
1057 int i = dims->length();
1058 LIRItemList* items = new LIRItemList(i, i, NULL);
1059 while (i-- > 0) {
1060 LIRItem* size = new LIRItem(dims->at(i), this);
1061 items->at_put(i, size);
1062 }
1063
1064 // Evaluate state_for early since it may emit code.
1065 CodeEmitInfo* patching_info = NULL;
1066 if (!x->klass()->is_loaded() || PatchALot) {
1067 patching_info = state_for(x, x->state_before());
1068
1069 // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
1070 // clone all handlers (NOTE: Usually this is handled transparently
1071 // by the CodeEmitInfo cloning logic in CodeStub constructors but
1072 // is done explicitly here because a stub isn't being used).
1073 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
1074 }
1075 CodeEmitInfo* info = state_for(x, x->state());
1076
1077 i = dims->length();
1078 while (i-- > 0) {
|