changeset 10687:d2055a110396

Introduce CompilerDirectives.SlowPath annotation.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 10 Jul 2013 05:26:50 +0200
parents ae4c79ee71d1
children 87d2df0a7624
files graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java	Tue Jul 09 22:05:40 2013 +0200
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java	Wed Jul 10 05:26:50 2013 +0200
@@ -45,6 +45,7 @@
 import com.oracle.graal.phases.tiers.*;
 import com.oracle.graal.truffle.phases.*;
 import com.oracle.graal.virtual.phases.ea.*;
+import com.oracle.truffle.api.*;
 import com.oracle.truffle.api.nodes.*;
 
 /**
@@ -244,8 +245,10 @@
     private FixedNode expandInvoke(Invoke invoke) {
         if (invoke.callTarget() instanceof MethodCallTargetNode) {
             final MethodCallTargetNode methodCallTargetNode = (MethodCallTargetNode) invoke.callTarget();
+
             if ((methodCallTargetNode.invokeKind() == InvokeKind.Special || methodCallTargetNode.invokeKind() == InvokeKind.Static) &&
-                            !Modifier.isNative(methodCallTargetNode.targetMethod().getModifiers()) && methodCallTargetNode.targetMethod().getAnnotation(ExplodeLoop.class) == null) {
+                            !Modifier.isNative(methodCallTargetNode.targetMethod().getModifiers()) && methodCallTargetNode.targetMethod().getAnnotation(ExplodeLoop.class) == null &&
+                            methodCallTargetNode.targetMethod().getAnnotation(CompilerDirectives.SlowPath.class) == null) {
                 Class<? extends FixedWithNextNode> macroSubstitution = replacements.getMacroSubstitution(methodCallTargetNode.targetMethod());
                 if (macroSubstitution != null) {
                     return InliningUtil.inlineMacroNode(invoke, methodCallTargetNode.targetMethod(), methodCallTargetNode.graph(), macroSubstitution);
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java	Tue Jul 09 22:05:40 2013 +0200
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java	Wed Jul 10 05:26:50 2013 +0200
@@ -139,4 +139,12 @@
     public static <T> T unsafeCast(Object value, Class<T> clazz) {
         return (T) value;
     }
+
+    /**
+     * Marks methods that are considered slowpath and should therefore not be inlined by default.
+     */
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.METHOD})
+    public @interface SlowPath {
+    }
 }