From ad19ab4c6fdf3ea74ac0ff3688d040a852f30760 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 26 Sep 2011 15:06:26 -0700 Subject: rt: Make the logic that moves environments between tasks update the GC alloc chain correctly --- src/rt/rust_task.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/rt/rust_task.cpp') diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index ca85411e9d5..f2c866263cf 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -152,6 +152,8 @@ void task_start_wrapper(spawn_args *a) failed = true; } + cc::do_cc(task); + rust_closure_env* env = (rust_closure_env*)a->a3; if(env) { // free the environment. @@ -551,6 +553,35 @@ rust_chan *rust_task::get_chan_by_handle(chan_handle *handle) { return NULL; } +// Temporary routine to allow boxes on one task's shared heap to be reparented +// to another. +const type_desc * +rust_task::release_alloc(void *alloc) { + lock.lock(); + + assert(local_allocs.find(alloc) != local_allocs.end()); + const type_desc *tydesc = local_allocs[alloc]; + local_allocs.erase(alloc); + + local_region.release_alloc(alloc); + + lock.unlock(); + return tydesc; +} + +// Temporary routine to allow boxes from one task's shared heap to be +// reparented to this one. +void +rust_task::claim_alloc(void *alloc, const type_desc *tydesc) { + lock.lock(); + + assert(local_allocs.find(alloc) == local_allocs.end()); + local_allocs[alloc] = tydesc; + local_region.claim_alloc(alloc); + + lock.unlock(); +} + // // Local Variables: // mode: C++ -- cgit 1.4.1-3-g733a5