diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2010-11-16 13:51:32 -0800 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2010-11-16 13:51:32 -0800 |
| commit | 26ecec4e123781c6e99e92cf42ce585e33a861ef (patch) | |
| tree | 3da15ea6afe073b2b29e657749f9d53534030e4a /src/rt/rust_task.cpp | |
| parent | 44b051f34af7512e8b13a1dfaac03967989a0ca4 (diff) | |
| download | rust-26ecec4e123781c6e99e92cf42ce585e33a861ef.tar.gz rust-26ecec4e123781c6e99e92cf42ce585e33a861ef.zip | |
Update frame logic to be compatible with SysV x86 ABI. Improves diagnostics.
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 530e5997f55..680043cc35b 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -149,18 +149,22 @@ rust_task::start(uintptr_t exit_task_glue, *spp-- = (uintptr_t) this; // task *spp-- = (uintptr_t) 0; // output *spp-- = (uintptr_t) 0; // retpc + + uintptr_t exit_task_frame_base; + for (size_t j = 0; j < n_callee_saves; ++j) { + + // We want 'frame_base' to point to the old fp in this (exit-task) + // frame, because we're going to inject this frame-pointer into the + // callee-save frame pointer value in the *next* (spawnee) frame. A + // cheap trick, but this means the spawnee frame will restore the + // proper frame pointer of the glue frame as it runs its epilogue. + if (j == callee_save_fp) + exit_task_frame_base = (uintptr_t)spp; + *spp-- = 0; } - // We want 'frame_base' to point to the last callee-save in this - // (exit-task) frame, because we're going to inject this - // frame-pointer into the callee-save frame pointer value in the - // *next* (spawnee) frame. A cheap trick, but this means the - // spawnee frame will restore the proper frame pointer of the glue - // frame as it runs its epilogue. - uintptr_t frame_base = (uintptr_t) (spp+1); - *spp-- = (uintptr_t) dom->root_crate; // crate ptr *spp-- = (uintptr_t) 0; // frame_glue_fns @@ -195,7 +199,7 @@ rust_task::start(uintptr_t exit_task_glue, for (size_t j = 0; j < n_callee_saves; ++j) { // callee-saves to carry in when we activate if (j == callee_save_fp) - *spp-- = frame_base; + *spp-- = exit_task_frame_base; else *spp-- = (uintptr_t)NULL; } @@ -432,9 +436,9 @@ rust_task::get_fp() { uintptr_t rust_task::get_previous_fp(uintptr_t fp) { - // fp happens to, coincidentally (!) also point to the last - // callee-save on the task stack. - return get_callee_save_fp((uintptr_t*)fp); + // FIXME: terribly X86-specific. + // *fp == previous_fp. + return *((uintptr_t*)fp); } frame_glue_fns* |
