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 *
1016 LIR_Opr tmp4 = FrameMap::O1_oop_opr;
1017 LIR_Opr klass_reg = FrameMap::G5_metadata_opr;
1018 LIR_Opr len = length.result();
1019
1020 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
1021 ciMetadata* obj = ciObjArrayKlass::make(x->klass());
1022 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
1023 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
1024 }
1025 klass2reg_with_patching(klass_reg, obj, patching_info);
1026 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
1027
1028 LIR_Opr result = rlock_result(x);
1029 __ move(reg, result);
1030 }
1031
1032
1033 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1034 Values* dims = x->dims();
1035 int i = dims->length();
1036 LIRItemList* items = new LIRItemList(dims->length(), NULL);
1037 while (i-- > 0) {
1038 LIRItem* size = new LIRItem(dims->at(i), this);
1039 items->at_put(i, size);
1040 }
1041
1042 // Evaluate state_for early since it may emit code.
1043 CodeEmitInfo* patching_info = NULL;
1044 if (!x->klass()->is_loaded() || PatchALot) {
1045 patching_info = state_for(x, x->state_before());
1046
1047 // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
1048 // clone all handlers (NOTE: Usually this is handled transparently
1049 // by the CodeEmitInfo cloning logic in CodeStub constructors but
1050 // is done explicitly here because a stub isn't being used).
1051 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
1052 }
1053 CodeEmitInfo* info = state_for(x, x->state());
1054
1055 i = dims->length();
1056 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 *
1016 LIR_Opr tmp4 = FrameMap::O1_oop_opr;
1017 LIR_Opr klass_reg = FrameMap::G5_metadata_opr;
1018 LIR_Opr len = length.result();
1019
1020 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
1021 ciMetadata* obj = ciObjArrayKlass::make(x->klass());
1022 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
1023 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error");
1024 }
1025 klass2reg_with_patching(klass_reg, obj, patching_info);
1026 __ allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
1027
1028 LIR_Opr result = rlock_result(x);
1029 __ move(reg, result);
1030 }
1031
1032
1033 void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1034 Values* dims = x->dims();
1035 int i = dims->length();
1036 LIRItemList* items = new LIRItemList(i, i, NULL);
1037 while (i-- > 0) {
1038 LIRItem* size = new LIRItem(dims->at(i), this);
1039 items->at_put(i, size);
1040 }
1041
1042 // Evaluate state_for early since it may emit code.
1043 CodeEmitInfo* patching_info = NULL;
1044 if (!x->klass()->is_loaded() || PatchALot) {
1045 patching_info = state_for(x, x->state_before());
1046
1047 // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
1048 // clone all handlers (NOTE: Usually this is handled transparently
1049 // by the CodeEmitInfo cloning logic in CodeStub constructors but
1050 // is done explicitly here because a stub isn't being used).
1051 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
1052 }
1053 CodeEmitInfo* info = state_for(x, x->state());
1054
1055 i = dims->length();
1056 while (i-- > 0) {
|