From aeca13894438af8876f88e26a4947b4e7627111d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20=C3=81vila=20de=20Esp=C3=ADndola?= Date: Wed, 9 Mar 2011 14:16:11 -0500 Subject: swap taskptr and callee in preparation for making taskptr optional. --- src/comp/back/x86.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/comp/back') 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() -- cgit v1.2.3