Mercurial > hg > graal-compiler
changeset 18903:11ec0a5c5518
Add option to restrict MethodFilter to the root method
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Wed, 21 Jan 2015 11:00:48 -0800 |
parents | b7cb27a82d51 |
children | 6ba170cb6f53 |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java |
diffstat | 1 files changed, 18 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java Wed Jan 21 10:20:41 2015 -0800 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java Wed Jan 21 11:00:48 2015 -0800 @@ -52,6 +52,9 @@ public static final OptionValue<String> Log = new OptionValue<>(null); @Option(help = "Pattern for filtering debug scope output based on method context (see MethodFilter)", type = OptionType.Debug) public static final OptionValue<String> MethodFilter = new OptionValue<>(null); + @Option(help = "Only check MethodFilter against the root method in the context if true, otherwise check all methods", type = OptionType.Debug) + public static final OptionValue<Boolean> MethodFilterRootOnly = new OptionValue<>(false); + @Option(help = "How to print metric and timing values:%n" + "Name - aggregate by unqualified name%n" + "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" + @@ -205,18 +208,31 @@ if (methodFilter == null && extraFilters.isEmpty()) { return true; } else { + JavaMethod lastMethod = null; for (Object o : Debug.context()) { if (extraFilters.contains(o)) { return true; } else if (methodFilter != null) { JavaMethod method = asJavaMethod(o); if (method != null) { - if (com.oracle.graal.compiler.MethodFilter.matches(methodFilter, method)) { - return true; + if (!MethodFilterRootOnly.getValue()) { + if (com.oracle.graal.compiler.MethodFilter.matches(methodFilter, method)) { + return true; + } + } else { + /* + * The context values operate as a stack so if we want MethodFilter to + * only apply to the root method we have to check only the last method + * seen. + */ + lastMethod = method; } } } } + if (lastMethod != null && com.oracle.graal.compiler.MethodFilter.matches(methodFilter, lastMethod)) { + return true; + } return false; } }