Change the type of the second argument of upcalls to be a %task*.
This commit is contained in:
parent
c7cd60a3ec
commit
dcf122ede0
@ -855,8 +855,11 @@ fn decl_upcall_glue(ModuleRef llmod, type_names tn,
|
|||||||
let int n = _n as int;
|
let int n = _n as int;
|
||||||
let str s = abi.upcall_glue_name(n, pass_task);
|
let str s = abi.upcall_glue_name(n, pass_task);
|
||||||
let vec[TypeRef] args = vec(T_int()); // callee
|
let vec[TypeRef] args = vec(T_int()); // callee
|
||||||
if (!pass_task) {
|
|
||||||
args += vec(T_int()); // taskptr, will not be passed
|
args += vec(T_taskptr(tn));
|
||||||
|
|
||||||
|
if (pass_task) {
|
||||||
|
n -= 1; // taskptr is included in n
|
||||||
}
|
}
|
||||||
args += _vec.init_elt[TypeRef](T_int(), n as uint);
|
args += _vec.init_elt[TypeRef](T_int(), n as uint);
|
||||||
|
|
||||||
@ -877,10 +880,8 @@ fn get_upcall(&hashmap[str, ValueRef] upcalls,
|
|||||||
|
|
||||||
fn trans_upcall(@block_ctxt cx, str name, vec[ValueRef] args) -> result {
|
fn trans_upcall(@block_ctxt cx, str name, vec[ValueRef] args) -> result {
|
||||||
auto cxx = cx.fcx.ccx;
|
auto cxx = cx.fcx.ccx;
|
||||||
auto lltaskptr = cx.build.PtrToInt(cx.fcx.lltaskptr, T_int());
|
auto t = trans_upcall2(cx.build, cxx.glues, cx.fcx.lltaskptr,
|
||||||
auto args2 = vec(lltaskptr) + args;
|
cxx.upcalls, cxx.tn, cxx.llmod, name, true, args);
|
||||||
auto t = trans_upcall2(cx.build, cxx.glues, lltaskptr,
|
|
||||||
cxx.upcalls, cxx.tn, cxx.llmod, name, true, args2);
|
|
||||||
ret res(cx, t);
|
ret res(cx, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -889,6 +890,9 @@ fn trans_upcall2(builder b, @glue_fns glues, ValueRef lltaskptr,
|
|||||||
type_names tn, ModuleRef llmod, str name,
|
type_names tn, ModuleRef llmod, str name,
|
||||||
bool pass_task, vec[ValueRef] args) -> ValueRef {
|
bool pass_task, vec[ValueRef] args) -> ValueRef {
|
||||||
let int n = (_vec.len[ValueRef](args) as int);
|
let int n = (_vec.len[ValueRef](args) as int);
|
||||||
|
if (pass_task) {
|
||||||
|
n += 1;
|
||||||
|
}
|
||||||
let ValueRef llupcall = get_upcall(upcalls, llmod, name, n);
|
let ValueRef llupcall = get_upcall(upcalls, llmod, name, n);
|
||||||
llupcall = llvm.LLVMConstPointerCast(llupcall, T_int());
|
llupcall = llvm.LLVMConstPointerCast(llupcall, T_int());
|
||||||
|
|
||||||
@ -900,9 +904,7 @@ fn trans_upcall2(builder b, @glue_fns glues, ValueRef lltaskptr,
|
|||||||
}
|
}
|
||||||
let vec[ValueRef] call_args = vec(llupcall);
|
let vec[ValueRef] call_args = vec(llupcall);
|
||||||
|
|
||||||
if (!pass_task) {
|
|
||||||
call_args += vec(lltaskptr);
|
call_args += vec(lltaskptr);
|
||||||
}
|
|
||||||
|
|
||||||
for (ValueRef a in args) {
|
for (ValueRef a in args) {
|
||||||
call_args += vec(b.ZExtOrBitCast(a, T_int()));
|
call_args += vec(b.ZExtOrBitCast(a, T_int()));
|
||||||
@ -5701,11 +5703,9 @@ fn decl_native_fn_and_pair(@crate_ctxt cx,
|
|||||||
auto arg_n = 3u;
|
auto arg_n = 3u;
|
||||||
auto pass_task;
|
auto pass_task;
|
||||||
|
|
||||||
auto lltaskptr = bcx.build.PtrToInt(fcx.lltaskptr, T_int());
|
|
||||||
alt (abi) {
|
alt (abi) {
|
||||||
case (ast.native_abi_rust) {
|
case (ast.native_abi_rust) {
|
||||||
pass_task = true;
|
pass_task = true;
|
||||||
call_args += vec(lltaskptr);
|
|
||||||
for each (uint i in _uint.range(0u, num_ty_param)) {
|
for each (uint i in _uint.range(0u, num_ty_param)) {
|
||||||
auto llarg = llvm.LLVMGetParam(fcx.llfn, arg_n);
|
auto llarg = llvm.LLVMGetParam(fcx.llfn, arg_n);
|
||||||
check (llarg as int != 0);
|
check (llarg as int != 0);
|
||||||
@ -5725,8 +5725,8 @@ fn decl_native_fn_and_pair(@crate_ctxt cx,
|
|||||||
arg_n += 1u;
|
arg_n += 1u;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto r = trans_upcall2(bcx.build, cx.glues, lltaskptr, cx.upcalls, cx.tn,
|
auto r = trans_upcall2(bcx.build, cx.glues, fcx.lltaskptr, cx.upcalls,
|
||||||
cx.llmod, name, pass_task, call_args);
|
cx.tn, cx.llmod, name, pass_task, call_args);
|
||||||
auto rptr = bcx.build.BitCast(fcx.llretptr, T_ptr(T_i32()));
|
auto rptr = bcx.build.BitCast(fcx.llretptr, T_ptr(T_i32()));
|
||||||
bcx.build.Store(r, rptr);
|
bcx.build.Store(r, rptr);
|
||||||
bcx.build.RetVoid();
|
bcx.build.RetVoid();
|
||||||
|
Loading…
Reference in New Issue
Block a user