Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.common/src/jdk/vm/ci/common/JVMCIError.java @ 22672:1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 08 Oct 2015 17:28:41 -0700 |
parents | jvmci/jdk.internal.jvmci.common/src/jdk/internal/jvmci/common/JVMCIError.java@ec96f33a101d |
children |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
9303
diff
changeset
|
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
23 package jdk.vm.ci.common; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22534
diff
changeset
|
25 import java.util.ArrayList; |
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22534
diff
changeset
|
26 import java.util.Locale; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 /** |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
29 * Indicates a condition in JVMCI related code that should never occur during normal operation. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 */ |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
31 public class JVMCIError extends Error { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
32 |
15194
ba8e1fbe1de9
Regenerate serialVersionUID for GraalInternalError and GraalGraphInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
15193
diff
changeset
|
33 private static final long serialVersionUID = 531632331813456233L; |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
34 private final ArrayList<String> context = new ArrayList<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
36 public static RuntimeException unimplemented() { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
37 throw new JVMCIError("unimplemented"); |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
38 } |
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
39 |
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
40 public static RuntimeException unimplemented(String msg) { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
41 throw new JVMCIError("unimplemented: %s", msg); |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
42 } |
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
43 |
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
44 public static RuntimeException shouldNotReachHere() { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
45 throw new JVMCIError("should not reach here"); |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
46 } |
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
47 |
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
48 public static RuntimeException shouldNotReachHere(String msg) { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
49 throw new JVMCIError("should not reach here: %s", msg); |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
50 } |
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
51 |
20824
7976223c77b5
Add convenient shouldNotReachHere method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15246
diff
changeset
|
52 public static RuntimeException shouldNotReachHere(Throwable cause) { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
53 throw new JVMCIError(cause); |
20824
7976223c77b5
Add convenient shouldNotReachHere method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15246
diff
changeset
|
54 } |
7976223c77b5
Add convenient shouldNotReachHere method
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15246
diff
changeset
|
55 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 /** |
21565
f5b549811bac
fixed eclipseformat issues
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
57 * Checks a given condition and throws a {@link JVMCIError} if it is false. Guarantees are |
f5b549811bac
fixed eclipseformat issues
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
58 * stronger than assertions in that they are always checked. Error messages for guarantee |
9303
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
59 * violations should clearly indicate the nature of the problem as well as a suggested solution |
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
60 * if possible. |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
9303
diff
changeset
|
61 * |
9303
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
62 * @param condition the condition to check |
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
63 * @param msg the message that will be associated with the error, in |
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
64 * {@link String#format(String, Object...)} syntax |
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
65 * @param args arguments to the format string |
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
66 */ |
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
67 public static void guarantee(boolean condition, String msg, Object... args) { |
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
68 if (!condition) { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
69 throw new JVMCIError("failed guarantee: " + msg, args); |
9303
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
70 } |
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
71 } |
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
72 |
e26191d535a7
added guarantee() method to GraalInternalError
Doug Simon <doug.simon@oracle.com>
parents:
7530
diff
changeset
|
73 /** |
22534
bab91f9ae795
added support for embedding spaces in JVMCI options using % as the escape character (note: do not use with -G:, only with -Djvmci.option=...)
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
74 * This constructor creates a {@link JVMCIError} with a given message. |
bab91f9ae795
added support for embedding spaces in JVMCI options using % as the escape character (note: do not use with -G:, only with -Djvmci.option=...)
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
75 * |
bab91f9ae795
added support for embedding spaces in JVMCI options using % as the escape character (note: do not use with -G:, only with -Djvmci.option=...)
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
76 * @param msg the message that will be associated with the error |
bab91f9ae795
added support for embedding spaces in JVMCI options using % as the escape character (note: do not use with -G:, only with -Djvmci.option=...)
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
77 */ |
bab91f9ae795
added support for embedding spaces in JVMCI options using % as the escape character (note: do not use with -G:, only with -Djvmci.option=...)
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
78 public JVMCIError(String msg) { |
bab91f9ae795
added support for embedding spaces in JVMCI options using % as the escape character (note: do not use with -G:, only with -Djvmci.option=...)
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
79 super(msg); |
bab91f9ae795
added support for embedding spaces in JVMCI options using % as the escape character (note: do not use with -G:, only with -Djvmci.option=...)
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
80 } |
bab91f9ae795
added support for embedding spaces in JVMCI options using % as the escape character (note: do not use with -G:, only with -Djvmci.option=...)
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
81 |
bab91f9ae795
added support for embedding spaces in JVMCI options using % as the escape character (note: do not use with -G:, only with -Djvmci.option=...)
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
82 /** |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
83 * This constructor creates a {@link JVMCIError} with a message assembled via |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
5321
diff
changeset
|
84 * {@link String#format(String, Object...)}. It always uses the ENGLISH locale in order to |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
5321
diff
changeset
|
85 * always generate the same output. |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
9303
diff
changeset
|
86 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
87 * @param msg the message that will be associated with the error, in String.format syntax |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
5321
diff
changeset
|
88 * @param args parameters to String.format - parameters that implement {@link Iterable} will be |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
5321
diff
changeset
|
89 * expanded into a [x, x, ...] representation. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
90 */ |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
91 public JVMCIError(String msg, Object... args) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
92 super(format(msg, args)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
93 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
94 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
95 /** |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
96 * This constructor creates a {@link JVMCIError} for a given causing Throwable instance. |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
9303
diff
changeset
|
97 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
98 * @param cause the original exception that contains additional information on this error |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
99 */ |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
100 public JVMCIError(Throwable cause) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 super(cause); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
103 |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
9303
diff
changeset
|
104 /** |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
105 * This constructor creates a {@link JVMCIError} and adds all the |
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
106 * {@linkplain #addContext(String) context} of another {@link JVMCIError}. |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
9303
diff
changeset
|
107 * |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
108 * @param e the original {@link JVMCIError} |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
9303
diff
changeset
|
109 */ |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
110 public JVMCIError(JVMCIError e) { |
15246 | 111 super(e); |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
9303
diff
changeset
|
112 context.addAll(e.context); |
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
9303
diff
changeset
|
113 } |
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
9303
diff
changeset
|
114 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
115 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
116 public String toString() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
117 StringBuilder str = new StringBuilder(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 str.append(super.toString()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 for (String s : context) { |
4619
a09b44a28e7f
clenup unused floating nodes on killCFG
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4524
diff
changeset
|
120 str.append("\n\tat ").append(s); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 return str.toString(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
124 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
125 private static String format(String msg, Object... args) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
126 if (args != null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
127 // expand Iterable parameters into a list representation |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 for (int i = 0; i < args.length; i++) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
129 if (args[i] instanceof Iterable<?>) { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
130 ArrayList<Object> list = new ArrayList<>(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
131 for (Object o : (Iterable<?>) args[i]) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
132 list.add(o); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
133 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
134 args[i] = list.toString(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
135 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
136 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
137 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
138 return String.format(Locale.ENGLISH, msg, args); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
139 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
140 |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
141 public JVMCIError addContext(String newContext) { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
142 this.context.add(newContext); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 return this; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
20824
diff
changeset
|
146 public JVMCIError addContext(String name, Object obj) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 return addContext(format("%s: %s", name, obj)); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
148 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
149 } |