hotspot/test/runtime/verifier/TestANewArray.java
author thartmann
Tue, 28 Oct 2014 16:44:39 +0100
changeset 27431 5f970b31939c
parent 25327 8b34977169da
child 29678 dd2f3932c21e
permissions -rw-r--r--
8062250: [TESTBUG] compiler/codecache/CheckSegmentedCodeCache.java fails after CodeCacheMinimumFreeSpace removal Summary: Adapted calculation of minimum code cache size after CodeCacheMinimumFreeSpace was removed by JDK-8046809. Reviewed-by: kvn, anoll
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25327
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
     1
/*
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
     4
 *
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
     8
 *
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    13
 * accompanied this code).
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    14
 *
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    18
 *
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    21
 * questions.
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    22
 */
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    23
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    24
import java.io.File;
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    25
import java.io.FileOutputStream;
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    26
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    27
import jdk.internal.org.objectweb.asm.ClassWriter;
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    28
import jdk.internal.org.objectweb.asm.MethodVisitor;
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    29
import static jdk.internal.org.objectweb.asm.Opcodes.*;
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    30
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    31
import com.oracle.java.testlibrary.*;
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    32
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    33
/*
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    34
 * @test
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    35
 * @summary Test that anewarray bytecode is valid only if it specifies 255 or fewer dimensions.
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    36
 * @library /testlibrary
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    37
 * @compile -XDignore.symbol.file TestANewArray.java
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    38
 * @run main/othervm TestANewArray 49
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    39
 * @run main/othervm TestANewArray 50
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    40
 * @run main/othervm TestANewArray 51
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    41
 * @run main/othervm TestANewArray 52
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    42
 */
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    43
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    44
/*
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    45
 * Testing anewarray instruction with 254, 255 & 264 dimensions to verify JVMS 8,
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    46
 * Section 4.9.1, Static Constraints that states the following:
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    47
 *
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    48
 * "No anewarray instruction may be used to create an array of more than 255 dimensions."
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    49
 *
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    50
 */
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    51
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    52
public class TestANewArray {
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    53
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    54
    static String classCName = null; // the generated class name
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    55
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    56
    static final int test_Dimension_254 = 254; // should always pass
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    57
    static final int test_Dimension_255 = 255; // should always pass, except for cfv 49
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    58
    static final int test_Dimension_264 = 264; // should always fail
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    59
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    60
    static final String array_Dimension_254 = genArrayDim(test_Dimension_254);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    61
    static final String array_Dimension_255 = genArrayDim(test_Dimension_255);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    62
    static final String array_Dimension_264 = genArrayDim(test_Dimension_264);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    63
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    64
    public static void main(String... args) throws Exception {
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    65
        int cfv = Integer.parseInt(args[0]);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    66
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    67
        // 254 array dimensions
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    68
        byte[] classFile_254 = dumpClassFile(cfv, test_Dimension_254, array_Dimension_254);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    69
        writeClassFileFromByteArray(classFile_254);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    70
        System.err.println("Running with cfv: " + cfv + ", test_Dimension_254");
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    71
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, "-verify", "-cp", ".",  classCName);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    72
        OutputAnalyzer output = new OutputAnalyzer(pb.start());
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    73
        output.shouldNotContain("java.lang.VerifyError");
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    74
        output.shouldHaveExitValue(0);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    75
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    76
        // 255 array dimensions
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    77
        byte[] classFile_255 = dumpClassFile(cfv, test_Dimension_255, array_Dimension_255);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    78
        writeClassFileFromByteArray(classFile_255);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    79
        System.err.println("Running with cfv: " + cfv + ", test_Dimension_255");
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    80
        pb = ProcessTools.createJavaProcessBuilder(true, "-verify", "-cp", ".",  classCName);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    81
        output = new OutputAnalyzer(pb.start());
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    82
        if (cfv == 49) {
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    83
            // The type-inferencing verifier used for <=49.0 ClassFiles detects an anewarray instruction
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    84
            // with exactly 255 dimensions and incorrectly issues the "Array with too many dimensions" VerifyError.
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    85
            output.shouldContain("Array with too many dimensions");
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    86
            output.shouldHaveExitValue(1);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    87
        } else {
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    88
            // 255 dimensions should always pass, except for cfv 49
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    89
            output.shouldNotContain("java.lang.VerifyError");
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    90
            output.shouldNotContain("java.lang.ClassFormatError");
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    91
            output.shouldHaveExitValue(0);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    92
        }
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    93
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    94
        // 264 array dimensions
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    95
        byte[] classFile_264 = dumpClassFile(cfv, test_Dimension_264, array_Dimension_264);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    96
        writeClassFileFromByteArray(classFile_264);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    97
        System.err.println("Running with cfv: " + cfv + ", test_Dimension_264");
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    98
        pb = ProcessTools.createJavaProcessBuilder(true, "-verify", "-cp", ".",  classCName);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
    99
        output = new OutputAnalyzer(pb.start());
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   100
        output.shouldContain("java.lang.ClassFormatError");
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   101
        output.shouldHaveExitValue(1);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   102
    }
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   103
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   104
    public static byte[] dumpClassFile(int cfv, int testDimension264, String arrayDim) throws Exception {
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   105
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   106
        MethodVisitor mv;
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   107
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   108
        classCName = "classCName_" + cfv + "_" + testDimension264;
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   109
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   110
        cw.visit(cfv, ACC_PUBLIC + ACC_SUPER, classCName, null, "java/lang/Object", null);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   111
        {
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   112
            mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   113
            mv.visitCode();
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   114
            mv.visitVarInsn(ALOAD, 0);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   115
            mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   116
            mv.visitInsn(RETURN);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   117
            mv.visitMaxs(1, 1);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   118
            mv.visitEnd();
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   119
        }
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   120
        {   // classCName main method
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   121
            mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   122
            mv.visitCode();
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   123
            mv.visitIntInsn(BIPUSH, 1);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   124
            mv.visitTypeInsn(ANEWARRAY, arrayDim); // Test ANEWARRAY bytecode with various dimensions
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   125
            mv.visitInsn(RETURN);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   126
            mv.visitMaxs(2, 2);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   127
            mv.visitEnd();
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   128
        }
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   129
        cw.visitEnd();
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   130
        return cw.toByteArray();
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   131
    }
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   132
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   133
    public static FileOutputStream writeClassFileFromByteArray(byte[] classFileByteArray) throws Exception {
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   134
        FileOutputStream fos = new FileOutputStream(new File(classCName + ".class"));
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   135
        fos.write(classFileByteArray);
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   136
        fos.close();
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   137
        return fos;
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   138
    }
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   139
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   140
    private static String genArrayDim(int testDim) {
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   141
        StringBuilder array_Dimension = new StringBuilder();
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   142
        for (int i = 0; i < testDim; i++)
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   143
        {
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   144
            array_Dimension.append("[");
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   145
        }
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   146
        return array_Dimension.append("Ljava/lang/Object;").toString();
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   147
    }
8b34977169da 8038074: [TESTBUG] Add test for anewarray instruction with more than 255 dimensions
gtriantafill
parents:
diff changeset
   148
}