about summary refs log tree commit diff stats
path: root/mu.arc.t
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-11-19 00:27:10 -0800
committerKartik K. Agaram <vc@akkartik.com>2014-11-19 00:32:49 -0800
commitc2c0d3a1e86c0067849d2c53421794cc2519b272 (patch)
tree1e19c1bcc944f7eba438392dbb4b3fe648d738e8 /mu.arc.t
parente0bf118825765fc2a81e7a5c9b65304c3cc02b02 (diff)
downloadmu-c2c0d3a1e86c0067849d2c53421794cc2519b272.tar.gz
276 - now fork can take any args
No oargs, though. Hopefully we don't need them. Use channels for
passing data back.

Drawback: channels must all be passed in by value, and their direction
isn't obvious. Hard to tell when multiple threads read/write the same
channel. Hopefully it's amenable to static analysis.
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t14
1 files changed, 14 insertions, 0 deletions
diff --git a/mu.arc.t b/mu.arc.t
index 7487f57b..8f981315 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -1812,6 +1812,20 @@
 (if (~iso memory*.2 4)
   (prn "F - fork can pass args"))
 
+(reset)
+(new-trace "fork-copies-args")
+(add-fns
+  '((f1
+      ((default-scope scope-address) <- new (scope literal) (5 literal))
+      ((x integer) <- copy (4 literal))
+      (fork (f2 fn) (x integer))
+      ((x integer) <- copy (0 literal)))  ; should be ignored
+    (f2
+      ((2 integer) <- arg))))
+(run 'f1)
+(if (~iso memory*.2 4)
+  (prn "F - fork passes args by value"))
+
 ; The scheduler needs to keep track of the call stack for each routine.
 ; Eventually we'll want to save this information in mu's address space itself,
 ; along with the types array, the magic buffers for args and oargs, and so on.