# HG changeset patch # User Doug Simon # Date 1333020082 -7200 # Node ID 6bf22ac8141e8620d604f7dbd3fcfa86ee1ab48c # Parent 8c9f7d19fbc19415159d8fbbda9b1a4841788fac made MethodFilter patterns a little more flexible with respect to parameters diff -r 8c9f7d19fbc1 -r 6bf22ac8141e 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 Thu Mar 29 13:20:43 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotDebugConfig.java Thu Mar 29 13:21:22 2012 +0200 @@ -25,13 +25,12 @@ import java.util.*; import java.util.regex.*; -import com.oracle.max.cri.ci.*; -import com.oracle.max.cri.ri.*; import com.oracle.graal.compiler.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.printer.*; - +import com.oracle.max.cri.ci.*; +import com.oracle.max.cri.ri.*; public class HotSpotDebugConfig implements DebugConfig { @@ -54,7 +53,7 @@ this.methodFilter = new MethodFilter[filters.length]; for (int i = 0; i < filters.length; i++) { this.methodFilter[i] = new MethodFilter(filters[i]); - // TTY.println(this.methodFilter[i].toString()); + // com.oracle.max.criutils.TTY.println(this.methodFilter[i].toString()); } } if (GraalOptions.PrintIdealGraphFile) { diff -r 8c9f7d19fbc1 -r 6bf22ac8141e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/MethodFilter.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/MethodFilter.java Thu Mar 29 13:20:43 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/MethodFilter.java Thu Mar 29 13:21:22 2012 +0200 @@ -22,6 +22,7 @@ */ package com.oracle.graal.hotspot; +import java.util.*; import java.util.regex.*; import com.oracle.max.cri.ci.*; @@ -44,6 +45,9 @@ *
  • visit(Argument;BlockScope)
    * Matches all methods named "visit", with the first parameter of type "Argument", and the second parameter of type "BlockScope". * The packages of the parameter types are irrelevant.
  • + *
  • arraycopy(Object;;;;)
    + * Matches all methods named "arraycopy", with the first parameter of type "Object", and four more parameters of any type. + * The packages of the parameter types are irrelevant.
  • *
  • com.oracle.graal.compiler.graph.PostOrderNodeIterator.*
    * Matches all methods in the class "com.oracle.graal.compiler.graph.PostOrderNodeIterator".
  • *
  • *
    @@ -51,7 +55,6 @@ *
  • com.oracle.graal.compiler.graph.*.visit
    * Matches all methods named "visit" in classes in the package "com.oracle.graal.compiler.graph". * - * */ public class MethodFilter { @@ -68,7 +71,7 @@ if (pattern.charAt(pattern.length() - 1) != ')') { throw new IllegalArgumentException("missing ')' at end of method filter pattern: " + pattern); } - String[] signatureClasses = pattern.substring(pos + 1, pattern.length() - 1).split(";"); + String[] signatureClasses = pattern.substring(pos + 1, pattern.length() - 1).split(";", -1); signature = new Pattern[signatureClasses.length]; for (int i = 0; i < signatureClasses.length; i++) { signature[i] = createClassGlobPattern(signatureClasses[i].trim()); @@ -95,10 +98,12 @@ } private static Pattern createClassGlobPattern(String pattern) { - if (pattern.contains(".")) { + if (pattern.length() == 0) { + return null; + } else if (pattern.contains(".")) { return Pattern.compile(createGlobString(pattern)); } else { - return Pattern.compile("([^\\.]\\.)*" + createGlobString(pattern)); + return Pattern.compile("([^\\.]*\\.)*" + createGlobString(pattern)); } } @@ -117,7 +122,8 @@ } for (int i = 0; i < signature.length; i++) { RiType type = sig.argumentTypeAt(i, null); - if (!signature[i].matcher(CiUtil.toJavaName(type)).matches()) { + String javaName = CiUtil.toJavaName(type); + if (signature[i] != null && !signature[i].matcher(javaName).matches()) { return false; } } @@ -138,7 +144,7 @@ sep = ", "; } if (signature != null) { - buf.append(sep).append("signature=").append(signature); + buf.append(sep).append("signature=").append(Arrays.toString(signature)); sep = ", "; } return buf.append("]").toString();