annotate graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DelegatingDebugConfig.java @ 21754:aa5fa1190d6c

count all type check hint misses not just the last one
author Doug Simon <doug.simon@oracle.com>
date Fri, 05 Jun 2015 23:03:41 +0200
parents f5b549811bac
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
1 /*
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
4 *
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
8 *
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
13 * accompanied this code).
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
14 *
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
18 *
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
21 * questions.
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
22 */
21554
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 17069
diff changeset
23 package com.oracle.jvmci.debug;
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
24
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
25 import java.io.*;
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
26 import java.util.*;
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
27
21554
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 17069
diff changeset
28 import com.oracle.jvmci.debug.internal.*;
b1530a6cce8c renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 17069
diff changeset
29
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
30 public class DelegatingDebugConfig implements DebugConfig {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
31
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
32 protected final DebugConfig delegate;
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
33
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
34 /**
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
35 * The features of a {@link DelegatingDebugConfig} that can be force
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
36 * {@linkplain DelegatingDebugConfig#enable(Feature) enabled}/
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
37 * {@linkplain DelegatingDebugConfig#disable(Feature) disabled} or
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
38 * {@linkplain DelegatingDebugConfig#delegate(Feature) delegated}.
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
39 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
40 public enum Feature {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
41 /**
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
42 * @see Debug#isLogEnabledForMethod()
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
43 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
44 LOG_METHOD,
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
45 /**
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
46 * @see Debug#isDumpEnabledForMethod()
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
47 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
48 DUMP_METHOD,
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
49 /**
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
50 * @see Debug#isVerifyEnabled()
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
51 */
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
52 VERIFY,
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
53 /**
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
54 * @see Debug#isVerifyEnabledForMethod()
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
55 */
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
56 VERIFY_METHOD,
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
57 /**
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
58 * @see Debug#isMeterEnabled()
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
59 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
60 METER,
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
61 /**
15581
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
62 * @see Debug#isMemUseTrackingEnabled()
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
63 */
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
64 TRACK_MEM_USE,
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
65 /**
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
66 * @see Debug#isTimeEnabled()
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
67 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
68 TIME,
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
69 /**
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
70 * @see DebugConfig#interceptException(Throwable)
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
71 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
72 INTERCEPT
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
73 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
74
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
75 private final Map<Feature, Boolean> featureState = new EnumMap<>(Feature.class);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
76
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
77 /**
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
78 * The debug levels of a {@link DelegatingDebugConfig} than can be
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
79 * {@linkplain DelegatingDebugConfig#override(Level, int) overridden} or
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
80 * {@linkplain DelegatingDebugConfig#delegate(Level) delegated}.
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
81 */
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
82 public enum Level {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
83 LOG,
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
84 DUMP
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
85 }
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
86
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
87 private final Map<Level, Integer> levelState = new EnumMap<>(Level.class);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
88
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
89 /**
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
90 * Creates a config that delegates to the {@link DebugScope#getConfig() current config}.
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
91 */
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
92 public DelegatingDebugConfig() {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
93 this(DebugScope.getConfig());
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
94 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
95
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
96 /**
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
97 * Creates a config that delegates to a given config.
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
98 */
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
99 public DelegatingDebugConfig(DebugConfig delegate) {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
100 this.delegate = delegate;
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
101 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
102
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
103 public DelegatingDebugConfig enable(Feature feature) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
104 featureState.put(feature, Boolean.TRUE);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
105 return this;
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
106 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
107
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
108 public DelegatingDebugConfig disable(Feature feature) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
109 featureState.put(feature, Boolean.FALSE);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
110 return this;
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
111 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
112
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
113 public DelegatingDebugConfig override(Level level, int newLevel) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
114 levelState.put(level, newLevel);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
115 return this;
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
116 }
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
117
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
118 public DelegatingDebugConfig delegate(Feature feature) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
119 featureState.put(feature, null);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
120 return this;
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
121 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
122
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
123 public DelegatingDebugConfig delegate(Level level) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
124 levelState.put(level, null);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
125 return this;
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
126 }
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
127
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
128 @Override
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
129 public int getLogLevel() {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
130 Integer ls = levelState.get(Level.LOG);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
131 if (ls == null) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
132 return delegate.getLogLevel();
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
133 }
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
134 return ls.intValue();
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
135 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
136
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: 13158
diff changeset
137 public boolean isLogEnabledForMethod() {
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
138 Boolean fs = featureState.get(Feature.LOG_METHOD);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
139 if (fs == null) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
140 return delegate.isLogEnabledForMethod();
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
141 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
142 return fs.booleanValue();
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: 13158
diff changeset
143 }
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: 13158
diff changeset
144
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
145 @Override
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
146 public boolean isMeterEnabled() {
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
147 Boolean fs = featureState.get(Feature.METER);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
148 if (fs == null) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
149 return delegate.isMeterEnabled();
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
150 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
151 return fs.booleanValue();
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
152 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
153
15581
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
154 public boolean isMemUseTrackingEnabled() {
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
155 Boolean fs = featureState.get(Feature.TRACK_MEM_USE);
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
156 if (fs == null) {
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
157 return delegate.isMemUseTrackingEnabled();
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
158 }
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
159 return fs.booleanValue();
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
160 }
0dc0926cf0d8 added -G:TrackMemUse for measuring memory usage within scopes
Doug Simon <doug.simon@oracle.com>
parents: 15115
diff changeset
161
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
162 @Override
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
163 public int getDumpLevel() {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
164 Integer ls = levelState.get(Level.DUMP);
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
165 if (ls == null) {
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
166 return delegate.getDumpLevel();
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
167 }
16463
f1d839174e71 Support for specifying log and dump levels.
Roland Schatz <roland.schatz@oracle.com>
parents: 16144
diff changeset
168 return ls.intValue();
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
169 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
170
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: 13158
diff changeset
171 public boolean isDumpEnabledForMethod() {
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
172 Boolean fs = featureState.get(Feature.DUMP_METHOD);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
173 if (fs == null) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
174 return delegate.isDumpEnabledForMethod();
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
175 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
176 return fs.booleanValue();
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: 13158
diff changeset
177 }
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: 13158
diff changeset
178
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
179 @Override
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
180 public boolean isVerifyEnabled() {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
181 Boolean fs = featureState.get(Feature.VERIFY);
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
182 if (fs == null) {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
183 return delegate.isVerifyEnabled();
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
184 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
185 return fs.booleanValue();
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
186 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
187
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
188 public boolean isVerifyEnabledForMethod() {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
189 Boolean fs = featureState.get(Feature.VERIFY_METHOD);
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
190 if (fs == null) {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
191 return delegate.isVerifyEnabledForMethod();
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
192 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
193 return fs.booleanValue();
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
194 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
195
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
196 @Override
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
197 public boolean isTimeEnabled() {
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
198 Boolean fs = featureState.get(Feature.TIME);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
199 if (fs == null) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
200 return delegate.isTimeEnabled();
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
201 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
202 return fs.booleanValue();
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
203 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
204
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
205 @Override
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
206 public RuntimeException interceptException(Throwable e) {
15115
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
207 Boolean fs = featureState.get(Feature.INTERCEPT);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
208 if (fs == null || fs) {
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
209 return delegate.interceptException(e);
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
210 }
de406a971984 enhanced API for scoped overriding of the current DebugConfig
Doug Simon <doug.simon@oracle.com>
parents: 13323
diff changeset
211 return null;
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
212 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
213
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
214 @Override
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
215 public Collection<DebugDumpHandler> dumpHandlers() {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
216 return delegate.dumpHandlers();
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
217 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
218
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
219 @Override
16144
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
220 public Collection<DebugVerifyHandler> verifyHandlers() {
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
221 return delegate.verifyHandlers();
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
222 }
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
223
af9f3a5f091b extended Debug API with DebugVerifyHandlers
Doug Simon <doug.simon@oracle.com>
parents: 15581
diff changeset
224 @Override
13158
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
225 public PrintStream output() {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
226 return delegate.output();
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
227 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
228
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
229 @Override
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
230 public void addToContext(Object o) {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
231 delegate.addToContext(o);
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
232 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
233
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
234 @Override
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
235 public void removeFromContext(Object o) {
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
236 delegate.removeFromContext(o);
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
237 }
53b1edcf628f added support for scoping a change to the current DebugConfig using try-with-resource
Doug Simon <doug.simon@oracle.com>
parents:
diff changeset
238 }