diff options
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/rust.cpp | 2 | ||||
| -rw-r--r-- | src/rt/rust_task.cpp | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/rt/rust.cpp b/src/rt/rust.cpp index 91476bed..235eb8d0 100644 --- a/src/rt/rust.cpp +++ b/src/rt/rust.cpp @@ -236,7 +236,7 @@ rust_start(uintptr_t main_fn, rust_crate const *crate, int argc, char **argv) rust_crate_reader rdr(&dom, crate); } - uintptr_t main_args[3] = { 0, 0, (uintptr_t)args.args }; + uintptr_t main_args[4] = { 0, 0, 0, (uintptr_t)args.args }; dom.root_task->start(crate->get_exit_task_glue(), main_fn, diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 084c8acd..7c92c4ca 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -130,6 +130,7 @@ rust_task::start(uintptr_t exit_task_glue, uintptr_t *spp = (uintptr_t *)rust_sp; // The exit_task_glue frame we synthesize above the frame we activate: + *spp-- = (uintptr_t) 0; // closure-or-obj *spp-- = (uintptr_t) this; // task *spp-- = (uintptr_t) 0; // output *spp-- = (uintptr_t) 0; // retpc @@ -153,6 +154,7 @@ rust_task::start(uintptr_t exit_task_glue, uintptr_t *src = (uintptr_t *)args; src += 1; // spawn-call output slot src += 1; // spawn-call task slot + src += 1; // spawn-call closure-or-obj slot // Memcpy all but the task and output pointers callsz -= (2 * sizeof(uintptr_t)); spp = (uintptr_t*) (((uintptr_t)spp) - callsz); @@ -168,6 +170,7 @@ rust_task::start(uintptr_t exit_task_glue, // The *implicit* incoming args to the spawnee frame we're // activating: + *spp-- = (uintptr_t) 0; // closure-or-obj *spp-- = (uintptr_t) this; // task *spp-- = (uintptr_t) 0; // output addr *spp-- = (uintptr_t) exit_task_glue; // retpc @@ -423,6 +426,8 @@ rust_task::link_gc(gc_alloc *gcm) { gcm->prev = NULL; gcm->next = gc_alloc_chain; gc_alloc_chain = gcm; + if (gcm->next) + gcm->next->prev = gcm; } void @@ -431,6 +436,8 @@ rust_task::unlink_gc(gc_alloc *gcm) { gcm->prev->next = gcm->next; if (gcm->next) gcm->next->prev = gcm->prev; + if (gc_alloc_chain == gcm) + gc_alloc_chain = gcm->next; gcm->prev = NULL; gcm->next = NULL; } |