Skip to content

Commit 3c31696

Browse files
committed
---
yaml --- r: 1569 b: refs/heads/master c: aeca138 h: refs/heads/master i: 1567: 7a0063b v: v3
1 parent a83116c commit 3c31696

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 50da3ea5bcf31d3c4784f2e5158fd1e7d74aa2d6
2+
refs/heads/master: aeca13894438af8876f88e26a4947b4e7627111d

trunk/src/comp/back/x86.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,11 @@ fn upcall_glue(int n_args) -> vec[str] {
175175
*/
176176

177177
fn copy_arg(uint i) -> str {
178-
auto src_off = wstr(5 + (i as int));
179-
auto dst_off = wstr(1 + (i as int));
178+
if (i == 0u) {
179+
ret "movl %edx, (%esp)";
180+
}
181+
auto src_off = wstr(4 + (i as int));
182+
auto dst_off = wstr(0 + (i as int));
180183
auto m = vec("movl " + src_off + "(%ebp),%eax",
181184
"movl %eax," + dst_off + "(%esp)");
182185
ret _str.connect(m, "\n\t");
@@ -193,14 +196,13 @@ fn upcall_glue(int n_args) -> vec[str] {
193196
+ load_esp_from_runtime_sp()
194197

195198
+ vec("subl $" + wstr(n_args + 1) + ", %esp # esp -= args",
196-
"andl $~0xf, %esp # align esp down",
197-
"movl %ecx, (%esp) # arg[0] = rust_task ")
199+
"andl $~0xf, %esp # align esp down")
198200

199-
+ _vec.init_fn[str](carg, n_args as uint)
201+
+ _vec.init_fn[str](carg, (n_args + 1) as uint)
200202

201-
+ vec("movl %ecx, %edi # save task from ecx to edi",
202-
"call *%edx # call *%edx",
203-
"movl %edi, %ecx # restore edi-saved task to ecx")
203+
+ vec("movl %edx, %edi # save task from ecx to edi",
204+
"call *%ecx # call *%edx",
205+
"movl %edi, %edx # restore edi-saved task to ecx")
204206

205207
+ load_esp_from_rust_sp()
206208
+ restore_callee_saves()

trunk/src/comp/middle/trans.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -831,8 +831,8 @@ fn decl_upcall_glue(ModuleRef llmod, type_names tn, uint _n) -> ValueRef {
831831
let int n = _n as int;
832832
let str s = abi.upcall_glue_name(n);
833833
let vec[TypeRef] args =
834-
vec(T_taskptr(tn), // taskptr
835-
T_int()) // callee
834+
vec(T_int(), // callee
835+
T_taskptr(tn)) // taskptr
836836
+ _vec.init_elt[TypeRef](T_int(), n as uint);
837837

838838
ret decl_fastcall_fn(llmod, s, T_fn(args, T_int()));
@@ -856,7 +856,7 @@ fn trans_upcall(@block_ctxt cx, str name, vec[ValueRef] args) -> result {
856856
llupcall = llvm.LLVMConstPointerCast(llupcall, T_int());
857857

858858
let ValueRef llglue = cx.fcx.ccx.glues.upcall_glues.(n);
859-
let vec[ValueRef] call_args = vec(cx.fcx.lltaskptr, llupcall);
859+
let vec[ValueRef] call_args = vec(llupcall, cx.fcx.lltaskptr);
860860

861861
for (ValueRef a in args) {
862862
call_args += cx.build.ZExtOrBitCast(a, T_int());

0 commit comments

Comments
 (0)