# HG changeset patch # User Gilles Duboscq # Date 1339768124 -7200 # Node ID 23a7a21e5f12afb81e5a2e501cd3507068ad334e # Parent b8272646eb479de61ed8a527754f434d247e2f4b# Parent 2a44192a8b24cc2a46d2c441f7eac0b75c2f24ab Merge diff -r b8272646eb47 -r 23a7a21e5f12 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Fri Jun 15 15:38:42 2012 +0200 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Fri Jun 15 15:48:44 2012 +0200 @@ -226,6 +226,14 @@ public PrintStream output() { return output; } + + @Override + public void addToContext(Object o) { + } + + @Override + public void removeFromContext(Object o) { + } }; } diff -r b8272646eb47 -r 23a7a21e5f12 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java Fri Jun 15 15:38:42 2012 +0200 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugConfig.java Fri Jun 15 15:48:44 2012 +0200 @@ -28,21 +28,39 @@ public interface DebugConfig { /** + * Determines if logging is enabled in the {@linkplain Debug#currentScope() current debug scope}. + * * @see Debug#log(String, Object...) */ boolean isLogEnabled(); /** + * Determines if metering is enabled in the {@linkplain Debug#currentScope() current debug scope}. + * * @see Debug#metric(String) */ boolean isMeterEnabled(); /** + * Determines if dumping is enabled in the {@linkplain Debug#currentScope() current debug scope}. + * * @see Debug#dump(Object, String, Object...) */ boolean isDumpEnabled(); /** + * Adds an object the context used by this configuration to do filtering. + */ + void addToContext(Object o); + + /** + * Removes an object the context used by this configuration to do filtering. + * + * This should only removes extra context added by {@link #addToContext(Object)}. + */ + void removeFromContext(Object o); + + /** * @see Debug#timer(String) */ boolean isTimeEnabled(); diff -r b8272646eb47 -r 23a7a21e5f12 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugConfig.java Fri Jun 15 15:38:42 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugConfig.java Fri Jun 15 15:48:44 2012 +0200 @@ -43,6 +43,7 @@ private final MethodFilter[] methodFilter; private final List dumpHandlers = new ArrayList<>(); private final PrintStream output; + private final Set extraFilters = new HashSet<>(); public HotSpotDebugConfig(String logFilter, String meterFilter, String timerFilter, String dumpFilter, String methodFilter, PrintStream output) { this.logFilter = DebugFilter.parse(logFilter); @@ -102,14 +103,18 @@ } private boolean checkMethodFilter() { - if (methodFilter == null) { + if (methodFilter == null && extraFilters.isEmpty()) { return true; } else { for (Object o : Debug.context()) { - if (o instanceof JavaMethod) { - for (MethodFilter filter : methodFilter) { - if (filter.matches((JavaMethod) o)) { - return true; + if (extraFilters.contains(o)) { + return true; + } else if (methodFilter != null) { + if (o instanceof JavaMethod) { + for (MethodFilter filter : methodFilter) { + if (filter.matches((JavaMethod) o)) { + return true; + } } } } @@ -176,4 +181,14 @@ public Collection dumpHandlers() { return dumpHandlers; } + + @Override + public void addToContext(Object o) { + extraFilters.add(o); + } + + @Override + public void removeFromContext(Object o) { + extraFilters.remove(o); + } }