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