1
Fork 0

Programs using spawn terminate

This commit is contained in:
Eric Holk 2011-05-24 12:18:42 -07:00
parent dad426419c
commit a88af906c5
3 changed files with 18 additions and 1 deletions

View file

@ -760,6 +760,9 @@ fn type_of_inner(&@crate_ctxt cx, &ast::span sp, &ty::t t) -> TypeRef {
case (ty::ty_chan(?t)) {
llty = T_ptr(T_chan(type_of_inner(cx, sp, t)));
}
case (ty::ty_task) {
llty = T_taskptr(cx.tn);
}
case (ty::ty_tup(?elts)) {
let vec[TypeRef] tys = [];
for (ty::mt elt in elts) {
@ -2014,6 +2017,11 @@ fn make_free_glue(&@block_ctxt cx, ValueRef v0, &ty::t t) {
rslt = res(cx, C_int(0));
}
case (ty::ty_task) {
// TODO: call upcall_kill
rslt = res(cx, C_nil());
}
case (ty::ty_obj(_)) {
auto box_cell =
@ -2107,6 +2115,10 @@ fn make_drop_glue(&@block_ctxt cx, ValueRef v0, &ty::t t) {
rslt = decr_refcnt_maybe_free(cx, v0, v0, t);
}
case (ty::ty_task) {
rslt = decr_refcnt_maybe_free(cx, v0, v0, t);
}
case (ty::ty_obj(_)) {
auto box_cell =
cx.build.GEP(v0,
@ -5984,6 +5996,10 @@ fn trans_spawn(&@block_ctxt cx,
}
*/
auto task_ty = node_ann_type(bcx.fcx.lcx.ccx, ann);
auto dropref = clean(bind drop_ty(_, new_task, task_ty));
find_scope_cx(bcx).cleanups += [dropref];
ret res(bcx, new_task);
}

View file

@ -951,6 +951,7 @@ fn type_is_boxed(&ctxt cx, &t ty) -> bool {
case (ty_box(_)) { ret true; }
case (ty_port(_)) { ret true; }
case (ty_chan(_)) { ret true; }
case (ty_task) { ret true; }
case (_) { ret false; }
}
fail;

View file

@ -4,7 +4,7 @@
// -*- rust -*-
fn main() {
spawn child(10);
auto t = spawn child(10);
}
fn child(int i) {