From c2c0d3a1e86c0067849d2c53421794cc2519b272 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Wed, 19 Nov 2014 00:27:10 -0800 Subject: 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. --- mu.arc.t | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'mu.arc.t') 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. -- cgit 1.4.1-2-gfad0