Skip to content

Commit 3b06b2d

Browse files
committed
[GR-70700] Leave long properties out of exception messages
PullRequest: graal/22384
2 parents d88c8bd + e12448d commit 3b06b2d

File tree

17 files changed

+119
-88
lines changed

17 files changed

+119
-88
lines changed

compiler/mx.compiler/mx_graal_tools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def run_netbeans_app(app_name, jdkhome, args=None, dist=None):
6363
# Make sure that execution is allowed. The zip file does not always specfiy that correctly
6464
os.chmod(executable, 0o777)
6565

66-
launch = [executable]
66+
# the current launcher .conf file enables assertions so explicitly disable them until a new IGV
67+
# distribution is built
68+
launch = [executable, '-J-da']
6769
if jdkhome:
6870
launch += ['--jdkhome', jdkhome]
6971

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/UncheckedInterfaceProviderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void test() {
9898
for (BlackholeNode b : graph.getNodes().filter(BlackholeNode.class)) {
9999
MatcherAssert.assertThat(b.getValue(), is(instanceOf(UncheckedInterfaceProvider.class)));
100100
Stamp uncheckedStamp = ((UncheckedInterfaceProvider) b.getValue()).uncheckedStamp();
101-
String context = b.getValue().toString(Verbosity.Debugger);
101+
String context = b.getValue().toString(Verbosity.All);
102102
Assert.assertNotNull(context, uncheckedStamp);
103103
ResolvedJavaType uncheckedType = StampTool.typeOrNull(uncheckedStamp);
104104
ResolvedJavaType type = StampTool.typeOrNull(b.getValue());

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/core/test/ea/EscapeAnalysisTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,6 @@ public static void testNewNodeSnippet() {
418418
*/
419419
@Test
420420
public void testNewNode() {
421-
// Tracking of creation interferes with escape analysis
422-
Assume.assumeFalse(Node.TRACK_CREATION_POSITION);
423421
// JaCoco can add escaping allocations (e.g. allocation of coverage recording data
424422
// structures)
425423
Assume.assumeFalse("JaCoCo found -> skipping", SubprocessUtil.isJaCoCoAttached());

compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/debug/test/GraalErrorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int foo(int limit) {
100100

101101
// run with -Dtest.GraalErrorTest.stdout=true to inspect how error messages are formatted
102102
@Test
103-
public void testErrorExampels() {
103+
public void testErrorExamples() {
104104
StructuredGraph g = parseEager("foo", StructuredGraph.AllowAssumptions.NO);
105105

106106
FixedNode loopBeginNode = g.getNodes(LoopBeginNode.TYPE).first();

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/debug/GraalError.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ public class GraalError extends Error {
3939
private static final long serialVersionUID = 531632331813456233L;
4040
private final ArrayList<String> context = new ArrayList<>();
4141

42+
private final transient Object[] arguments;
43+
private final String rawFormat;
44+
4245
public static RuntimeException unimplemented(String msg) {
4346
throw new GraalError("unimplemented: %s", msg);
4447
}
@@ -246,6 +249,8 @@ public static void guarantee(boolean condition, String msg, Object... args) {
246249
*/
247250
public GraalError(String msg) {
248251
super(msg);
252+
this.rawFormat = msg;
253+
this.arguments = null;
249254
}
250255

251256
/**
@@ -260,6 +265,8 @@ public GraalError(String msg) {
260265
@SuppressWarnings("this-escape")
261266
public GraalError(String msg, Object... args) {
262267
super(format(msg, args));
268+
this.rawFormat = msg;
269+
this.arguments = args;
263270
potentiallyAddContext(args);
264271
}
265272

@@ -270,6 +277,8 @@ public GraalError(String msg, Object... args) {
270277
*/
271278
public GraalError(Throwable cause) {
272279
super(cause);
280+
this.rawFormat = null;
281+
this.arguments = null;
273282
}
274283

275284
/**
@@ -279,9 +288,27 @@ public GraalError(Throwable cause) {
279288
@SuppressWarnings("this-escape")
280289
public GraalError(Throwable cause, String msg, Object... args) {
281290
super(format(msg, args), cause);
291+
this.rawFormat = msg;
292+
this.arguments = args;
282293
potentiallyAddContext(args);
283294
}
284295

296+
/**
297+
* Return the raw format String passed into the constructor.
298+
*/
299+
public String getRawFormat() {
300+
return rawFormat;
301+
}
302+
303+
/**
304+
* Return the arguments passed into the constructor, with {@link Iterable} arguments expanded
305+
* into a {@link List}. The expansion is performed by {@link #format(String, Object...)} when it
306+
* formats the message for the constructor.
307+
*/
308+
public Object[] getArguments() {
309+
return arguments;
310+
}
311+
285312
private void potentiallyAddContext(Object[] args) {
286313
// be pessimistic here and ensure better reporting never causes a follow up error that is
287314
// unhandled
@@ -332,6 +359,8 @@ private static String potentialBetterString(Object o) {
332359
public GraalError(GraalError e) {
333360
super(e);
334361
context.addAll(e.context);
362+
this.rawFormat = null;
363+
this.arguments = null;
335364
}
336365

337366
public static GraalError asGraalError(Throwable t) {

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graph/GraalGraphError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public GraalGraphError addContext(Node newNode) {
9999
String nodeMessage;
100100
try {
101101
// Provide more detail about the node.
102-
nodeMessage = newNode.toString(Verbosity.Debugger);
102+
nodeMessage = newNode.toString(Verbosity.All);
103103
} catch (Throwable t) {
104104
nodeMessage = newNode.toString();
105105
}

0 commit comments

Comments
 (0)