Revert "Change the type of the second argument of upcalls to be a %task*.", breaks win32 build.

This reverts commit dcf122ede0.
This commit is contained in:
Graydon Hoare 2011-03-23 16:31:30 -07:00
parent 9b617dab3c
commit 08bea1d9a2

View File

@ -861,11 +861,8 @@ fn decl_upcall_glue(ModuleRef llmod, type_names tn,
let int n = _n as int;
let str s = abi.upcall_glue_name(n, pass_task);
let vec[TypeRef] args = vec(T_int()); // callee
args += vec(T_taskptr(tn));
if (pass_task) {
n -= 1; // taskptr is included in n
if (!pass_task) {
args += vec(T_int()); // taskptr, will not be passed
}
args += _vec.init_elt[TypeRef](T_int(), n as uint);
@ -886,8 +883,10 @@ fn get_upcall(&hashmap[str, ValueRef] upcalls,
fn trans_upcall(@block_ctxt cx, str name, vec[ValueRef] args) -> result {
auto cxx = cx.fcx.ccx;
auto t = trans_upcall2(cx.build, cxx.glues, cx.fcx.lltaskptr,
cxx.upcalls, cxx.tn, cxx.llmod, name, true, args);
auto lltaskptr = cx.build.PtrToInt(cx.fcx.lltaskptr, T_int());
auto args2 = vec(lltaskptr) + args;
auto t = trans_upcall2(cx.build, cxx.glues, lltaskptr,
cxx.upcalls, cxx.tn, cxx.llmod, name, true, args2);
ret res(cx, t);
}
@ -896,9 +895,6 @@ fn trans_upcall2(builder b, @glue_fns glues, ValueRef lltaskptr,
type_names tn, ModuleRef llmod, str name,
bool pass_task, vec[ValueRef] args) -> ValueRef {
let int n = (_vec.len[ValueRef](args) as int);
if (pass_task) {
n += 1;
}
let ValueRef llupcall = get_upcall(upcalls, llmod, name, n);
llupcall = llvm.LLVMConstPointerCast(llupcall, T_int());
@ -910,7 +906,9 @@ fn trans_upcall2(builder b, @glue_fns glues, ValueRef lltaskptr,
}
let vec[ValueRef] call_args = vec(llupcall);
call_args += vec(lltaskptr);
if (!pass_task) {
call_args += vec(lltaskptr);
}
for (ValueRef a in args) {
call_args += vec(b.ZExtOrBitCast(a, T_int()));
@ -5733,9 +5731,11 @@ fn decl_native_fn_and_pair(@crate_ctxt cx,
auto arg_n = 3u;
auto pass_task;
auto lltaskptr = bcx.build.PtrToInt(fcx.lltaskptr, T_int());
alt (abi) {
case (ast.native_abi_rust) {
pass_task = true;
call_args += vec(lltaskptr);
for each (uint i in _uint.range(0u, num_ty_param)) {
auto llarg = llvm.LLVMGetParam(fcx.llfn, arg_n);
check (llarg as int != 0);
@ -5755,8 +5755,8 @@ fn decl_native_fn_and_pair(@crate_ctxt cx,
arg_n += 1u;
}
auto r = trans_upcall2(bcx.build, cx.glues, fcx.lltaskptr, cx.upcalls,
cx.tn, cx.llmod, name, pass_task, call_args);
auto r = trans_upcall2(bcx.build, cx.glues, lltaskptr, cx.upcalls, cx.tn,
cx.llmod, name, pass_task, call_args);
auto rptr = bcx.build.BitCast(fcx.llretptr, T_ptr(T_i32()));
bcx.build.Store(r, rptr);
bcx.build.RetVoid();