diff options
Diffstat (limited to 'src/compiler/builtins.zc')
| -rw-r--r-- | src/compiler/builtins.zc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/compiler/builtins.zc b/src/compiler/builtins.zc index 44ed3b1..fb2dcb2 100644 --- a/src/compiler/builtins.zc +++ b/src/compiler/builtins.zc @@ -856,6 +856,19 @@ int tdroppable(word t) { } // local i holds a value with a drop: one set on it, or one its type declares int ldroppable(int i) { return (local_dropset && local_dropset[i]) || tdroppable(ltype[i]); } +// x.spawn() on a mailbox struct snapshots the whole vm into a worker process, so an +// owned value with a drop that is live there is dropped once in each process (6.15.4) +int spawn_hint() { + int i = lbase; + if (!fchk || !local_dropset) return 0; + while (i < nloc) { + if (!empty(lstate[i]) && !isalias(i) && lstate[i] != S_BORROW && ldroppable(i) && hint_begin(tpack(), HINT_SMALL)) { + rt.put_s(lname[i]); rt.put_s(": has drop and is live at spawn; the worker's copy drops it too"); dg_close(); + } + i++; + } + return 0; +} // entering o3 from normal code: the collector waits until the outermost region is left int o3_enter_code() { callname(intern("rt.o3_enter")); op(O_DROP); return 0; } // a fresh value with a drop that nothing holds: it is held in a hidden slot and |
