diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2011-09-26 15:06:26 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2011-09-26 16:59:15 -0700 |
| commit | ad19ab4c6fdf3ea74ac0ff3688d040a852f30760 (patch) | |
| tree | a4f501f24bc3867388b3d6aac3af5120d39c0205 /src/rt/rust_task.cpp | |
| parent | 47e5ab093a89fbe240e67be6a59c901f32d5ce4f (diff) | |
| download | rust-ad19ab4c6fdf3ea74ac0ff3688d040a852f30760.tar.gz rust-ad19ab4c6fdf3ea74ac0ff3688d040a852f30760.zip | |
rt: Make the logic that moves environments between tasks update the GC alloc chain correctly
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
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++ |
