001/*
002 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.
008 *
009 * This code is distributed in the hope that it will be useful, but WITHOUT
010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
011 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
012 * version 2 for more details (a copy is included in the LICENSE file that
013 * accompanied this code).
014 *
015 * You should have received a copy of the GNU General Public License version
016 * 2 along with this work; if not, write to the Free Software Foundation,
017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
018 *
019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
020 * or visit www.oracle.com if you need additional information or have any
021 * questions.
022 */
023package com.oracle.graal.jtt.bytecode;
024
025import org.junit.*;
026
027import com.oracle.graal.jtt.*;
028
029/*
030 */
031public class BC_multianewarray04 extends JTTTest {
032
033    public static int test(int a) {
034        int i = 1;
035
036        i += testByte(a);
037        i += testBoolean(a);
038        i += testChar(a);
039        i += testShort(a);
040        i += testInt(a);
041        i += testFloat(a);
042        i += testLong(a);
043        i += testDouble(a);
044
045        return i;
046    }
047
048    private static int testDouble(int a) {
049        double[][] b2 = new double[a][a];
050        double[][][] b3 = new double[a][a][a];
051        double[][][][] b4 = new double[a][a][a][a];
052        double[][][][][] b5 = new double[a][a][a][a][a];
053        double[][][][][][] b6 = new double[a][a][a][a][a][a];
054        return b2.length + b3.length + b4.length + b5.length + b6.length;
055    }
056
057    private static int testLong(int a) {
058        long[][] b2 = new long[a][a];
059        long[][][] b3 = new long[a][a][a];
060        long[][][][] b4 = new long[a][a][a][a];
061        long[][][][][] b5 = new long[a][a][a][a][a];
062        long[][][][][][] b6 = new long[a][a][a][a][a][a];
063        return b2.length + b3.length + b4.length + b5.length + b6.length;
064    }
065
066    private static int testFloat(int a) {
067        float[][] b2 = new float[a][a];
068        float[][][] b3 = new float[a][a][a];
069        float[][][][] b4 = new float[a][a][a][a];
070        float[][][][][] b5 = new float[a][a][a][a][a];
071        float[][][][][][] b6 = new float[a][a][a][a][a][a];
072        return b2.length + b3.length + b4.length + b5.length + b6.length;
073    }
074
075    private static int testInt(int a) {
076        int[][] b2 = new int[a][a];
077        int[][][] b3 = new int[a][a][a];
078        int[][][][] b4 = new int[a][a][a][a];
079        int[][][][][] b5 = new int[a][a][a][a][a];
080        int[][][][][][] b6 = new int[a][a][a][a][a][a];
081        return b2.length + b3.length + b4.length + b5.length + b6.length;
082    }
083
084    private static int testShort(int a) {
085        short[][] b2 = new short[a][a];
086        short[][][] b3 = new short[a][a][a];
087        short[][][][] b4 = new short[a][a][a][a];
088        short[][][][][] b5 = new short[a][a][a][a][a];
089        short[][][][][][] b6 = new short[a][a][a][a][a][a];
090        return b2.length + b3.length + b4.length + b5.length + b6.length;
091    }
092
093    private static int testChar(int a) {
094        char[][] b2 = new char[a][a];
095        char[][][] b3 = new char[a][a][a];
096        char[][][][] b4 = new char[a][a][a][a];
097        char[][][][][] b5 = new char[a][a][a][a][a];
098        char[][][][][][] b6 = new char[a][a][a][a][a][a];
099        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}