Mercurial > hg > graal-compiler
annotate test/serviceability/sa/jmap-hashcode/Test8028623.java @ 14287:0129aea3736a
8032466: serviceability/sa/jmap-hashcode/Test8028623.java fails with compilation errors
Reviewed-by: dsamersoff, sla
author | kevinw |
---|---|
date | Thu, 23 Jan 2014 09:33:50 +0000 |
parents | baa7d4400c62 |
children | 09f19d3de485 |
rev | line source |
---|---|
14283
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
1 /* |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
4 * |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
8 * |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
13 * accompanied this code). |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
14 * |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
18 * |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
21 * questions. |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
22 */ |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
23 |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
24 /* |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
25 * @test |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
26 * @bug 8028623 |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
27 * @summary Test hashing of extended characters in Serviceability Agent. |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
28 * @library /testlibrary |
14287
0129aea3736a
8032466: serviceability/sa/jmap-hashcode/Test8028623.java fails with compilation errors
kevinw
parents:
14283
diff
changeset
|
29 * @compile -encoding utf8 Test8028623.java |
0129aea3736a
8032466: serviceability/sa/jmap-hashcode/Test8028623.java fails with compilation errors
kevinw
parents:
14283
diff
changeset
|
30 * @run main Test8028623 |
14283
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
31 */ |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
32 |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
33 import com.oracle.java.testlibrary.JDKToolLauncher; |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
34 import com.oracle.java.testlibrary.OutputBuffer; |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
35 import com.oracle.java.testlibrary.ProcessTools; |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
36 |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
37 import java.io.File; |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
38 |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
39 public class Test8028623 { |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
40 |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
41 public static int à = 1; |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
42 public static String dumpFile = "heap.out"; |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
43 |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
44 public static void main (String[] args) { |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
45 |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
46 System.out.println(Ã); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
47 |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
48 try { |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
49 int pid = ProcessTools.getProcessId(); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
50 JDKToolLauncher jmap = JDKToolLauncher.create("jmap") |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
51 .addToolArg("-F") |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
52 .addToolArg("-dump:live,format=b,file=" + dumpFile) |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
53 .addToolArg(Integer.toString(pid)); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
54 ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
55 OutputBuffer output = ProcessTools.getOutput(pb); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
56 Process p = pb.start(); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
57 int e = p.waitFor(); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
58 System.out.println("stdout:"); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
59 System.out.println(output.getStdout()); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
60 System.out.println("stderr:"); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
61 System.out.println(output.getStderr()); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
62 |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
63 if (e != 0) { |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
64 throw new RuntimeException("jmap returns: " + e); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
65 } |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
66 if (! new File(dumpFile).exists()) { |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
67 throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
68 } |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
69 } catch (Throwable t) { |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
70 t.printStackTrace(); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
71 throw new RuntimeException("Test failed with: " + t); |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
72 } |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
73 } |
baa7d4400c62
8028623: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
kevinw
parents:
diff
changeset
|
74 } |