annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java @ 19022:859ee5dad32c

Pass StackSlotAllocator to FrameMapBuilder.buildFrameMap().
author Josef Eisl <josef.eisl@jku.at>
date Wed, 03 Dec 2014 22:55:03 +0100
parents ecb9d0cedbab
children 11ec0a5c5518
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.compiler;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25 import java.io.*;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26 import java.util.*;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28 import com.oracle.graal.api.code.*;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29 import com.oracle.graal.api.meta.*;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30 import com.oracle.graal.debug.*;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31 import com.oracle.graal.graph.*;
13516
0b17dd482532 don't optimize moves involving unallocatable registers
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13323
diff changeset
32 import com.oracle.graal.lir.*;
16841
cbd42807a31f moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents: 16794
diff changeset
33 import com.oracle.graal.nodeinfo.*;
9620
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
34 import com.oracle.graal.nodes.*;
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 import com.oracle.graal.nodes.util.*;
9849
e876c2a6954f extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9620
diff changeset
36 import com.oracle.graal.options.*;
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 public class GraalDebugConfig implements DebugConfig {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39
9849
e876c2a6954f extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9620
diff changeset
40 // @formatter:off
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
41 @Option(help = "Pattern for scope(s) in which dumping is enabled (see DebugFilter and Debug.dump)", type = OptionType.Debug)
9914
84890660eefb cleaner implementation of stable options
Doug Simon <doug.simon@oracle.com>
parents: 9912
diff changeset
42 public static final OptionValue<String> Dump = new OptionValue<>(null);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
43 @Option(help = "Pattern for scope(s) in which metering is enabled (see DebugFilter and Debug.metric)", type = OptionType.Debug)
9914
84890660eefb cleaner implementation of stable options
Doug Simon <doug.simon@oracle.com>
parents: 9912
diff changeset
44 public static final OptionValue<String> Meter = new OptionValue<>(null);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
45 @Option(help = "Pattern for scope(s) in which verification is enabled (see DebugFilter and Debug.verify)", type = OptionType.Debug)
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
46 public static final OptionValue<String> Verify = new OptionValue<>(null);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
47 @Option(help = "Pattern for scope(s) in which memory use tracking is enabled (see DebugFilter and Debug.metric)", type = OptionType.Debug)
15581
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15453
diff changeset
48 public static final OptionValue<String> TrackMemUse = new OptionValue<>(null);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
49 @Option(help = "Pattern for scope(s) in which timing is enabled (see DebugFilter and Debug.timer)", type = OptionType.Debug)
9914
84890660eefb cleaner implementation of stable options
Doug Simon <doug.simon@oracle.com>
parents: 9912
diff changeset
50 public static final OptionValue<String> Time = new OptionValue<>(null);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
51 @Option(help = "Pattern for scope(s) in which logging is enabled (see DebugFilter and Debug.log)", type = OptionType.Debug)
9914
84890660eefb cleaner implementation of stable options
Doug Simon <doug.simon@oracle.com>
parents: 9912
diff changeset
52 public static final OptionValue<String> Log = new OptionValue<>(null);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
53 @Option(help = "Pattern for filtering debug scope output based on method context (see MethodFilter)", type = OptionType.Debug)
9914
84890660eefb cleaner implementation of stable options
Doug Simon <doug.simon@oracle.com>
parents: 9912
diff changeset
54 public static final OptionValue<String> MethodFilter = new OptionValue<>(null);
11366
d335c16d2fe7 replaced PerThreadDebugValues, SummarizeDebugValues and SummarisePerPhase options with DebugValueSummary option
Doug Simon <doug.simon@oracle.com>
parents: 9914
diff changeset
55 @Option(help = "How to print metric and timing values:%n" +
d335c16d2fe7 replaced PerThreadDebugValues, SummarizeDebugValues and SummarisePerPhase options with DebugValueSummary option
Doug Simon <doug.simon@oracle.com>
parents: 9914
diff changeset
56 "Name - aggregate by unqualified name%n" +
11369
03fb03763b63 small fixes for handling of -G:DebugValueSummary option
Doug Simon <doug.simon@oracle.com>
parents: 11366
diff changeset
57 "Partial - aggregate by partially qualified name (e.g., A.B.C.D.Counter and X.Y.Z.D.Counter will be merged to D.Counter)%n" +
11366
d335c16d2fe7 replaced PerThreadDebugValues, SummarizeDebugValues and SummarisePerPhase options with DebugValueSummary option
Doug Simon <doug.simon@oracle.com>
parents: 9914
diff changeset
58 "Complete - aggregate by qualified name%n" +
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
59 "Thread - aggregate by qualified name and thread", type = OptionType.Debug)
11598
ecbeceacca98 changed default for -G:DebugValueSummary to "Name"
Doug Simon <doug.simon@oracle.com>
parents: 11564
diff changeset
60 public static final OptionValue<String> DebugValueSummary = new OptionValue<>("Name");
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
61 @Option(help = "Omit reporting 0-value metrics", type = OptionType.Debug)
12506
1be3cb11f88e enable zero-count metrics to be shown (disable with new -G:+SuppressZeroDebugValues option)
Doug Simon <doug.simon@oracle.com>
parents: 11704
diff changeset
62 public static final OptionValue<Boolean> SuppressZeroDebugValues = new OptionValue<>(false);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
63 @Option(help = "Send Graal IR to dump handlers on error", type = OptionType.Debug)
9914
84890660eefb cleaner implementation of stable options
Doug Simon <doug.simon@oracle.com>
parents: 9912
diff changeset
64 public static final OptionValue<Boolean> DumpOnError = new OptionValue<>(false);
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
65 @Option(help = "Enable expensive assertions", type = OptionType.Debug)
9914
84890660eefb cleaner implementation of stable options
Doug Simon <doug.simon@oracle.com>
parents: 9912
diff changeset
66 public static final OptionValue<Boolean> DetailedAsserts = new StableOptionValue<Boolean>() {
9855
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9849
diff changeset
67 @Override
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9849
diff changeset
68 protected Boolean initialValue() {
9912
fbad7372eccd added support for stable options
Doug Simon <doug.simon@oracle.com>
parents: 9855
diff changeset
69 boolean enabled = false;
9855
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9849
diff changeset
70 // turn detailed assertions on when the general assertions are on (misusing the assert keyword for this)
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9849
diff changeset
71 assert (enabled = true) == true;
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9849
diff changeset
72 return enabled;
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9849
diff changeset
73 }
6898d8995866 converted more options from GraalOptions to new system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9849
diff changeset
74 };
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 17303
diff changeset
75 @Option(help = "Enable more verbose log output when available", type = OptionType.Debug)
15453
100306ae985b switch MatchRule from class to method annotation and fix review feedback
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13516
diff changeset
76 public static final OptionValue<Boolean> LogVerbose = new OptionValue<>(false);
9849
e876c2a6954f extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9620
diff changeset
77 // @formatter:on
e876c2a6954f extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9620
diff changeset
78
11563
9d9c944f2940 removed side effect of -XX:+CITime on -G:Meter and -G:Time (GRAAL-195)
Doug Simon <doug.simon@oracle.com>
parents: 11561
diff changeset
79 public static boolean areDebugScopePatternsEnabled() {
12518
0916da3633ac only show metric and timer values if -G:Meter or -G:Time is enabled
Doug Simon <doug.simon@oracle.com>
parents: 12506
diff changeset
80 return DumpOnError.getValue() || Dump.getValue() != null || Log.getValue() != null || areMetricsOrTimersEnabled();
0916da3633ac only show metric and timer values if -G:Meter or -G:Time is enabled
Doug Simon <doug.simon@oracle.com>
parents: 12506
diff changeset
81 }
0916da3633ac only show metric and timer values if -G:Meter or -G:Time is enabled
Doug Simon <doug.simon@oracle.com>
parents: 12506
diff changeset
82
0916da3633ac only show metric and timer values if -G:Meter or -G:Time is enabled
Doug Simon <doug.simon@oracle.com>
parents: 12506
diff changeset
83 public static boolean areMetricsOrTimersEnabled() {
15581
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15453
diff changeset
84 return Meter.getValue() != null || Time.getValue() != null || TrackMemUse.getValue() != null;
11561
e1309fc4d17f ensure Debug.enable() is called before any DebugTimer or DebugMetric objects are requested
Doug Simon <doug.simon@oracle.com>
parents: 11504
diff changeset
85 }
e1309fc4d17f ensure Debug.enable() is called before any DebugTimer or DebugMetric objects are requested
Doug Simon <doug.simon@oracle.com>
parents: 11504
diff changeset
86
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 private final DebugFilter logFilter;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88 private final DebugFilter meterFilter;
15581
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15453
diff changeset
89 private final DebugFilter trackMemUseFilter;
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 private final DebugFilter timerFilter;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
91 private final DebugFilter dumpFilter;
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
92 private final DebugFilter verifyFilter;
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
93 private final MethodFilter[] methodFilter;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
94 private final List<DebugDumpHandler> dumpHandlers;
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
95 private final List<DebugVerifyHandler> verifyHandlers;
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
96 private final PrintStream output;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
97 private final Set<Object> extraFilters = new HashSet<>();
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
99 public GraalDebugConfig(String logFilter, String meterFilter, String trackMemUseFilter, String timerFilter, String dumpFilter, String verifyFilter, String methodFilter, PrintStream output,
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
100 List<DebugDumpHandler> dumpHandlers, List<DebugVerifyHandler> verifyHandlers) {
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101 this.logFilter = DebugFilter.parse(logFilter);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
102 this.meterFilter = DebugFilter.parse(meterFilter);
15581
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15453
diff changeset
103 this.trackMemUseFilter = DebugFilter.parse(trackMemUseFilter);
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
104 this.timerFilter = DebugFilter.parse(timerFilter);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
105 this.dumpFilter = DebugFilter.parse(dumpFilter);
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
106 this.verifyFilter = DebugFilter.parse(verifyFilter);
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107 if (methodFilter == null || methodFilter.isEmpty()) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
108 this.methodFilter = null;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109 } else {
11491
a03452edfc4d made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents: 11489
diff changeset
110 this.methodFilter = com.oracle.graal.compiler.MethodFilter.parse(methodFilter);
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
111 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
112
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
113 // Report the filters that have been configured so the user can verify it's what they expect
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
114 if (logFilter != null || meterFilter != null || timerFilter != null || dumpFilter != null || methodFilter != null) {
7561
0fdea35766a8 disabled verbose reporting of non-null options for -G:Dump, -G:Meter, -G:Log, -G:Timer as it means these options cannot be used when running the 'mx bench' command
Doug Simon <doug.simon@oracle.com>
parents: 7318
diff changeset
115 // TTY.println(Thread.currentThread().getName() + ": " + toString());
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
116 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
117 this.dumpHandlers = dumpHandlers;
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
118 this.verifyHandlers = verifyHandlers;
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
119 this.output = output;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
122 public int getLogLevel() {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
123 return getLevel(logFilter);
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
124 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
125
13323
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
126 public boolean isLogEnabledForMethod() {
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
127 return isEnabledForMethod(logFilter);
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
128 }
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
129
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130 public boolean isMeterEnabled() {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 return isEnabled(meterFilter);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
133
15581
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15453
diff changeset
134 public boolean isMemUseTrackingEnabled() {
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15453
diff changeset
135 return isEnabled(trackMemUseFilter);
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15453
diff changeset
136 }
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15453
diff changeset
137
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
138 public int getDumpLevel() {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
139 return getLevel(dumpFilter);
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
140 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141
13323
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
142 public boolean isDumpEnabledForMethod() {
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
143 return isEnabledForMethod(dumpFilter);
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
144 }
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
145
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
146 public boolean isVerifyEnabled() {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
147 return isEnabled(verifyFilter);
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
148 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
149
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
150 public boolean isVerifyEnabledForMethod() {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
151 return isEnabledForMethod(verifyFilter);
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
152 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
153
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
154 public boolean isTimeEnabled() {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
155 return isEnabled(timerFilter);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
156 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
157
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
158 public PrintStream output() {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
159 return output;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
160 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
161
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
162 private boolean isEnabled(DebugFilter filter) {
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
163 return getLevel(filter) > 0;
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
164 }
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
165
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
166 private int getLevel(DebugFilter filter) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
167 int level = checkDebugFilter(Debug.currentScope(), filter);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
168 if (level > 0 && !checkMethodFilter()) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
169 level = 0;
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
170 }
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
171 return level;
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
172 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
173
13323
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
174 private boolean isEnabledForMethod(DebugFilter filter) {
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
175 return filter != null && checkMethodFilter();
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
176 }
48e821e409eb Add Debug.isDumpEnabledForMethod() and Debug.isLogEnabledForMethod() use it to diable graph compression and enable guard-id-as-debug-id
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 12705
diff changeset
177
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
178 private static int checkDebugFilter(String currentScope, DebugFilter filter) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
179 if (filter == null) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
180 return 0;
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
181 } else {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
182 return filter.matchLevel(currentScope);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
183 }
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
184 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
185
9620
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
186 /**
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
187 * Extracts a {@link JavaMethod} from an opaque debug context.
15453
100306ae985b switch MatchRule from class to method annotation and fix review feedback
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13516
diff changeset
188 *
9620
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
189 * @return the {@link JavaMethod} represented by {@code context} or null
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
190 */
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
191 public static JavaMethod asJavaMethod(Object context) {
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
192 if (context instanceof JavaMethod) {
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
193 return (JavaMethod) context;
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
194 }
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
195 if (context instanceof StructuredGraph) {
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
196 ResolvedJavaMethod method = ((StructuredGraph) context).method();
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
197 if (method != null) {
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
198 return method;
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
199 }
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
200 }
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
201 return null;
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
202 }
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
203
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
204 private boolean checkMethodFilter() {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
205 if (methodFilter == null && extraFilters.isEmpty()) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
206 return true;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
207 } else {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
208 for (Object o : Debug.context()) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
209 if (extraFilters.contains(o)) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
210 return true;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
211 } else if (methodFilter != null) {
9620
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
212 JavaMethod method = asJavaMethod(o);
0eda2b7df748 fixed debug scope processing so that -G:MethodFilter option works as expected
Doug Simon <doug.simon@oracle.com>
parents: 7561
diff changeset
213 if (method != null) {
11491
a03452edfc4d made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents: 11489
diff changeset
214 if (com.oracle.graal.compiler.MethodFilter.matches(methodFilter, method)) {
a03452edfc4d made enabling/disabling of intrinsifications extensible (GRAAL-111)
Doug Simon <doug.simon@oracle.com>
parents: 11489
diff changeset
215 return true;
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
216 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
217 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
218 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
219 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
220 return false;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
221 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
222 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
223
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
224 @Override
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
225 public String toString() {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
226 StringBuilder sb = new StringBuilder();
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
227 sb.append("Debug config:");
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
228 add(sb, "Log", logFilter);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
229 add(sb, "Meter", meterFilter);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
230 add(sb, "Time", timerFilter);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
231 add(sb, "Dump", dumpFilter);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
232 add(sb, "MethodFilter", methodFilter);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
233 return sb.toString();
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
234 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
235
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
236 private static void add(StringBuilder sb, String name, Object filter) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
237 if (filter != null) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
238 sb.append(' ');
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
239 sb.append(name);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
240 sb.append('=');
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
241 if (filter instanceof Object[]) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
242 sb.append(Arrays.toString((Object[]) filter));
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
243 } else {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
244 sb.append(String.valueOf(filter));
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
245 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
246 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
247 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
248
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
249 @Override
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
250 public RuntimeException interceptException(Throwable e) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
251 if (e instanceof BailoutException) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
252 return null;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
253 }
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
254 Debug.setConfig(Debug.fixedConfig(Debug.DEFAULT_LOG_LEVEL, Debug.DEFAULT_LOG_LEVEL, false, false, false, false, dumpHandlers, verifyHandlers, output));
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
255 Debug.log(String.format("Exception occurred in scope: %s", Debug.currentScope()));
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
256 for (Object o : Debug.context()) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
257 if (o instanceof Graph) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
258 Debug.log("Context obj %s", o);
9849
e876c2a6954f extensible option system (GRAAL-27)
Doug Simon <doug.simon@oracle.com>
parents: 9620
diff changeset
259 if (DumpOnError.getValue()) {
16794
74c02c90a3f9 add exception to graph name in exception graph dump
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16733
diff changeset
260 Debug.dump(o, "Exception graph: " + e);
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
261 } else {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
262 Debug.log("Use -G:+DumpOnError to enable dumping of graphs on this error");
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
263 }
13516
0b17dd482532 don't optimize moves involving unallocatable registers
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13323
diff changeset
264 } else if (o instanceof LIR) {
0b17dd482532 don't optimize moves involving unallocatable registers
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13323
diff changeset
265 Debug.log("Context obj %s", o);
0b17dd482532 don't optimize moves involving unallocatable registers
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13323
diff changeset
266 if (DumpOnError.getValue()) {
16794
74c02c90a3f9 add exception to graph name in exception graph dump
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16733
diff changeset
267 Debug.dump(o, "Exception LIR: " + e);
13516
0b17dd482532 don't optimize moves involving unallocatable registers
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13323
diff changeset
268 } else {
0b17dd482532 don't optimize moves involving unallocatable registers
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13323
diff changeset
269 Debug.log("Use -G:+DumpOnError to enable dumping of graphs on this error");
0b17dd482532 don't optimize moves involving unallocatable registers
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13323
diff changeset
270 }
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
271 } else if (o instanceof Node) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
272 String location = GraphUtil.approxSourceLocation((Node) o);
13516
0b17dd482532 don't optimize moves involving unallocatable registers
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13323
diff changeset
273 String node = ((Node) o).toString(Verbosity.Debugger);
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
274 if (location != null) {
13516
0b17dd482532 don't optimize moves involving unallocatable registers
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13323
diff changeset
275 Debug.log("Context obj %s (approx. location: %s)", node, location);
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
276 } else {
13516
0b17dd482532 don't optimize moves involving unallocatable registers
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13323
diff changeset
277 Debug.log("Context obj %s", node);
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
278 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
279 } else {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
280 Debug.log("Context obj %s", o);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
281 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
282 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
283 return null;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
284 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
285
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
286 @Override
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
287 public Collection<DebugDumpHandler> dumpHandlers() {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
288 return dumpHandlers;
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
289 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
290
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
291 @Override
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
292 public Collection<DebugVerifyHandler> verifyHandlers() {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
293 return verifyHandlers;
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
294 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
295
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
296 @Override
7318
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
297 public void addToContext(Object o) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
298 extraFilters.add(o);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
299 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
300
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
301 @Override
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
302 public void removeFromContext(Object o) {
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
303 extraFilters.remove(o);
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
304 }
323ece2b012b Refactor debug environment creation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
305 }