about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-10-20 11:56:45 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-10-20 14:22:17 +0200
commit8124846b2c945f661a6bb85e66e22ca987891dc4 (patch)
treea299fea71192b2716e063a7098e5c6b6850967bb
parent457683c7feef42f07f3044ccfdc8ee7816176ab0 (diff)
downloadrust-8124846b2c945f661a6bb85e66e22ca987891dc4.tar.gz
rust-8124846b2c945f661a6bb85e66e22ca987891dc4.zip
Get rid of taskpointer-passing throughout the compiler
Only intrinsics still take a dummy taskptr. We'll have to do some
makefile stunts to snapshot a version without taskptrs-in-intrinsics.

Issue #466
-rw-r--r--src/comp/back/upcall.rs4
-rw-r--r--src/comp/middle/trans.rs77
-rw-r--r--src/comp/middle/trans_common.rs7
-rw-r--r--src/comp/middle/trans_objects.rs9
-rw-r--r--src/rt/intrinsics/intrinsics.cpp4
-rw-r--r--src/rt/intrinsics/intrinsics.ll.in8
-rw-r--r--src/rt/rust_builtin.cpp6
-rw-r--r--src/rt/rust_internal.h4
-rw-r--r--src/rt/rust_shape.cpp3
-rw-r--r--src/rt/rust_task.cpp5
-rw-r--r--src/rt/rust_upcall.cpp5
11 files changed, 52 insertions, 80 deletions
diff --git a/src/comp/back/upcall.rs b/src/comp/back/upcall.rs
index 693212bfb89..2589247e2cd 100644
--- a/src/comp/back/upcall.rs
+++ b/src/comp/back/upcall.rs
@@ -31,7 +31,7 @@ type upcalls =
      rust_personality: ValueRef};
 
 fn declare_upcalls(_tn: type_names, tydesc_type: TypeRef,
-                   taskptr_type: TypeRef, llmod: ModuleRef) -> @upcalls {
+                   llmod: ModuleRef) -> @upcalls {
     fn decl(llmod: ModuleRef, name: str, tys: [TypeRef], rv: TypeRef) ->
        ValueRef {
         let arg_tys: [TypeRef] = [];
@@ -63,7 +63,7 @@ fn declare_upcalls(_tn: type_names, tydesc_type: TypeRef,
                   T_ptr(T_i8())]),
           cmp_type:
               dv("cmp_type",
-                 [T_ptr(T_i1()), taskptr_type, T_ptr(tydesc_type),
+                 [T_ptr(T_i1()), T_ptr(tydesc_type),
                   T_ptr(T_ptr(tydesc_type)), T_ptr(T_i8()), T_ptr(T_i8()),
                   T_i8()]),
           log_type:
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 5cd397f41bf..83d1de8bfaf 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -92,10 +92,7 @@ fn type_of_fn(cx: @crate_ctxt, sp: span, proto: ast::proto,
     let out_ty = T_ptr(type_of_inner(cx, sp, output));
     atys += [ret_ref ? T_ptr(out_ty) : out_ty];
 
-    // Arg 1: task pointer.
-    atys += [T_taskptr(*cx)];
-
-    // Arg 2: Env (closure-bindings / self-obj)
+    // Arg 1: Env (closure-bindings / self-obj)
     if is_method {
         atys += [T_ptr(cx.rust_object_type)];
     } else {
@@ -109,7 +106,7 @@ fn type_of_fn(cx: @crate_ctxt, sp: span, proto: ast::proto,
         }
     }
 
-    // Args >3: ty params, if not acquired via capture...
+    // Args >2: ty params, if not acquired via capture...
     if !is_method {
         let i = 0u;
         while i < ty_param_count { atys += [T_ptr(cx.tydesc_type)]; i += 1u; }
@@ -349,10 +346,6 @@ fn decl_internal_cdecl_fn(llmod: ModuleRef, name: str, llty: TypeRef) ->
     ret llfn;
 }
 
-fn decl_glue(llmod: ModuleRef, cx: crate_ctxt, s: str) -> ValueRef {
-    ret decl_cdecl_fn(llmod, s, T_fn([T_taskptr(cx)], T_void()));
-}
-
 fn get_extern_fn(externs: hashmap<str, ValueRef>, llmod: ModuleRef, name: str,
                  cc: uint, ty: TypeRef) -> ValueRef {
     if externs.contains_key(name) { ret externs.get(name); }
@@ -1217,7 +1210,7 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
         } else { T_ptr(T_i8()) };
 
     let ty_param_count = std::vec::len::<uint>(ty_params);
-    let lltyparams = llvm::LLVMGetParam(llfn, 3u);
+    let lltyparams = llvm::LLVMGetParam(llfn, 2u);
     let load_env_bcx = new_raw_block_ctxt(fcx, fcx.llloadenv);
     let lltydescs = [mutable];
     let p = 0u;
@@ -1235,12 +1228,12 @@ fn make_generic_glue_inner(cx: @local_ctxt, sp: span, t: ty::t,
 
     let bcx = new_top_block_ctxt(fcx);
     let lltop = bcx.llbb;
-    let llrawptr0 = llvm::LLVMGetParam(llfn, 4u);
+    let llrawptr0 = llvm::LLVMGetParam(llfn, 3u);
     let llval0 = BitCast(bcx, llrawptr0, llty);
     alt helper {
       default_helper(helper) { helper(bcx, llval0, t); }
       copy_helper(helper) {
-        let llrawptr1 = llvm::LLVMGetParam(llfn, 5u);
+        let llrawptr1 = llvm::LLVMGetParam(llfn, 4u);
         let llval1 = BitCast(bcx, llrawptr1, llty);
         helper(bcx, llval0, llval1, t);
       }
@@ -1463,7 +1456,7 @@ fn trans_res_drop(cx: @block_ctxt, rs: ValueRef, did: ast::def_id,
     cx = val.bcx;
     // Find and call the actual destructor.
     let dtor_addr = trans_common::get_res_dtor(ccx, cx.sp, did, inner_t);
-    let args = [cx.fcx.llretptr, cx.fcx.lltaskptr, null_env_ptr(cx)];
+    let args = [cx.fcx.llretptr, null_env_ptr(cx)];
     for tp: ty::t in tps {
         let ti: option::t<@tydesc_info> = none;
         let td = get_tydesc(cx, tp, false, tps_normal, ti).result;
@@ -1888,9 +1881,8 @@ fn call_tydesc_glue_full(cx: @block_ctxt, v: ValueRef, tydesc: ValueRef,
       some(sgf) { llfn = sgf; }
     }
 
-    Call(cx, llfn,
-         [C_null(T_ptr(T_nil())), cx.fcx.lltaskptr, C_null(T_ptr(T_nil())),
-          lltydescs, llrawptr]);
+    Call(cx, llfn, [C_null(T_ptr(T_nil())), C_null(T_ptr(T_nil())),
+                    lltydescs, llrawptr]);
 }
 
 fn call_tydesc_glue(cx: @block_ctxt, v: ValueRef, t: ty::t, field: int) ->
@@ -1937,7 +1929,7 @@ fn call_cmp_glue(cx: @block_ctxt, lhs: ValueRef, rhs: ValueRef, t: ty::t,
     }
 
     let llcmpresultptr = alloca(bcx, T_i1());
-    Call(bcx, llfn, [llcmpresultptr, bcx.fcx.lltaskptr, lltydesc, lltydescs,
+    Call(bcx, llfn, [llcmpresultptr, lltydesc, lltydescs,
                      llrawlhsptr, llrawrhsptr, llop]);
     ret rslt(bcx, Load(bcx, llcmpresultptr));
 }
@@ -2921,7 +2913,7 @@ fn trans_for_each(cx: @block_ctxt, local: @ast::local, seq: @ast::expr,
     let bcx = new_top_block_ctxt(fcx);
     // Add bindings for the loop variable alias.
     bcx = trans_alt::bind_irrefutable_pat(bcx, local.node.pat,
-                                          llvm::LLVMGetParam(fcx.llfn, 3u),
+                                          llvm::LLVMGetParam(fcx.llfn, 2u),
                                           false);
     let lltop = bcx.llbb;
     bcx = trans_block(bcx, body);
@@ -3560,10 +3552,10 @@ fn trans_bind_thunk(cx: @local_ctxt, sp: span, incoming_fty: ty::t,
     let llargs: [ValueRef] = alt ty::ty_fn_proto(ccx.tcx, outgoing_fty) {
       ast::proto_bare. {
         // Bare functions don't take an environment
-        [llretptr, fcx.lltaskptr]
+        [llretptr]
       }
       _ {
-        [llretptr, fcx.lltaskptr, lltargetenv]
+        [llretptr, lltargetenv]
       }
     };
 
@@ -3583,7 +3575,7 @@ fn trans_bind_thunk(cx: @local_ctxt, sp: span, incoming_fty: ty::t,
         i += 1u;
     }
 
-    let a: uint = 3u; // retptr, task ptr, env come first
+    let a: uint = 2u; // retptr, env come first
     let b: int = starting_idx;
     let outgoing_arg_index: uint = 0u;
     let llout_arg_tys: [TypeRef] =
@@ -3847,10 +3839,7 @@ fn trans_args(cx: @block_ctxt, outer_cx: @block_ctxt, llenv: ValueRef,
         llargs += [PointerCast(cx, llretslot, llretty)];
     } else { llargs += [llretslot]; }
 
-    // Arg 1: task pointer.
-    llargs += [bcx.fcx.lltaskptr];
-
-    // Arg 2: Env (closure-bindings / self-obj)
+    // Arg 1: Env (closure-bindings / self-obj)
     alt ty::ty_fn_proto(tcx, fn_ty) {
       ast::proto_bare. { }
       _ {
@@ -3858,7 +3847,7 @@ fn trans_args(cx: @block_ctxt, outer_cx: @block_ctxt, llenv: ValueRef,
       }
     }
 
-    // Args >3: ty_params ...
+    // Args >2: ty_params ...
     llargs += lltydescs;
 
     // ... then possibly an lliterbody argument.
@@ -4639,7 +4628,7 @@ fn trans_put(in_cx: @block_ctxt, e: option::t<@ast::expr>) -> @block_ctxt {
     }
     let bcx = cx;
     let dummy_retslot = alloca(bcx, T_nil());
-    let llargs: [ValueRef] = [dummy_retslot, cx.fcx.lltaskptr, llenv];
+    let llargs: [ValueRef] = [dummy_retslot, llenv];
     alt e {
       none. {
         llargs += [C_null(T_ptr(T_nil()))];
@@ -5110,8 +5099,7 @@ fn new_fn_ctxt_w_id(cx: @local_ctxt, sp: span, llfndecl: ValueRef,
     let llbbs = mk_standard_basic_blocks(llfndecl);
     // FIXME: llenv is not correct for bare functions
     ret @{llfn: llfndecl,
-          lltaskptr: llvm::LLVMGetParam(llfndecl, 1u),
-          llenv: llvm::LLVMGetParam(llfndecl, 2u),
+          llenv: llvm::LLVMGetParam(llfndecl, 1u),
           llretptr: llvm::LLVMGetParam(llfndecl, 0u),
           mutable llstaticallocas: llbbs.sa,
           mutable llloadenv: llbbs.ca,
@@ -5141,8 +5129,8 @@ fn new_fn_ctxt(cx: @local_ctxt, sp: span, llfndecl: ValueRef) -> @fn_ctxt {
 
 fn implicit_args_for_fn(proto: ast::proto) -> uint {
     alt proto {
-      ast::proto_bare. { 2u }
-      _ { 3u }
+      ast::proto_bare. { 1u }
+      _ { 2u }
     }
 }
 
@@ -5666,10 +5654,9 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef,
         let lltop = bcx.llbb;
 
         let lloutputarg = llvm::LLVMGetParam(llfdecl, 0u);
-        let lltaskarg = llvm::LLVMGetParam(llfdecl, 1u);
-        let llenvarg = llvm::LLVMGetParam(llfdecl, 2u);
-        let args = [lloutputarg, lltaskarg, llenvarg];
-        if takes_argv { args += [llvm::LLVMGetParam(llfdecl, 3u)]; }
+        let llenvarg = llvm::LLVMGetParam(llfdecl, 1u);
+        let args = [lloutputarg, llenvarg];
+        if takes_argv { args += [llvm::LLVMGetParam(llfdecl, 2u)]; }
         Call(bcx, main_llfn, args);
         build_return(bcx);
 
@@ -5825,16 +5812,11 @@ fn register_native_fn(ccx: @crate_ctxt, sp: span, path: [str], name: str,
     let rty = ty::ty_fn_ret(ccx.tcx, fn_type);
     let rty_is_nil = ty::type_is_nil(ccx.tcx, rty);
 
-    let lltaskptr;
-    if cast_to_i32 {
-        lltaskptr = vp2i(bcx, fcx.lltaskptr);
-    } else { lltaskptr = fcx.lltaskptr; }
-
     let call_args: [ValueRef] = [];
-    if pass_task { call_args += [lltaskptr]; }
+    if pass_task { call_args += [C_null(T_ptr(ccx.task_type))]; }
     if uses_retptr { call_args += [bcx.fcx.llretptr]; }
 
-    let arg_n = 3u;
+    let arg_n = 2u;
     for each i: uint in uint::range(0u, num_ty_param) {
         let llarg = llvm::LLVMGetParam(fcx.llfn, arg_n);
         fcx.lltydescs += [llarg];
@@ -6144,11 +6126,6 @@ fn trap(bcx: @block_ctxt) {
     }
 }
 
-fn decl_no_op_type_glue(llmod: ModuleRef, taskptr_type: TypeRef) -> ValueRef {
-    let ty = T_fn([taskptr_type, T_ptr(T_i8())], T_void());
-    ret decl_cdecl_fn(llmod, abi::no_op_type_glue_name(), ty);
-}
-
 fn create_module_map(ccx: @crate_ctxt) -> ValueRef {
     let elttype = T_struct([T_int(), T_int()]);
     let maptype = T_array(elttype, ccx.module_data.size() + 1u);
@@ -6255,9 +6232,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
     let tn = mk_type_names();
     let intrinsics = declare_intrinsics(llmod);
     let task_type = T_task();
-    let taskptr_type = T_ptr(task_type);
-    tn.associate("taskptr", taskptr_type);
-    let tydesc_type = T_tydesc(taskptr_type);
+    let tydesc_type = T_tydesc();
     tn.associate("tydesc", tydesc_type);
     let hasher = ty::hash_ty;
     let eqer = ty::eq_ty;
@@ -6302,7 +6277,7 @@ fn trans_crate(sess: session::session, crate: @ast::crate, tcx: ty::ctxt,
                mutable n_real_glues: 0u,
                fn_times: @mutable []},
           upcalls:
-              upcall::declare_upcalls(tn, tydesc_type, taskptr_type, llmod),
+              upcall::declare_upcalls(tn, tydesc_type, llmod),
           rust_object_type: T_rust_object(),
           tydesc_type: tydesc_type,
           task_type: task_type,
diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs
index 6ed895aa655..76e04bb9aab 100644
--- a/src/comp/middle/trans_common.rs
+++ b/src/comp/middle/trans_common.rs
@@ -234,7 +234,6 @@ type fn_ctxt =
 
     // This function's enclosing local context.
     {llfn: ValueRef,
-     lltaskptr: ValueRef,
      llenv: ValueRef,
      llretptr: ValueRef,
      mutable llstaticallocas: BasicBlockRef,
@@ -605,15 +604,15 @@ fn T_cmp_glue_fn(cx: crate_ctxt) -> TypeRef {
     ret t;
 }
 
-fn T_tydesc(taskptr_type: TypeRef) -> TypeRef {
+fn T_tydesc() -> TypeRef {
     let tydesc = T_named_struct("tydesc");
     let tydescpp = T_ptr(T_ptr(tydesc));
     let pvoid = T_ptr(T_i8());
     let glue_fn_ty =
-        T_ptr(T_fn([T_ptr(T_nil()), taskptr_type, T_ptr(T_nil()), tydescpp,
+        T_ptr(T_fn([T_ptr(T_nil()), T_ptr(T_nil()), tydescpp,
                     pvoid], T_void()));
     let cmp_glue_fn_ty =
-        T_ptr(T_fn([T_ptr(T_i1()), taskptr_type, T_ptr(tydesc), tydescpp,
+        T_ptr(T_fn([T_ptr(T_i1()), T_ptr(tydesc), tydescpp,
                     pvoid, pvoid, T_i8()], T_void()));
 
     let elems =
diff --git a/src/comp/middle/trans_objects.rs b/src/comp/middle/trans_objects.rs
index 25b838957fc..5883fe56c94 100644
--- a/src/comp/middle/trans_objects.rs
+++ b/src/comp/middle/trans_objects.rs
@@ -680,13 +680,12 @@ fn process_bkwding_mthd(cx: @local_ctxt, sp: span, m: @ty::method,
 
     // Set up the three implicit arguments to the outer method we'll need to
     // call.
-    let llouter_mthd_args: [ValueRef] = [llretptr, fcx.lltaskptr,
-                                         llself_obj_ptr];
+    let llouter_mthd_args: [ValueRef] = [llretptr, llself_obj_ptr];
 
     // Copy the explicit arguments that are being passed into the forwarding
     // function (they're in fcx.llargs) to llouter_mthd_args.
 
-    let a: uint = 3u; // retptr, task ptr, env come first
+    let a: uint = 2u; // retptr, env come first
     for arg: ty::arg in m.inputs {
         llouter_mthd_args += [llvm::LLVMGetParam(llbackwarding_fn, a)];
         a += 1u;
@@ -833,12 +832,12 @@ fn process_fwding_mthd(cx: @local_ctxt, sp: span, m: @ty::method,
 
     // Set up the three implicit arguments to the original method we'll need
     // to call.
-    let llorig_mthd_args: [ValueRef] = [llretptr, fcx.lltaskptr, self_stack];
+    let llorig_mthd_args: [ValueRef] = [llretptr, self_stack];
 
     // Copy the explicit arguments that are being passed into the forwarding
     // function (they're in fcx.llargs) to llorig_mthd_args.
 
-    let a: uint = 3u; // retptr, task ptr, env come first
+    let a: uint = 2u; // retptr, env come first
     for arg: ty::arg in m.inputs {
         llorig_mthd_args += [llvm::LLVMGetParam(llforwarding_fn, a)];
         a += 1u;
diff --git a/src/rt/intrinsics/intrinsics.cpp b/src/rt/intrinsics/intrinsics.cpp
index 2cd4198e3a0..681888d00b1 100644
--- a/src/rt/intrinsics/intrinsics.cpp
+++ b/src/rt/intrinsics/intrinsics.cpp
@@ -28,7 +28,7 @@ rust_intrinsic_cast(rust_task *task, void *retptr, type_desc *t1,
                     type_desc *t2, void *src)
 {
     if (t1->size != t2->size) {
-        upcall_fail(task, "attempt to cast values of differing sizes",
+        upcall_fail("attempt to cast values of differing sizes",
                     __FILE__, __LINE__);
         return;
     }
@@ -45,6 +45,6 @@ rust_intrinsic_addr_of(rust_task *task, void **retptr, type_desc *ty,
 extern "C" void
 rust_intrinsic_recv(rust_task *task, void **retptr, type_desc *ty,
                     rust_port *port) {
-    port_recv(task, (uintptr_t*)retptr, port);
+    port_recv((uintptr_t*)retptr, port);
 }
 
diff --git a/src/rt/intrinsics/intrinsics.ll.in b/src/rt/intrinsics/intrinsics.ll.in
index 872cec7fa21..4fd510609cd 100644
--- a/src/rt/intrinsics/intrinsics.ll.in
+++ b/src/rt/intrinsics/intrinsics.ll.in
@@ -83,7 +83,7 @@ entry:
   br i1 %cmp, label %if.end, label %if.then
 
 if.then:                                          ; preds = %entry
-  tail call void @upcall_fail(%struct.rust_task* %task, i8* getelementptr inbounds ([42 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8]* @.str1, i32 0, i32 0), i32 45)
+  tail call void @upcall_fail(i8* getelementptr inbounds ([42 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8]* @.str1, i32 0, i32 0), i32 45)
   br label %return
 
 if.end:                                           ; preds = %entry
@@ -94,7 +94,7 @@ return:                                           ; preds = %if.end, %if.then
   ret void
 }
 
-declare void @upcall_fail(%struct.rust_task*, i8*, i8*, i32)
+declare void @upcall_fail(i8*, i8*, i32)
 
 declare void @llvm.memmove.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i32, i1) nounwind
 
@@ -107,11 +107,11 @@ entry:
 define linkonce_odr void @rust_intrinsic_recv(%struct.rust_task* %task, i8** %retptr, %struct.type_desc* nocapture %ty, %class.rust_port* %port) {
 entry:
   %0 = bitcast i8** %retptr to i32*
-  tail call void @port_recv(%struct.rust_task* %task, i32* %0, %class.rust_port* %port)
+  tail call void @port_recv(i32* %0, %class.rust_port* %port)
   ret void
 }
 
-declare void @port_recv(%struct.rust_task*, i32*, %class.rust_port*)
+declare void @port_recv(i32*, %class.rust_port*)
 
 !0 = metadata !{metadata !"long", metadata !1}
 !1 = metadata !{metadata !"omnipotent char", metadata !2}
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 44fe75eb33c..8b179b92db8 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -452,9 +452,9 @@ struct fn_env_pair {
 
 // FIXME This is probably not needed at all anymore. Have to rearrange some
 // argument passing to remove it.
-void rust_spawn_wrapper(void* retptr, rust_task* taskptr, void* envptr,
-                        void(*func)(void*, rust_task*, void*)) {
-    func(retptr, taskptr, envptr);
+void rust_spawn_wrapper(void* retptr, void* envptr,
+                        void(*func)(void*, void*)) {
+    func(retptr, envptr);
 }
 
 extern "C" CDECL void
diff --git a/src/rt/rust_internal.h b/src/rt/rust_internal.h
index 6e5aa8a15f3..a820262cc65 100644
--- a/src/rt/rust_internal.h
+++ b/src/rt/rust_internal.h
@@ -245,9 +245,9 @@ struct rust_timer {
 
 #include "rust_util.h"
 
-typedef void CDECL (glue_fn)(void *, rust_task *, void *,
+typedef void CDECL (glue_fn)(void *, void *,
                              const type_desc **, void *);
-typedef void CDECL (cmp_glue_fn)(void *, rust_task *, void *,
+typedef void CDECL (cmp_glue_fn)(void *, void *,
                                  const type_desc **,
                                  void *, void *, int8_t);
 
diff --git a/src/rt/rust_shape.cpp b/src/rt/rust_shape.cpp
index 8fa82b75481..e52cd77cd40 100644
--- a/src/rt/rust_shape.cpp
+++ b/src/rt/rust_shape.cpp
@@ -530,9 +530,10 @@ log::walk_res(const rust_fn *dtor, unsigned n_params,
 } // end namespace shape
 
 extern "C" void
-upcall_cmp_type(int8_t *result, rust_task *task, const type_desc *tydesc,
+upcall_cmp_type(int8_t *result, const type_desc *tydesc,
                 const type_desc **subtydescs, uint8_t *data_0,
                 uint8_t *data_1, uint8_t cmp_type) {
+    rust_task *task = rust_scheduler::get_task();
     shape::arena arena;
 
     // FIXME: This may well be broken when comparing two closures or objects
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index a764856343b..17faeec1a1c 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -130,8 +130,7 @@ struct spawn_args {
     rust_task *task;
     uintptr_t a3;
     uintptr_t a4;
-    void (*CDECL f)(int *, rust_task *,
-                       uintptr_t, uintptr_t);
+    void (*CDECL f)(int *, uintptr_t, uintptr_t);
 };
 
 struct rust_closure_env {
@@ -147,7 +146,7 @@ void task_start_wrapper(spawn_args *a)
 
     bool failed = false;
     try {
-        a->f(&rval, task, a->a3, a->a4);
+        a->f(&rval, a->a3, a->a4);
     } catch (rust_task *ex) {
         A(task->sched, ex == task,
           "Expected this task to be thrown for unwinding");
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index 516de91dd5f..82d82323ae5 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -28,8 +28,7 @@ check_stack(rust_task *task) {
 // dealing with reference counts
 static inline void
 copy_elements(rust_task *task, type_desc *elem_t,
-              void *pdst, void *psrc, size_t n)
-{
+              void *pdst, void *psrc, size_t n) {
     char *dst = (char *)pdst, *src = (char *)psrc;
     memmove(dst, src, n);
 
@@ -39,7 +38,7 @@ copy_elements(rust_task *task, type_desc *elem_t,
         size_t elem_size = elem_t->size;
         const type_desc **tydescs = elem_t->first_param;
         for (char *p = dst; p < dst+n; p += elem_size) {
-            take_glue(NULL, task, NULL, tydescs, p);
+            take_glue(NULL, NULL, tydescs, p);
         }
     }
 }