Mercurial > hg > truffle
annotate test/runtime/verifier/TestMultiANewArray.java @ 18965:53fcb13db742
Always use read aware memory scheduling.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 27 Jan 2015 11:47:44 +0100 |
parents | c4bc6b5c6f25 |
children |
rev | line source |
---|---|
17888
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
1 /* |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
4 * |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
8 * |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
13 * accompanied this code). |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
14 * |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
18 * |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
21 * questions. |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
22 */ |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
23 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
24 import java.io.File; |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
25 import java.io.FileOutputStream; |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
26 import jdk.internal.org.objectweb.asm.ClassWriter; |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
27 import jdk.internal.org.objectweb.asm.MethodVisitor; |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
28 import static jdk.internal.org.objectweb.asm.Opcodes.*; |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
29 import com.oracle.java.testlibrary.*; |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
30 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
31 /* |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
32 * @test TestMultiANewArray |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
33 * @bug 8038076 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
34 * @library /testlibrary |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
35 * @compile -XDignore.symbol.file TestMultiANewArray.java |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
36 * @run main/othervm TestMultiANewArray 49 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
37 * @run main/othervm TestMultiANewArray 50 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
38 * @run main/othervm TestMultiANewArray 51 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
39 * @run main/othervm TestMultiANewArray 52 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
40 */ |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
41 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
42 public class TestMultiANewArray { |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
43 public static void main(String... args) throws Exception { |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
44 int cfv = Integer.parseInt(args[0]); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
45 writeClassFile(cfv); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
46 System.err.println("Running with cfv: " + cfv); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
47 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, "-cp", ".", "ClassFile"); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
48 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
49 output.shouldContain("VerifyError"); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
50 output.shouldHaveExitValue(1); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
51 } |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
52 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
53 public static void writeClassFile(int cfv) throws Exception { |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
54 ClassWriter cw = new ClassWriter(0); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
55 MethodVisitor mv; |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
56 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
57 cw.visit(cfv, ACC_PUBLIC + ACC_SUPER, "ClassFile", null, "java/lang/Object", null); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
58 mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
59 mv.visitCode(); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
60 mv.visitVarInsn(ALOAD, 0); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
61 mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
62 mv.visitInsn(RETURN); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
63 mv.visitMaxs(1, 1); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
64 mv.visitEnd(); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
65 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
66 mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
67 mv.visitCode(); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
68 mv.visitInsn(ICONST_1); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
69 mv.visitInsn(ICONST_2); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
70 mv.visitMultiANewArrayInsn("[I", 2); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
71 mv.visitVarInsn(ASTORE, 1); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
72 mv.visitInsn(RETURN); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
73 mv.visitMaxs(2, 2); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
74 mv.visitEnd(); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
75 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
76 cw.visitEnd(); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
77 |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
78 try (FileOutputStream fos = new FileOutputStream(new File("ClassFile.class"))) { |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
79 fos.write(cw.toByteArray()); |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
80 } |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
81 } |
c4bc6b5c6f25
8038076: constraint on multianewarray instruction is not checked since class version 50.
lfoltan
parents:
diff
changeset
|
82 } |