Mercurial > hg > truffle
changeset 17274:5c55441b4c62
fixed reported annotation parsing time in NodeClass
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 30 Sep 2014 21:35:36 +0200 |
parents | 43655130d0ab |
children | 846c059e3ecf |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchContext.java graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java |
diffstat | 2 files changed, 12 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchContext.java Tue Sep 30 19:00:46 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchContext.java Tue Sep 30 21:35:36 2014 +0200 @@ -126,8 +126,10 @@ */ public void setResult(ComplexMatchResult result) { ComplexMatchValue value = new ComplexMatchValue(result); - Debug.log("matched %s %s", rule.getName(), rule.getPattern()); - Debug.log("with nodes %s", rule.formatMatch(root)); + if (Debug.isLogEnabled()) { + Debug.log("matched %s %s", rule.getName(), rule.getPattern()); + Debug.log("with nodes %s", rule.formatMatch(root)); + } if (consumed != null) { for (ValueNode node : consumed) { // All the interior nodes should be skipped during the normal doRoot calls in
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Tue Sep 30 19:00:46 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Tue Sep 30 21:35:36 2014 +0200 @@ -65,7 +65,7 @@ private static final DebugTimer Init_AllowedUsages = Debug.timer("NodeClass.Init.AllowedUsages"); private static final DebugTimer Init_IterableIds = Debug.timer("NodeClass.Init.IterableIds"); - private static <T extends Annotation> T getAnnotation(AnnotatedElement e, Class<T> annotationClass) { + private static <T extends Annotation> T getAnnotationTimed(AnnotatedElement e, Class<T> annotationClass) { try (TimerCloseable s = Init_AnnotationParsing.start()) { return e.getAnnotation(annotationClass); } @@ -88,7 +88,7 @@ try (TimerCloseable t = Init.start()) { value = (NodeClass) allClasses.get(key); if (value == null) { - GeneratedNode gen = getAnnotation(c, GeneratedNode.class); + GeneratedNode gen = getAnnotationTimed(c, GeneratedNode.class); if (gen != null) { Class<? extends Node> originalNodeClass = (Class<? extends Node>) gen.value(); value = (NodeClass) allClasses.get(originalNodeClass); @@ -188,7 +188,7 @@ canGVN = Node.ValueNumberable.class.isAssignableFrom(clazz); startGVNNumber = clazz.hashCode(); - NodeInfo info = getAnnotation(clazz, NodeInfo.class); + NodeInfo info = getAnnotationTimed(clazz, NodeInfo.class); this.nameTemplate = info.nameTemplate(); try (TimerCloseable t1 = Init_AllowedUsages.start()) { @@ -270,12 +270,12 @@ * @param nodeClass a {@linkplain GeneratedNode non-generated} {@link Node} class */ public boolean is(Class<? extends Node> nodeClass) { - assert getAnnotation(nodeClass, GeneratedNode.class) == null : "cannot test NodeClas against generated " + nodeClass; + assert nodeClass.getAnnotation(GeneratedNode.class) == null : "cannot test NodeClas against generated " + nodeClass; return nodeClass == getClazz(); } public String shortName() { - NodeInfo info = getAnnotation(getClazz(), NodeInfo.class); + NodeInfo info = getClazz().getAnnotation(NodeInfo.class); String shortName; if (!info.shortName().isEmpty()) { shortName = info.shortName(); @@ -389,9 +389,9 @@ @Override protected void scanField(Field field, long offset) { - Input inputAnnotation = getAnnotation(field, Node.Input.class); - OptionalInput optionalInputAnnotation = getAnnotation(field, Node.OptionalInput.class); - Successor successorAnnotation = getAnnotation(field, Successor.class); + Input inputAnnotation = getAnnotationTimed(field, Node.Input.class); + OptionalInput optionalInputAnnotation = getAnnotationTimed(field, Node.OptionalInput.class); + Successor successorAnnotation = getAnnotationTimed(field, Successor.class); try (TimerCloseable s = Init_FieldScanningInner.start()) { Class<?> type = field.getType(); int modifiers = field.getModifiers();