From 73236a37c5dc87399f026f6b002446eacf11bd95 Mon Sep 17 00:00:00 2001
From: Lukas Stadler <lukas.stadler@oracle.com>
Date: Wed, 28 Jun 2017 14:47:36 +0200
Subject: [PATCH] choose should be behind TruffleBoundary

---
 .../src/com/oracle/truffle/r/runtime/nmath/Choose.java         | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/Choose.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/Choose.java
index 6dc04a9255..2f721295ac 100644
--- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/Choose.java
+++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/Choose.java
@@ -15,6 +15,7 @@ package com.oracle.truffle.r.runtime.nmath;
 import static com.oracle.truffle.r.runtime.nmath.GammaFunctions.lgammafn;
 import static com.oracle.truffle.r.runtime.nmath.GammaFunctions.lgammafnSign;
 
+import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
 import com.oracle.truffle.r.runtime.RError.Message;
 
 // transcribed from nmath/choose.c
@@ -26,6 +27,7 @@ public class Choose {
         return -Math.log(n + 1.) - LBeta.lbeta(n - k + 1., k + 1.);
     }
 
+    @TruffleBoundary
     public static double choose(double n, double ka) {
         double k = ka;
         if (Double.isNaN(n) || Double.isNaN(ka)) {
@@ -76,6 +78,7 @@ public class Choose {
         return Math.exp(lfastchoose(n, k));
     }
 
+    @TruffleBoundary
     public static double lchoose(double n, double kIn) {
         double k = RMath.forceint(kIn);
         /* NaNs propagated correctly */
-- 
GitLab