Mercurial > hg > truffle
diff graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LowLevelPhaseSuite.java @ 19226:9c47b23fb0a2
LowLevelPhase: add support for custom name.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Mon, 09 Feb 2015 15:10:13 +0100 |
parents | 1487207db440 |
children | 6340d851894b |
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LowLevelPhaseSuite.java Mon Feb 09 14:19:03 2015 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LowLevelPhaseSuite.java Mon Feb 09 15:10:13 2015 +0100 @@ -31,10 +31,21 @@ public class LowLevelPhaseSuite<C, B extends AbstractBlock<B>> extends LowLevelPhase<C, B> { private final List<LowLevelPhase<C, B>> phases; - public LowLevelPhaseSuite() { + public LowLevelPhaseSuite(Class<C> contextClass) { + super(getNameFromContext(contextClass)); phases = new ArrayList<>(); } + private static <C> String getNameFromContext(Class<C> contextClass) { + String className = contextClass.getName(); + String s0 = className.substring(className.lastIndexOf(".") + 1); // strip the package name + String s = s0.substring(s0.lastIndexOf("$") + 1); // strip the enclosing class name + if (s.endsWith("Context")) { + s = s.substring(0, s.length() - "Context".length()); + } + return s; + } + /** * Add a new phase at the beginning of this suite. */