Mercurial > hg > truffle
annotate test/runtime/ClassFile/JsrRewriting.java @ 16047:692c25719837
Bugfix: Prefix byte missing for AMD64 byte instructions
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Thu, 05 Jun 2014 15:37:57 -0700 |
parents | 6f45933aef35 |
children |
rev | line source |
---|---|
12218
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
1 /* |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
4 * |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
7 * published by the Free Software Foundation. |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
8 * |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
13 * accompanied this code). |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
14 * |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
18 * |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
21 * questions. |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
22 */ |
3862
52e4ba46751f
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
23 |
12218
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
24 |
3862
52e4ba46751f
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
25 |
12218
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
26 /* |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
27 * @test JsrRewriting |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
28 * @summary JSR (jump local subroutine) |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
29 * rewriting can overflow memory address size variables |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
30 * @bug 7020373 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
31 * @bug 7055247 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
32 * @bug 7053586 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
33 * @bug 7185550 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
34 * @bug 7149464 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
35 * @key cte_test |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
36 * @library /testlibrary |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
37 * @run main JsrRewriting |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
38 */ |
3862
52e4ba46751f
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
39 |
12218
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
40 import com.oracle.java.testlibrary.*; |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
41 import java.io.File; |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
42 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
43 public class JsrRewriting { |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
44 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
45 public static void main(String[] args) throws Exception { |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
46 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
47 // ======= Configure the test |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
48 String jarFile = System.getProperty("test.src") + |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
49 File.separator + "JsrRewritingTestCase.jar"; |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
50 String className = "OOMCrashClass4000_1"; |
3862
52e4ba46751f
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
51 |
12218
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
52 // limit is 768MB in native words |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
53 int mallocMaxTestWords = (1024 * 1024 * 768 / 4); |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
54 if (Platform.is64bit()) |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
55 mallocMaxTestWords = (mallocMaxTestWords / 2); |
3862
52e4ba46751f
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
56 |
12218
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
57 // ======= extract the test class |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
58 ProcessBuilder pb = new ProcessBuilder(new String[] { |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
59 JDKToolFinder.getJDKTool("jar"), |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
60 "xvf", jarFile } ); |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
61 OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
62 output.shouldHaveExitValue(0); |
3862
52e4ba46751f
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
63 |
12218
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
64 // ======= execute the test |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
65 pb = ProcessTools.createJavaProcessBuilder( |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
66 "-cp", ".", |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
67 "-XX:+UnlockDiagnosticVMOptions", |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
68 "-XX:MallocMaxTestWords=" + mallocMaxTestWords, |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
69 className); |
3862
52e4ba46751f
7020373: JSR rewriting can overflow memory address size variables
kamg
parents:
diff
changeset
|
70 |
12218
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
71 output = new OutputAnalyzer(pb.start()); |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
72 String[] expectedMsgs = { |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
73 "java.lang.LinkageError", |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
74 "java.lang.NoSuchMethodError", |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
75 "Main method not found in class " + className, |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
76 "insufficient memory" |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
77 }; |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
78 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
79 MultipleOrMatch(output, expectedMsgs); |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
80 } |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
81 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
82 private static void |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
83 MultipleOrMatch(OutputAnalyzer analyzer, String[] whatToMatch) { |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
84 String output = analyzer.getOutput(); |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
85 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
86 for (String expected : whatToMatch) |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
87 if (output.contains(expected)) |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
88 return; |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
89 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
90 String err = |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
91 " stdout: [" + analyzer.getOutput() + "];\n" + |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
92 " exitValue = " + analyzer.getExitValue() + "\n"; |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
93 System.err.println(err); |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
94 |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
95 StringBuilder msg = new StringBuilder("Output did not contain " + |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
96 "any of the following expected messages: \n"); |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
97 for (String expected : whatToMatch) |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
98 msg.append(expected).append(System.lineSeparator()); |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
99 throw new RuntimeException(msg.toString()); |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
100 } |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
101 } |
6f45933aef35
7149464: [TESTBUG] Test runtime/7020373/Test7020373.sh failed to clean up files after test
mseledtsov
parents:
8831
diff
changeset
|
102 |