aboutsummaryrefslogtreecommitdiff
path: root/src/comp/back
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <[email protected]>2011-03-09 14:16:11 -0500
committerRafael Ávila de Espíndola <[email protected]>2011-03-09 14:16:11 -0500
commitaeca13894438af8876f88e26a4947b4e7627111d (patch)
treedc68b15ee7262ee0f384ec187e1ac223c73f0feb /src/comp/back
parentrustc: Instantiate tag patterns with the type parameters supplied by the prog... (diff)
downloadrust-aeca13894438af8876f88e26a4947b4e7627111d.tar.xz
rust-aeca13894438af8876f88e26a4947b4e7627111d.zip
swap taskptr and callee in preparation for making taskptr optional.
Diffstat (limited to 'src/comp/back')
-rw-r--r--src/comp/back/x86.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/comp/back/x86.rs b/src/comp/back/x86.rs
index 10227df7..04f5d5af 100644
--- a/src/comp/back/x86.rs
+++ b/src/comp/back/x86.rs
@@ -175,8 +175,11 @@ fn upcall_glue(int n_args) -> vec[str] {
*/
fn copy_arg(uint i) -> str {
- auto src_off = wstr(5 + (i as int));
- auto dst_off = wstr(1 + (i as int));
+ if (i == 0u) {
+ ret "movl %edx, (%esp)";
+ }
+ auto src_off = wstr(4 + (i as int));
+ auto dst_off = wstr(0 + (i as int));
auto m = vec("movl " + src_off + "(%ebp),%eax",
"movl %eax," + dst_off + "(%esp)");
ret _str.connect(m, "\n\t");
@@ -193,14 +196,13 @@ fn upcall_glue(int n_args) -> vec[str] {
+ load_esp_from_runtime_sp()
+ vec("subl $" + wstr(n_args + 1) + ", %esp # esp -= args",
- "andl $~0xf, %esp # align esp down",
- "movl %ecx, (%esp) # arg[0] = rust_task ")
+ "andl $~0xf, %esp # align esp down")
- + _vec.init_fn[str](carg, n_args as uint)
+ + _vec.init_fn[str](carg, (n_args + 1) as uint)
- + vec("movl %ecx, %edi # save task from ecx to edi",
- "call *%edx # call *%edx",
- "movl %edi, %ecx # restore edi-saved task to ecx")
+ + vec("movl %edx, %edi # save task from ecx to edi",
+ "call *%ecx # call *%edx",
+ "movl %edi, %edx # restore edi-saved task to ecx")
+ load_esp_from_rust_sp()
+ restore_callee_saves()