From 74e1b18bdaa1dfc0df8b9f62a75501173b948b74 Mon Sep 17 00:00:00 2001
From: Lukas Stadler <lukas.stadler@oracle.com>
Date: Fri, 4 Dec 2015 14:06:08 +0100
Subject: [PATCH] use negative reportLoopCount to signal operations that are
 used during startup only

---
 .../src/com/oracle/truffle/r/nodes/builtin/base/Assign.java  | 4 ++++
 .../r/nodes/builtin/base/HiddenInternalFunctions.java        | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Assign.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Assign.java
index 0a150b38dd..66a90cdd70 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Assign.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Assign.java
@@ -24,6 +24,7 @@ package com.oracle.truffle.r.nodes.builtin.base;
 
 import static com.oracle.truffle.r.runtime.RBuiltinKind.*;
 
+import com.oracle.truffle.api.CompilerDirectives;
 import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.api.dsl.*;
@@ -90,6 +91,9 @@ public abstract class Assign extends RInvisibleBuiltinNode {
                 env = REnvironment.globalEnv();
             }
         } else {
+            if (CompilerDirectives.inInterpreter()) {
+                getRootNode().reportLoopCount(-1);
+            }
             if (env == REnvironment.emptyEnv()) {
                 errorProfile.enter();
                 throw RError.error(this, RError.Message.CANNOT_ASSIGN_IN_EMPTY_ENV);
diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java
index 1568fa2620..921bf7ee5c 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/HiddenInternalFunctions.java
@@ -182,6 +182,9 @@ public class HiddenInternalFunctions {
 
         @TruffleBoundary
         public Object lazyLoadDBFetchInternal(MaterializedFrame frame, RIntVector key, RStringVector datafile, int compression, RFunction envhook) {
+            if (CompilerDirectives.inInterpreter()) {
+                getRootNode().reportLoopCount(-5);
+            }
             String dbPath = datafile.getDataAt(0);
             String packageName = new File(dbPath).getName();
             byte[] dbData = RContext.getInstance().stateLazyDBCache.getData(dbPath);
@@ -457,7 +460,7 @@ public class HiddenInternalFunctions {
 
     /*
      * Created as primitive function to avoid incrementing reference count for the argument.
-     *
+     * 
      * returns -1 for non-shareable, 0 for private, 1 for temp, 2 for shared and
      * SHARED_PERMANENT_VAL for permanent shared
      */
-- 
GitLab