diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_UserRng.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_UserRng.java index cc3ca7cc2c4f54fc6497934bf2e7be939f5bf9ef..a27358019d54d000b4b20b1d2065f3395993f466 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_UserRng.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_UserRng.java @@ -47,7 +47,7 @@ public class TruffleNFI_UserRng implements UserRngRFFI { protected void init(NativeFunction userFunction, NativeFunction readFunction) { if (userFunctionNode == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - userFunctionNode = Message.createExecute(userFunction.getArgumentCount()).createNode(); + userFunctionNode = insert(Message.createExecute(userFunction.getArgumentCount()).createNode()); } if (userFunctionTarget == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); @@ -56,7 +56,7 @@ public class TruffleNFI_UserRng implements UserRngRFFI { if (readFunction != null) { if (readPointerNode == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - readPointerNode = Message.createExecute(readFunction.getArgumentCount()).createNode(); + readPointerNode = insert(Message.createExecute(readFunction.getArgumentCount()).createNode()); } if (readPointerTarget == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java index 04f87e7c55224b244be31c3ca6df991d1851884a..77393b369266af9293d61d1fa333d2ce70ec1b1e 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java @@ -183,7 +183,7 @@ public final class AttributesAccessNodes { public Void doRAttributeStorage(RAttributeStorage x, RAttributeStorage y) { if (copyRegAttributes == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - copyRegAttributes = CopyOfRegAttributesNode.create(); + copyRegAttributes = insert(CopyOfRegAttributesNode.create()); } copyRegAttributes.execute(x, y); return null; diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MathFunctionsNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MathFunctionsNodes.java index 1be7424d83069a6e12b27fbebbee1b545909d93d..7107e5943ab683ca8b61d8fe6fff76d495c0a21b 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MathFunctionsNodes.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MathFunctionsNodes.java @@ -84,8 +84,11 @@ public final class MathFunctionsNodes { cumPtr = 0L; if (cumRead == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - cumRead = Message.READ.createNode(); - cumWrite = Message.WRITE.createNode(); + cumRead = insert(Message.READ.createNode()); + } + if (cumWrite == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + cumWrite = insert(Message.WRITE.createNode()); } try { cumArr[0] = ((Number) ForeignAccess.sendRead(cumRead, cumTO, 0)).doubleValue(); @@ -109,7 +112,7 @@ public final class MathFunctionsNodes { ccumPtr = 0L; if (ccumWrite == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - ccumWrite = Message.WRITE.createNode(); + ccumWrite = insert(Message.WRITE.createNode()); } } @@ -251,8 +254,11 @@ public final class MathFunctionsNodes { sgnPtr = 0L; if (sgnRead == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - sgnRead = Message.READ.createNode(); - sgnWrite = Message.WRITE.createNode(); + sgnRead = insert(Message.READ.createNode()); + } + if (sgnWrite == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + sgnWrite = insert(Message.WRITE.createNode()); } try { sgnArr[0] = ((Number) ForeignAccess.sendRead(sgnRead, sgnTO, 0)).intValue(); @@ -318,8 +324,11 @@ public final class MathFunctionsNodes { ansPtr = 0L; if (ansRead == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - ansRead = Message.READ.createNode(); - ansWrite = Message.WRITE.createNode(); + ansRead = insert(Message.READ.createNode()); + } + if (ansWrite == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + ansWrite = insert(Message.WRITE.createNode()); } try { ansIn = ((Number) ForeignAccess.sendRead(ansRead, ansTO, 0)).doubleValue(); @@ -345,9 +354,13 @@ public final class MathFunctionsNodes { nzPtr = 0L; if (nzRead == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - nzRead = Message.READ.createNode(); - nzWrite = Message.WRITE.createNode(); + nzRead = insert(Message.READ.createNode()); } + if (nzWrite == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + nzWrite = insert(Message.WRITE.createNode()); + } + try { nzIn = ((Number) ForeignAccess.sendRead(nzRead, nzTO, 0)).intValue(); } catch (UnsupportedMessageException | UnknownIdentifierException e) { @@ -372,8 +385,12 @@ public final class MathFunctionsNodes { ierrPtr = 0L; if (ierrRead == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - ierrRead = Message.READ.createNode(); - ierrWrite = Message.WRITE.createNode(); + ierrRead = insert(Message.READ.createNode()); + + } + if (ierrWrite == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + ierrWrite = insert(Message.WRITE.createNode()); } try { ierrIn = ((Number) ForeignAccess.sendRead(ierrRead, ierrTO, 0)).intValue(); @@ -702,7 +719,7 @@ public final class MathFunctionsNodes { } else { if (bForeignArray2R == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - bForeignArray2R = ForeignArray2R.create(); + bForeignArray2R = insert(ForeignArray2R.create()); } bVec = (RAbstractDoubleVector) bForeignArray2R.convert(bTO); } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RandFunctionsNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RandFunctionsNodes.java index d9e1e34e523e4f1a578b62d05a146921562b0842..8f6a945284a0e33812300a376a242b179a8d42cb 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RandFunctionsNodes.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RandFunctionsNodes.java @@ -239,7 +239,7 @@ public final class RandFunctionsNodes { } else { if (probForeignArray2R == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - probForeignArray2R = ForeignArray2R.create(); + probForeignArray2R = insert(ForeignArray2R.create()); } probVector = (RAbstractDoubleVector) probForeignArray2R.convert(probTO); } @@ -261,9 +261,9 @@ public final class RandFunctionsNodes { } else { if (rNForeignArray2R == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - rNForeignArray2R = ForeignArray2R.create(); + rNForeignArray2R = insert(ForeignArray2R.create()); } - rNVector = (RAbstractIntVector) probForeignArray2R.convert(probTO); + rNVector = (RAbstractIntVector) rNForeignArray2R.convert(probTO); } doRMultinomNode.execute(n, probVector, k, rNVector); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RForeignStringWrapper.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RForeignStringWrapper.java index a82a26992a7624e396fdf257f2da280306e71071..2f57d6bae1562df11b85b91c4d8dddd2c49b9778 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RForeignStringWrapper.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RForeignStringWrapper.java @@ -105,7 +105,7 @@ public final class RForeignStringWrapper extends RForeignWrapper implements RAbs if (isNullProfile.profile(value instanceof TruffleObject)) { if (isNull == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - isNull = Message.IS_NULL.createNode(); + isNull = insert(Message.IS_NULL.createNode()); } if (ForeignAccess.sendIsNull(isNull, (TruffleObject) value)) { return RRuntime.STRING_NA;