rt: Make the logic that moves environments between tasks update the GC alloc chain correctly

This commit is contained in:
Patrick Walton
2011-09-26 15:06:26 -07:00
parent 47e5ab093a
commit ad19ab4c6f
4 changed files with 50 additions and 8 deletions

View File

@@ -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++