Mercurial > hg > graal-compiler
annotate test/sanity/WhiteBox.java @ 12430:c0e660b07e02
introduced HotSpotRegistersProvider interface
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 15 Oct 2013 22:19:41 +0200 |
parents | dc7db03f5aa2 |
children |
rev | line source |
---|---|
10196
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
1 /* |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
4 * |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
8 * |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
13 * accompanied this code). |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
14 * |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
18 * |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
21 * questions. |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
22 */ |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
23 |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
24 /* |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
25 * @test WhiteBox |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
26 * @bug 8011675 |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
27 * @summary verify that whitebox can be used even if not all functions are declared in java-part |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
28 * @author igor.ignatyev@oracle.com |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
29 * @library /testlibrary |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
30 * @compile WhiteBox.java |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
31 * @run main ClassFileInstaller sun.hotspot.WhiteBox |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
32 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI sun.hotspot.WhiteBox |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
33 * @clean sun.hotspot.WhiteBox |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
34 */ |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
35 |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
36 package sun.hotspot; |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
37 |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
38 public class WhiteBox { |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
39 private static native void registerNatives(); |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
40 static { registerNatives(); } |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
41 public native int notExistedMethod(); |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
42 public native int getHeapOopSize(); |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
43 public static void main(String[] args) { |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
44 WhiteBox wb = new WhiteBox(); |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
45 if (wb.getHeapOopSize() < 0) { |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
46 throw new Error("wb.getHeapOopSize() < 0"); |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
47 } |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
48 boolean catched = false; |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
49 try { |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
50 wb.notExistedMethod(); |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
51 } catch (UnsatisfiedLinkError e) { |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
52 catched = true; |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
53 } |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
54 if (!catched) { |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
55 throw new Error("wb.notExistedMethod() was invoked"); |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
56 } |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
57 } |
dc7db03f5aa2
8012337: Change Whitebox implementation to make absence of method in Whitebox.class not fatal
iignatyev
parents:
diff
changeset
|
58 } |