Skip to content

Commit d24d4b4

Browse files
steve-sansalond
authored andcommitted
Add missing insert calls when creating child nodes
(cherry picked from commit 6b1400d)
1 parent caee8a7 commit d24d4b4

File tree

5 files changed

+36
-19
lines changed

5 files changed

+36
-19
lines changed

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nfi/TruffleNFI_UserRng.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private abstract static class RNGNode extends Node {
4747
protected void init(NativeFunction userFunction, NativeFunction readFunction) {
4848
if (userFunctionNode == null) {
4949
CompilerDirectives.transferToInterpreterAndInvalidate();
50-
userFunctionNode = Message.createExecute(userFunction.getArgumentCount()).createNode();
50+
userFunctionNode = insert(Message.createExecute(userFunction.getArgumentCount()).createNode());
5151
}
5252
if (userFunctionTarget == null) {
5353
CompilerDirectives.transferToInterpreterAndInvalidate();
@@ -56,7 +56,7 @@ protected void init(NativeFunction userFunction, NativeFunction readFunction) {
5656
if (readFunction != null) {
5757
if (readPointerNode == null) {
5858
CompilerDirectives.transferToInterpreterAndInvalidate();
59-
readPointerNode = Message.createExecute(readFunction.getArgumentCount()).createNode();
59+
readPointerNode = insert(Message.createExecute(readFunction.getArgumentCount()).createNode());
6060
}
6161
if (readPointerTarget == null) {
6262
CompilerDirectives.transferToInterpreterAndInvalidate();

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public abstract static class CopyMostAttrib extends FFIUpCallNode.Arg2 {
183183
public Void doRAttributeStorage(RAttributeStorage x, RAttributeStorage y) {
184184
if (copyRegAttributes == null) {
185185
CompilerDirectives.transferToInterpreterAndInvalidate();
186-
copyRegAttributes = CopyOfRegAttributesNode.create();
186+
copyRegAttributes = insert(CopyOfRegAttributesNode.create());
187187
}
188188
copyRegAttributes.execute(x, y);
189189
return null;

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MathFunctionsNodes.java

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,11 @@ protected Object evaluate(double x, Object cum, Object ccum, int lowerTail, int
8484
cumPtr = 0L;
8585
if (cumRead == null) {
8686
CompilerDirectives.transferToInterpreterAndInvalidate();
87-
cumRead = Message.READ.createNode();
88-
cumWrite = Message.WRITE.createNode();
87+
cumRead = insert(Message.READ.createNode());
88+
}
89+
if (cumWrite == null) {
90+
CompilerDirectives.transferToInterpreterAndInvalidate();
91+
cumWrite = insert(Message.WRITE.createNode());
8992
}
9093
try {
9194
cumArr[0] = ((Number) ForeignAccess.sendRead(cumRead, cumTO, 0)).doubleValue();
@@ -109,7 +112,7 @@ protected Object evaluate(double x, Object cum, Object ccum, int lowerTail, int
109112
ccumPtr = 0L;
110113
if (ccumWrite == null) {
111114
CompilerDirectives.transferToInterpreterAndInvalidate();
112-
ccumWrite = Message.WRITE.createNode();
115+
ccumWrite = insert(Message.WRITE.createNode());
113116
}
114117
}
115118

@@ -251,8 +254,11 @@ protected Object evaluate(double a, Object sgn) {
251254
sgnPtr = 0L;
252255
if (sgnRead == null) {
253256
CompilerDirectives.transferToInterpreterAndInvalidate();
254-
sgnRead = Message.READ.createNode();
255-
sgnWrite = Message.WRITE.createNode();
257+
sgnRead = insert(Message.READ.createNode());
258+
}
259+
if (sgnWrite == null) {
260+
CompilerDirectives.transferToInterpreterAndInvalidate();
261+
sgnWrite = insert(Message.WRITE.createNode());
256262
}
257263
try {
258264
sgnArr[0] = ((Number) ForeignAccess.sendRead(sgnRead, sgnTO, 0)).intValue();
@@ -318,8 +324,11 @@ protected Object evaluate(double x, int n, int kode, @SuppressWarnings("unused")
318324
ansPtr = 0L;
319325
if (ansRead == null) {
320326
CompilerDirectives.transferToInterpreterAndInvalidate();
321-
ansRead = Message.READ.createNode();
322-
ansWrite = Message.WRITE.createNode();
327+
ansRead = insert(Message.READ.createNode());
328+
}
329+
if (ansWrite == null) {
330+
CompilerDirectives.transferToInterpreterAndInvalidate();
331+
ansWrite = insert(Message.WRITE.createNode());
323332
}
324333
try {
325334
ansIn = ((Number) ForeignAccess.sendRead(ansRead, ansTO, 0)).doubleValue();
@@ -345,9 +354,13 @@ protected Object evaluate(double x, int n, int kode, @SuppressWarnings("unused")
345354
nzPtr = 0L;
346355
if (nzRead == null) {
347356
CompilerDirectives.transferToInterpreterAndInvalidate();
348-
nzRead = Message.READ.createNode();
349-
nzWrite = Message.WRITE.createNode();
357+
nzRead = insert(Message.READ.createNode());
350358
}
359+
if (nzWrite == null) {
360+
CompilerDirectives.transferToInterpreterAndInvalidate();
361+
nzWrite = insert(Message.WRITE.createNode());
362+
}
363+
351364
try {
352365
nzIn = ((Number) ForeignAccess.sendRead(nzRead, nzTO, 0)).intValue();
353366
} catch (UnsupportedMessageException | UnknownIdentifierException e) {
@@ -372,8 +385,12 @@ protected Object evaluate(double x, int n, int kode, @SuppressWarnings("unused")
372385
ierrPtr = 0L;
373386
if (ierrRead == null) {
374387
CompilerDirectives.transferToInterpreterAndInvalidate();
375-
ierrRead = Message.READ.createNode();
376-
ierrWrite = Message.WRITE.createNode();
388+
ierrRead = insert(Message.READ.createNode());
389+
390+
}
391+
if (ierrWrite == null) {
392+
CompilerDirectives.transferToInterpreterAndInvalidate();
393+
ierrWrite = insert(Message.WRITE.createNode());
377394
}
378395
try {
379396
ierrIn = ((Number) ForeignAccess.sendRead(ierrRead, ierrTO, 0)).intValue();
@@ -702,7 +719,7 @@ protected double besselEx(BesselExCaller caller, Object b,
702719
} else {
703720
if (bForeignArray2R == null) {
704721
CompilerDirectives.transferToInterpreterAndInvalidate();
705-
bForeignArray2R = ForeignArray2R.create();
722+
bForeignArray2R = insert(ForeignArray2R.create());
706723
}
707724
bVec = (RAbstractDoubleVector) bForeignArray2R.convert(bTO);
708725
}

com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RandFunctionsNodes.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ protected Object evaluate(int n, Object prob, int k, Object rN) {
239239
} else {
240240
if (probForeignArray2R == null) {
241241
CompilerDirectives.transferToInterpreterAndInvalidate();
242-
probForeignArray2R = ForeignArray2R.create();
242+
probForeignArray2R = insert(ForeignArray2R.create());
243243
}
244244
probVector = (RAbstractDoubleVector) probForeignArray2R.convert(probTO);
245245
}
@@ -261,9 +261,9 @@ protected Object evaluate(int n, Object prob, int k, Object rN) {
261261
} else {
262262
if (rNForeignArray2R == null) {
263263
CompilerDirectives.transferToInterpreterAndInvalidate();
264-
rNForeignArray2R = ForeignArray2R.create();
264+
rNForeignArray2R = insert(ForeignArray2R.create());
265265
}
266-
rNVector = (RAbstractIntVector) probForeignArray2R.convert(probTO);
266+
rNVector = (RAbstractIntVector) rNForeignArray2R.convert(probTO);
267267
}
268268

269269
doRMultinomNode.execute(n, probVector, k, rNVector);

com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RForeignStringWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected String getString(Object internalStore, int index) {
105105
if (isNullProfile.profile(value instanceof TruffleObject)) {
106106
if (isNull == null) {
107107
CompilerDirectives.transferToInterpreterAndInvalidate();
108-
isNull = Message.IS_NULL.createNode();
108+
isNull = insert(Message.IS_NULL.createNode());
109109
}
110110
if (ForeignAccess.sendIsNull(isNull, (TruffleObject) value)) {
111111
return RRuntime.STRING_NA;

0 commit comments

Comments
 (0)