Mercurial > hg > truffle
changeset 5623:23a7a21e5f12
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Fri, 15 Jun 2012 15:48:44 +0200 |
parents | b8272646eb47 (current diff) 2a44192a8b24 (diff) |
children | 63bd4fd90c27 6c3a5ccec483 |
files | |
diffstat | 3 files changed, 46 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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) { + } }; }
--- 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();
--- 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<DebugDumpHandler> dumpHandlers = new ArrayList<>(); private final PrintStream output; + private final Set<Object> 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<? extends DebugDumpHandler> dumpHandlers() { return dumpHandlers; } + + @Override + public void addToContext(Object o) { + extraFilters.add(o); + } + + @Override + public void removeFromContext(Object o) { + extraFilters.remove(o); + } }