1 /* 2 * Copyright (c) 2009, 2012, 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 */ 23 24 25 package org.graalvm.compiler.jtt.bytecode; 26 27 import org.junit.Test; 28 29 import org.graalvm.compiler.jtt.JTTTest; 30 31 /* 32 */ 33 public class BC_multianewarray04 extends JTTTest { 34 test(int a)35 public static int test(int a) { 36 int i = 1; 37 38 i += testByte(a); 39 i += testBoolean(a); 40 i += testChar(a); 41 i += testShort(a); 42 i += testInt(a); 43 i += testFloat(a); 44 i += testLong(a); 45 i += testDouble(a); 46 47 return i; 48 } 49 testDouble(int a)50 private static int testDouble(int a) { 51 double[][] b2 = new double[a][a]; 52 double[][][] b3 = new double[a][a][a]; 53 double[][][][] b4 = new double[a][a][a][a]; 54 double[][][][][] b5 = new double[a][a][a][a][a]; 55 double[][][][][][] b6 = new double[a][a][a][a][a][a]; 56 return b2.length + b3.length + b4.length + b5.length + b6.length; 57 } 58 testLong(int a)59 private static int testLong(int a) { 60 long[][] b2 = new long[a][a]; 61 long[][][] b3 = new long[a][a][a]; 62 long[][][][] b4 = new long[a][a][a][a]; 63 long[][][][][] b5 = new long[a][a][a][a][a]; 64 long[][][][][][] b6 = new long[a][a][a][a][a][a]; 65 return b2.length + b3.length + b4.length + b5.length + b6.length; 66 } 67 testFloat(int a)68 private static int testFloat(int a) { 69 float[][] b2 = new float[a][a]; 70 float[][][] b3 = new float[a][a][a]; 71 float[][][][] b4 = new float[a][a][a][a]; 72 float[][][][][] b5 = new float[a][a][a][a][a]; 73 float[][][][][][] b6 = new float[a][a][a][a][a][a]; 74 return b2.length + b3.length + b4.length + b5.length + b6.length; 75 } 76 testInt(int a)77 private static int testInt(int a) { 78 int[][] b2 = new int[a][a]; 79 int[][][] b3 = new int[a][a][a]; 80 int[][][][] b4 = new int[a][a][a][a]; 81 int[][][][][] b5 = new int[a][a][a][a][a]; 82 int[][][][][][] b6 = new int[a][a][a][a][a][a]; 83 return b2.length + b3.length + b4.length + b5.length + b6.length; 84 } 85 testShort(int a)86 private static int testShort(int a) { 87 short[][] b2 = new short[a][a]; 88 short[][][] b3 = new short[a][a][a]; 89 short[][][][] b4 = new short[a][a][a][a]; 90 short[][][][][] b5 = new short[a][a][a][a][a]; 91 short[][][][][][] b6 = new short[a][a][a][a][a][a]; 92 return b2.length + b3.length + b4.length + b5.length + b6.length; 93 } 94 testChar(int a)95 private static int testChar(int a) { 96 char[][] b2 = new char[a][a]; 97 char[][][] b3 = new char[a][a][a]; 98 char[][][][] b4 = new char[a][a][a][a]; 99 char[][][][][] b5 = new char[a][a][a][a][a]; 100 char[][][][][][] b6 = new char[a][a][a][a][a][a]; 101 return b2.length + b3.length + b4.length + b5.length + b6.length; 102 } 103 testBoolean(int a)104 private static int testBoolean(int a) { 105 boolean[][] b2 = new boolean[a][a]; 106 boolean[][][] b3 = new boolean[a][a][a]; 107 boolean[][][][] b4 = new boolean[a][a][a][a]; 108 boolean[][][][][] b5 = new boolean[a][a][a][a][a]; 109 boolean[][][][][][] b6 = new boolean[a][a][a][a][a][a]; 110 return b2.length + b3.length + b4.length + b5.length + b6.length; 111 } 112 testByte(int a)113 private static int testByte(int a) { 114 byte[][] b2 = new byte[a][a]; 115 byte[][][] b3 = new byte[a][a][a]; 116 byte[][][][] b4 = new byte[a][a][a][a]; 117 byte[][][][][] b5 = new byte[a][a][a][a][a]; 118 byte[][][][][][] b6 = new byte[a][a][a][a][a][a]; 119 return b2.length + b3.length + b4.length + b5.length + b6.length; 120 } 121 122 @Test run0()123 public void run0() throws Throwable { 124 runTest("test", 1); 125 } 126 127 @Test run1()128 public void run1() throws Throwable { 129 runTest("test", 2); 130 } 131 132 } 133