Skip to content

Commit

Permalink
[truffle] Do IO behinde a partial evaluation boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Jun 26, 2018
1 parent b9774f7 commit 48bb9eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
@@ -1,6 +1,7 @@
package org.perl6.nqp.truffle.nodes.io;

import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.NodeChildren;
import com.oracle.truffle.api.dsl.NodeChild;
import org.perl6.nqp.truffle.nodes.NQPNode;
Expand All @@ -16,7 +17,12 @@ public NQPPrintNode(NQPNode arg) {
@Override
public Object execute(VirtualFrame frame) {
String value = this.arg.executeString(frame);
System.out.print(value);
doPrint(value);
return value;
}

@TruffleBoundary
private void doPrint(String value) {
System.out.print(value);
}
}
Expand Up @@ -2,6 +2,7 @@

import org.perl6.nqp.truffle.nodes.NQPNode;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.NodeChildren;
import com.oracle.truffle.api.dsl.NodeChild;

Expand All @@ -16,7 +17,12 @@ public NQPSayNode(NQPNode arg) {
@Override
public Object execute(VirtualFrame frame) {
String value = this.arg.executeString(frame);
System.out.println(value);
doSay(value);
return value;
}

@TruffleBoundary
private void doSay(String value) {
System.out.println(value);
}
}

0 comments on commit 48bb9eb

Please sign in to comment.