Removing tasks, ports and chans from the compiler.
This commit is contained in:
parent
f05a91a0dc
commit
862bc521a1
@ -219,9 +219,6 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
|
||||
'*' { ret ty::mk_ptr(st.tcx, parse_mt(st, sd)); }
|
||||
'V' { ret ty::mk_vec(st.tcx, parse_mt(st, sd)); }
|
||||
'I' { ret ty::mk_ivec(st.tcx, parse_mt(st, sd)); }
|
||||
'a' { ret ty::mk_task(st.tcx); }
|
||||
'P' { ret ty::mk_port(st.tcx, parse_ty(st, sd)); }
|
||||
'C' { ret ty::mk_chan(st.tcx, parse_ty(st, sd)); }
|
||||
'R' {
|
||||
assert (next(st) as char == '[');
|
||||
let fields: [ty::field] = ~[];
|
||||
|
@ -130,8 +130,6 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
|
||||
ty::ty_ptr(mt) { w.write_char('*'); enc_mt(w, cx, mt); }
|
||||
ty::ty_vec(mt) { w.write_char('V'); enc_mt(w, cx, mt); }
|
||||
ty::ty_ivec(mt) { w.write_char('I'); enc_mt(w, cx, mt); }
|
||||
ty::ty_port(t) { w.write_char('P'); enc_ty(w, cx, t); }
|
||||
ty::ty_chan(t) { w.write_char('C'); enc_ty(w, cx, t); }
|
||||
ty::ty_rec(fields) {
|
||||
w.write_str("R[");
|
||||
for field: ty::field in fields {
|
||||
@ -188,7 +186,6 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
|
||||
w.write_str(uint::str(id));
|
||||
}
|
||||
ty::ty_type. { w.write_char('Y'); }
|
||||
ty::ty_task. { w.write_char('a'); }
|
||||
ty::ty_constr(ty, cs) {
|
||||
w.write_str("A[");
|
||||
enc_ty(w, cx, ty);
|
||||
|
@ -35,8 +35,7 @@ fn type_is_gc_relevant(cx: &ty::ctxt, ty: &ty::t) -> bool {
|
||||
ty::ty_nil. | ty::ty_bot. | ty::ty_bool. | ty::ty_int. |
|
||||
ty::ty_float. | ty::ty_uint. | ty::ty_machine(_) | ty::ty_char. |
|
||||
ty::ty_istr. | ty::ty_type. | ty::ty_native(_) | ty::ty_ptr(_) |
|
||||
ty::ty_port(_) | ty::ty_chan(_) | ty::ty_task. | ty::ty_type. |
|
||||
ty::ty_native(_) {
|
||||
ty::ty_type. | ty::ty_native(_) {
|
||||
ret false;
|
||||
}
|
||||
|
||||
|
@ -357,13 +357,6 @@ fn shape_of(ccx : &@crate_ctxt, t : ty::t) -> [u8] {
|
||||
add_size_hint(ccx, s, mt.ty);
|
||||
add_substr(s, shape_of(ccx, mt.ty));
|
||||
}
|
||||
ty::ty_port(t) {
|
||||
s += ~[shape_port];
|
||||
add_substr(s, shape_of(ccx, t));
|
||||
}
|
||||
ty::ty_chan(t) { s += ~[shape_chan]; }
|
||||
ty::ty_task. { s += ~[shape_task]; }
|
||||
|
||||
ty::ty_rec(fields) {
|
||||
s += ~[shape_struct];
|
||||
let sub = ~[];
|
||||
|
@ -220,9 +220,6 @@ fn type_of_inner(cx: &@crate_ctxt, sp: &span, t: &ty::t) -> TypeRef {
|
||||
} else { llty = T_ivec(type_of_inner(cx, sp, mt.ty)); }
|
||||
}
|
||||
ty::ty_ptr(mt) { llty = T_ptr(type_of_inner(cx, sp, mt.ty)); }
|
||||
ty::ty_port(t) { llty = T_ptr(T_port(type_of_inner(cx, sp, t))); }
|
||||
ty::ty_chan(t) { llty = T_ptr(T_chan(type_of_inner(cx, sp, t))); }
|
||||
ty::ty_task. { llty = T_taskptr(*cx); }
|
||||
ty::ty_rec(fields) {
|
||||
let tys: [TypeRef] = ~[];
|
||||
for f: ty::field in fields {
|
||||
@ -1255,18 +1252,7 @@ fn make_copy_glue(cx: &@block_ctxt, v: ValueRef, t: &ty::t) {
|
||||
|
||||
let bcx;
|
||||
|
||||
if ty::type_is_task(bcx_tcx(cx), t) {
|
||||
let task_ptr = cx.build.Load(v);
|
||||
cx.build.Call(bcx_ccx(cx).upcalls.take_task,
|
||||
~[cx.fcx.lltaskptr, task_ptr]);
|
||||
bcx = cx;
|
||||
} else if ty::type_is_chan(bcx_tcx(cx), t) {
|
||||
let ptr = cx.build.Load(v);
|
||||
ptr = cx.build.PointerCast(ptr, T_opaque_chan_ptr());
|
||||
cx.build.Call(bcx_ccx(cx).upcalls.take_chan,
|
||||
~[cx.fcx.lltaskptr, ptr]);
|
||||
bcx = cx;
|
||||
} else if ty::type_is_boxed(bcx_tcx(cx), t) {
|
||||
if ty::type_is_boxed(bcx_tcx(cx), t) {
|
||||
bcx = incr_refcnt_of_boxed(cx, cx.build.Load(v)).bcx;
|
||||
} else if (ty::type_is_structural(bcx_tcx(cx), t)) {
|
||||
bcx = duplicate_heap_parts_if_necessary(cx, v, t).bcx;
|
||||
@ -1342,21 +1328,6 @@ fn make_free_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
|
||||
ty::ty_uniq(_) {
|
||||
fail "free uniq unimplemented";
|
||||
}
|
||||
ty::ty_port(_) {
|
||||
let v = cx.build.Load(v0);
|
||||
cx.build.Call(bcx_ccx(cx).upcalls.del_port,
|
||||
~[cx.fcx.lltaskptr,
|
||||
cx.build.PointerCast(v, T_opaque_port_ptr())]);
|
||||
rslt(cx, C_int(0))
|
||||
}
|
||||
ty::ty_chan(_) {
|
||||
let v = cx.build.Load(v0);
|
||||
cx.build.Call(bcx_ccx(cx).upcalls.del_chan,
|
||||
~[cx.fcx.lltaskptr,
|
||||
cx.build.PointerCast(v, T_opaque_chan_ptr())]);
|
||||
rslt(cx, C_int(0))
|
||||
}
|
||||
ty::ty_task. { rslt(cx, C_nil()) }
|
||||
ty::ty_obj(_) {
|
||||
let box_cell =
|
||||
cx.build.GEP(v0, ~[C_int(0), C_int(abi::obj_field_box)]);
|
||||
@ -1450,20 +1421,6 @@ fn make_drop_glue(cx: &@block_ctxt, v0: ValueRef, t: &ty::t) {
|
||||
}
|
||||
ty::ty_box(_) { decr_refcnt_maybe_free(cx, v0, v0, t) }
|
||||
ty::ty_uniq(_) { fail "drop uniq unimplemented"; }
|
||||
ty::ty_port(_) { decr_refcnt_maybe_free(cx, v0, v0, t) }
|
||||
ty::ty_chan(_) {
|
||||
let ptr = cx.build.Load(v0);
|
||||
ptr = cx.build.PointerCast(ptr, T_opaque_chan_ptr());
|
||||
{bcx: cx,
|
||||
val: cx.build.Call(bcx_ccx(cx).upcalls.drop_chan,
|
||||
~[cx.fcx.lltaskptr, ptr])}
|
||||
}
|
||||
ty::ty_task. {
|
||||
let task_ptr = cx.build.Load(v0);
|
||||
{bcx: cx,
|
||||
val: cx.build.Call(bcx_ccx(cx).upcalls.drop_task,
|
||||
~[cx.fcx.lltaskptr, task_ptr])}
|
||||
}
|
||||
ty::ty_obj(_) {
|
||||
let box_cell =
|
||||
cx.build.GEP(v0, ~[C_int(0), C_int(abi::obj_field_box)]);
|
||||
|
@ -356,13 +356,6 @@ fn find_pre_post_expr(fcx: &fn_ctxt, e: @expr) {
|
||||
_ { }
|
||||
}
|
||||
}
|
||||
expr_spawn(_, _, operator, operands) {
|
||||
let /* copy */args = operands;
|
||||
args += ~[operator];
|
||||
find_pre_post_exprs(fcx, args, e.id);
|
||||
forget_args_moved_in(fcx, e, callee_modes(fcx, operator.id),
|
||||
operands);
|
||||
}
|
||||
expr_vec(args, _, _) { find_pre_post_exprs(fcx, args, e.id); }
|
||||
expr_path(p) {
|
||||
let rslt = expr_pp(fcx.ccx, e);
|
||||
@ -374,10 +367,6 @@ fn find_pre_post_expr(fcx: &fn_ctxt, e: @expr) {
|
||||
find_pre_post_expr(fcx, arg);
|
||||
copy_pre_post(fcx.ccx, e.id, arg);
|
||||
}
|
||||
expr_chan(arg) {
|
||||
find_pre_post_expr(fcx, arg);
|
||||
copy_pre_post(fcx.ccx, e.id, arg);
|
||||
}
|
||||
expr_put(opt) {
|
||||
alt opt {
|
||||
some(arg) {
|
||||
@ -413,10 +402,6 @@ fn find_pre_post_expr(fcx: &fn_ctxt, e: @expr) {
|
||||
expr_move(lhs, rhs) { handle_update(fcx, e, lhs, rhs, oper_move); }
|
||||
expr_swap(lhs, rhs) { handle_update(fcx, e, lhs, rhs, oper_swap); }
|
||||
expr_assign(lhs, rhs) { handle_update(fcx, e, lhs, rhs, oper_assign); }
|
||||
expr_recv(lhs, rhs) {
|
||||
// note inversion of lhs and rhs
|
||||
handle_update(fcx, e, rhs, lhs, oper_assign);
|
||||
}
|
||||
expr_assign_op(_, lhs, rhs) {
|
||||
/* Different from expr_assign in that the lhs *must*
|
||||
already be initialized */
|
||||
@ -460,7 +445,6 @@ fn find_pre_post_expr(fcx: &fn_ctxt, e: @expr) {
|
||||
expr_postcond(fcx.ccx, l));
|
||||
} else { find_pre_post_exprs(fcx, ~[l, r], e.id); }
|
||||
}
|
||||
expr_send(l, r) { find_pre_post_exprs(fcx, ~[l, r], e.id); }
|
||||
expr_unary(_, operand) {
|
||||
find_pre_post_expr(fcx, operand);
|
||||
copy_pre_post(fcx.ccx, e.id, operand);
|
||||
@ -585,7 +569,6 @@ fn find_pre_post_expr(fcx: &fn_ctxt, e: @expr) {
|
||||
}
|
||||
expr_break. { clear_pp(expr_pp(fcx.ccx, e)); }
|
||||
expr_cont. { clear_pp(expr_pp(fcx.ccx, e)); }
|
||||
expr_port(_) { clear_pp(expr_pp(fcx.ccx, e)); }
|
||||
expr_mac(_) { fcx.ccx.tcx.sess.bug("unexpanded macro"); }
|
||||
expr_anon_obj(anon_obj) {
|
||||
alt anon_obj.inner_obj {
|
||||
|
@ -323,11 +323,6 @@ fn find_pre_post_state_expr(fcx: &fn_ctxt, pres: &prestate, e: @expr) ->
|
||||
operands,
|
||||
controlflow_expr(fcx.ccx, operator));
|
||||
}
|
||||
expr_spawn(_, _, operator, operands) {
|
||||
ret find_pre_post_state_call(fcx, pres, operator, e.id,
|
||||
callee_arg_init_ops(fcx, operator.id),
|
||||
operands, return);
|
||||
}
|
||||
expr_bind(operator, maybe_args) {
|
||||
let args = ~[];
|
||||
let callee_ops = callee_arg_init_ops(fcx, operator.id);
|
||||
@ -350,9 +345,6 @@ fn find_pre_post_state_expr(fcx: &fn_ctxt, pres: &prestate, e: @expr) ->
|
||||
expr_log(_, ex) {
|
||||
ret find_pre_post_state_sub(fcx, pres, ex, e.id, none);
|
||||
}
|
||||
expr_chan(ex) {
|
||||
ret find_pre_post_state_sub(fcx, pres, ex, e.id, none);
|
||||
}
|
||||
expr_mac(_) { fcx.ccx.tcx.sess.bug("unexpanded macro"); }
|
||||
expr_put(maybe_e) {
|
||||
alt maybe_e {
|
||||
@ -407,19 +399,6 @@ fn find_pre_post_state_expr(fcx: &fn_ctxt, pres: &prestate, e: @expr) ->
|
||||
// Could be more precise and actually swap the role of
|
||||
// lhs and rhs in constraints
|
||||
}
|
||||
expr_recv(lhs, rhs) {
|
||||
// Opposite order as most other binary operations,
|
||||
// so not using find_pre_post_state_two
|
||||
let changed =
|
||||
set_prestate_ann(fcx.ccx, e.id, pres) |
|
||||
find_pre_post_state_expr(fcx, pres, lhs) |
|
||||
find_pre_post_state_expr(fcx, expr_poststate(fcx.ccx, lhs),
|
||||
rhs);
|
||||
let post = tritv_clone(expr_poststate(fcx.ccx, rhs));
|
||||
forget_in_poststate_still_init(fcx, post, rhs.id);
|
||||
gen_if_local(fcx, post, rhs);
|
||||
ret changed | set_poststate_ann(fcx.ccx, e.id, post);
|
||||
}
|
||||
expr_ret(maybe_ret_val) {
|
||||
let changed = set_prestate_ann(fcx.ccx, e.id, pres);
|
||||
/* normally, everything is true if execution continues after
|
||||
@ -467,9 +446,6 @@ fn find_pre_post_state_expr(fcx: &fn_ctxt, pres: &prestate, e: @expr) ->
|
||||
ret find_pre_post_state_two(fcx, pres, l, r, e.id, oper_pure);
|
||||
}
|
||||
}
|
||||
expr_send(l, r) {
|
||||
ret find_pre_post_state_two(fcx, pres, l, r, e.id, oper_pure);
|
||||
}
|
||||
expr_assign_op(op, lhs, rhs) {
|
||||
ret find_pre_post_state_two(fcx, pres, lhs, rhs, e.id,
|
||||
oper_assign_op);
|
||||
@ -615,7 +591,6 @@ fn find_pre_post_state_expr(fcx: &fn_ctxt, pres: &prestate, e: @expr) ->
|
||||
}
|
||||
expr_break. { ret pure_exp(fcx.ccx, e.id, pres); }
|
||||
expr_cont. { ret pure_exp(fcx.ccx, e.id, pres); }
|
||||
expr_port(_) { ret pure_exp(fcx.ccx, e.id, pres); }
|
||||
expr_self_method(_) { ret pure_exp(fcx.ccx, e.id, pres); }
|
||||
expr_anon_obj(anon_obj) {
|
||||
alt anon_obj.inner_obj {
|
||||
|
@ -62,7 +62,6 @@ export method_ty_to_fn_ty;
|
||||
export mk_bool;
|
||||
export mk_bot;
|
||||
export mk_box;
|
||||
export mk_chan;
|
||||
export mk_char;
|
||||
export mk_constr;
|
||||
export mk_ctxt;
|
||||
@ -81,12 +80,10 @@ export mk_nil;
|
||||
export mk_obj;
|
||||
export mk_res;
|
||||
export mk_param;
|
||||
export mk_port;
|
||||
export mk_ptr;
|
||||
export mk_rec;
|
||||
export mk_str;
|
||||
export mk_tag;
|
||||
export mk_task;
|
||||
export mk_tup;
|
||||
export mk_type;
|
||||
export mk_uint;
|
||||
@ -123,7 +120,6 @@ export ty_native_fn;
|
||||
export ty_bool;
|
||||
export ty_bot;
|
||||
export ty_box;
|
||||
export ty_chan;
|
||||
export ty_char;
|
||||
export ty_constr;
|
||||
export ty_constr_arg;
|
||||
@ -141,12 +137,10 @@ export ty_nil;
|
||||
export ty_obj;
|
||||
export ty_res;
|
||||
export ty_param;
|
||||
export ty_port;
|
||||
export ty_ptr;
|
||||
export ty_rec;
|
||||
export ty_str;
|
||||
export ty_tag;
|
||||
export ty_task;
|
||||
export ty_tup;
|
||||
export ty_type;
|
||||
export ty_uint;
|
||||
@ -169,8 +163,6 @@ export type_is_bool;
|
||||
export type_is_bot;
|
||||
export type_is_box;
|
||||
export type_is_boxed;
|
||||
export type_is_chan;
|
||||
export type_is_task;
|
||||
export type_is_fp;
|
||||
export type_is_integral;
|
||||
export type_is_native;
|
||||
@ -273,9 +265,6 @@ tag sty {
|
||||
ty_vec(mt);
|
||||
ty_ivec(mt);
|
||||
ty_ptr(mt);
|
||||
ty_port(t);
|
||||
ty_chan(t);
|
||||
ty_task;
|
||||
ty_rec([field]);
|
||||
ty_fn(ast::proto, [arg], t, controlflow, [@constr]);
|
||||
ty_native_fn(ast::native_abi, [arg], t);
|
||||
@ -356,13 +345,11 @@ const idx_str: uint = 16u;
|
||||
|
||||
const idx_istr: uint = 17u;
|
||||
|
||||
const idx_task: uint = 18u;
|
||||
const idx_type: uint = 18u;
|
||||
|
||||
const idx_type: uint = 19u;
|
||||
const idx_bot: uint = 19u;
|
||||
|
||||
const idx_bot: uint = 20u;
|
||||
|
||||
const idx_first_others: uint = 21u;
|
||||
const idx_first_others: uint = 20u;
|
||||
|
||||
type type_store = interner::interner[@raw_t];
|
||||
|
||||
@ -390,7 +377,6 @@ fn populate_type_store(cx: &ctxt) {
|
||||
intern(cx, ty_char, none);
|
||||
intern(cx, ty_str, none);
|
||||
intern(cx, ty_istr, none);
|
||||
intern(cx, ty_task, none);
|
||||
intern(cx, ty_type, none);
|
||||
intern(cx, ty_bot, none);
|
||||
assert (vec::len(cx.ts.vect) == idx_first_others);
|
||||
@ -469,7 +455,6 @@ fn mk_raw_ty(cx: &ctxt, st: &sty, in_cname: &option::t[str]) -> @raw_t {
|
||||
ty_char. {/* no-op */ }
|
||||
ty_str. {/* no-op */ }
|
||||
ty_istr. {/* no-op */ }
|
||||
ty_task. {/* no-op */ }
|
||||
ty_type. {/* no-op */ }
|
||||
ty_native(_) {/* no-op */ }
|
||||
ty_param(_,_) { has_params = true; }
|
||||
@ -482,8 +467,6 @@ fn mk_raw_ty(cx: &ctxt, st: &sty, in_cname: &option::t[str]) -> @raw_t {
|
||||
ty_vec(m) { derive_flags_mt(cx, has_params, has_vars, m); }
|
||||
ty_ivec(m) { derive_flags_mt(cx, has_params, has_vars, m); }
|
||||
ty_ptr(m) { derive_flags_mt(cx, has_params, has_vars, m); }
|
||||
ty_port(tt) { derive_flags_t(cx, has_params, has_vars, tt); }
|
||||
ty_chan(tt) { derive_flags_t(cx, has_params, has_vars, tt); }
|
||||
ty_rec(flds) {
|
||||
for f: field in flds {
|
||||
derive_flags_mt(cx, has_params, has_vars, f.mt);
|
||||
@ -591,12 +574,6 @@ fn mk_imm_vec(cx: &ctxt, typ: &t) -> t {
|
||||
ret gen_ty(cx, ty_vec({ty: typ, mut: ast::imm}));
|
||||
}
|
||||
|
||||
fn mk_port(cx: &ctxt, ty: &t) -> t { ret gen_ty(cx, ty_port(ty)); }
|
||||
|
||||
fn mk_chan(cx: &ctxt, ty: &t) -> t { ret gen_ty(cx, ty_chan(ty)); }
|
||||
|
||||
fn mk_task(cx: &ctxt) -> t { ret gen_ty(cx, ty_task); }
|
||||
|
||||
fn mk_rec(cx: &ctxt, fs: &[field]) -> t { ret gen_ty(cx, ty_rec(fs)); }
|
||||
|
||||
fn mk_constr(cx: &ctxt, t: &t, cs: &[@type_constr]) -> t {
|
||||
@ -664,14 +641,11 @@ fn walk_ty(cx: &ctxt, walker: ty_walk, ty: t) {
|
||||
ty_str. {/* no-op */ }
|
||||
ty_istr. {/* no-op */ }
|
||||
ty_type. {/* no-op */ }
|
||||
ty_task. {/* no-op */ }
|
||||
ty_native(_) {/* no-op */ }
|
||||
ty_box(tm) { walk_ty(cx, walker, tm.ty); }
|
||||
ty_vec(tm) { walk_ty(cx, walker, tm.ty); }
|
||||
ty_ivec(tm) { walk_ty(cx, walker, tm.ty); }
|
||||
ty_ptr(tm) { walk_ty(cx, walker, tm.ty); }
|
||||
ty_port(subty) { walk_ty(cx, walker, subty); }
|
||||
ty_chan(subty) { walk_ty(cx, walker, subty); }
|
||||
ty_tag(tid, subtys) {
|
||||
for subty: t in subtys { walk_ty(cx, walker, subty); }
|
||||
}
|
||||
@ -737,7 +711,6 @@ fn fold_ty(cx: &ctxt, fld: fold_mode, ty_0: t) -> t {
|
||||
ty_istr. {/* no-op */ }
|
||||
ty_type. {/* no-op */ }
|
||||
ty_native(_) {/* no-op */ }
|
||||
ty_task. {/* no-op */ }
|
||||
ty_box(tm) {
|
||||
ty = mk_box(cx, {ty: fold_ty(cx, fld, tm.ty), mut: tm.mut});
|
||||
}
|
||||
@ -751,8 +724,6 @@ fn fold_ty(cx: &ctxt, fld: fold_mode, ty_0: t) -> t {
|
||||
ty_ivec(tm) {
|
||||
ty = mk_ivec(cx, {ty: fold_ty(cx, fld, tm.ty), mut: tm.mut});
|
||||
}
|
||||
ty_port(subty) { ty = mk_port(cx, fold_ty(cx, fld, subty)); }
|
||||
ty_chan(subty) { ty = mk_chan(cx, fold_ty(cx, fld, subty)); }
|
||||
ty_tag(tid, subtys) {
|
||||
let new_subtys: [t] = ~[];
|
||||
for subty: t in subtys { new_subtys += ~[fold_ty(cx, fld, subty)]; }
|
||||
@ -862,14 +833,6 @@ fn type_is_bool(cx: &ctxt, ty: &t) -> bool {
|
||||
alt struct(cx, ty) { ty_bool. { ret true; } _ { ret false; } }
|
||||
}
|
||||
|
||||
fn type_is_chan(cx: &ctxt, ty: &t) -> bool {
|
||||
alt struct(cx, ty) { ty_chan(_) { ret true; } _ { ret false; } }
|
||||
}
|
||||
|
||||
fn type_is_task(cx: &ctxt, ty: &t) -> bool {
|
||||
alt struct(cx, ty) { ty_task. { ret true; } _ { ret false; } }
|
||||
}
|
||||
|
||||
fn type_is_structural(cx: &ctxt, ty: &t) -> bool {
|
||||
alt struct(cx, ty) {
|
||||
ty_rec(_) { ret true; }
|
||||
@ -967,9 +930,6 @@ fn type_is_boxed(cx: &ctxt, ty: &t) -> bool {
|
||||
ty_str. { ret true; }
|
||||
ty_vec(_) { ret true; }
|
||||
ty_box(_) { ret true; }
|
||||
ty_port(_) { ret true; }
|
||||
ty_chan(_) { ret true; }
|
||||
ty_task. { ret true; }
|
||||
_ { ret false; }
|
||||
}
|
||||
}
|
||||
@ -1083,7 +1043,7 @@ fn type_kind(cx: &ctxt, ty: &t) -> ast::kind {
|
||||
}
|
||||
|
||||
// Those things with refcounts-to-interior are just shared.
|
||||
ty_str. | ty_task. {
|
||||
ty_str. {
|
||||
result = kind_shared;
|
||||
}
|
||||
|
||||
@ -1107,18 +1067,6 @@ fn type_kind(cx: &ctxt, ty: &t) -> ast::kind {
|
||||
result = ast::kind_shared;
|
||||
}
|
||||
|
||||
// FIXME: remove ports. Ports currently contribute 'shared'
|
||||
ty_port(t) {
|
||||
result = kind::lower_kind(ast::kind_shared,
|
||||
type_kind(cx, t));
|
||||
}
|
||||
|
||||
// FIXME: remove chans. Chans currently contribute only
|
||||
// their inner.
|
||||
ty_chan(t) {
|
||||
result = type_kind(cx, t);
|
||||
}
|
||||
|
||||
// Pointers and unique boxes / vecs raise pinned to shared,
|
||||
// otherwise pass through their pointee kind.
|
||||
ty_ptr(tm) | ty_ivec(tm) {
|
||||
@ -1205,9 +1153,6 @@ fn type_has_dynamic_size(cx: &ctxt, ty: &t) -> bool {
|
||||
ty_vec(_) { ret false; }
|
||||
ty_ivec(mt) { ret type_has_dynamic_size(cx, mt.ty); }
|
||||
ty_ptr(_) { ret false; }
|
||||
ty_port(_) { ret false; }
|
||||
ty_chan(_) { ret false; }
|
||||
ty_task. { ret false; }
|
||||
ty_rec(fields) {
|
||||
let i = 0u;
|
||||
while i < vec::len[field](fields) {
|
||||
@ -1357,9 +1302,6 @@ fn type_owns_heap_mem(cx: &ctxt, ty: &t) -> bool {
|
||||
ty_ptr(_) {
|
||||
result = false;
|
||||
}
|
||||
ty_port(_) { result = false; }
|
||||
ty_chan(_) { result = false; }
|
||||
ty_task. { result = false; }
|
||||
ty_var(_) { fail "ty_var in type_owns_heap_mem"; }
|
||||
ty_param(_,_) { result = false; }
|
||||
}
|
||||
@ -1380,8 +1322,7 @@ fn type_is_pod(cx : &ctxt, ty : &t) -> bool {
|
||||
|
||||
// Boxed types
|
||||
ty_str. | ty_istr. | ty_box(_) | ty_vec(_) | ty_ivec(_) |
|
||||
ty_fn(_,_,_,_,_) | ty_native_fn(_,_,_) | ty_obj(_) | ty_port(_) |
|
||||
ty_chan(_) | ty_task. { result = false; }
|
||||
ty_fn(_,_,_,_,_) | ty_native_fn(_,_,_) | ty_obj(_) { result = false; }
|
||||
|
||||
// Structural types
|
||||
ty_tag(did, tps) {
|
||||
@ -1545,9 +1486,6 @@ fn hash_type_structure(st: &sty) -> uint {
|
||||
ty_box(mt) { ret hash_subty(19u, mt.ty); }
|
||||
ty_vec(mt) { ret hash_subty(20u, mt.ty); }
|
||||
ty_ivec(mt) { ret hash_subty(21u, mt.ty); }
|
||||
ty_port(typ) { ret hash_subty(22u, typ); }
|
||||
ty_chan(typ) { ret hash_subty(23u, typ); }
|
||||
ty_task. { ret 24u; }
|
||||
ty_rec(fields) {
|
||||
let h = 26u;
|
||||
for f: field in fields { h += h << 5u + hash_ty(f.mt.ty); }
|
||||
@ -1717,13 +1655,6 @@ fn equal_type_structures(a: &sty, b: &sty) -> bool {
|
||||
ty_ptr(mt_a) {
|
||||
alt b { ty_ptr(mt_b) { ret equal_mt(mt_a, mt_b); } _ { ret false; } }
|
||||
}
|
||||
ty_port(t_a) {
|
||||
alt b { ty_port(t_b) { ret eq_ty(t_a, t_b); } _ { ret false; } }
|
||||
}
|
||||
ty_chan(t_a) {
|
||||
alt b { ty_chan(t_b) { ret eq_ty(t_a, t_b); } _ { ret false; } }
|
||||
}
|
||||
ty_task. { alt b { ty_task. { ret true; } _ { ret false; } } }
|
||||
ty_rec(flds_a) {
|
||||
alt b {
|
||||
ty_rec(flds_b) {
|
||||
@ -2626,20 +2557,6 @@ mod unify {
|
||||
_ { ret ures_err(terr_mismatch); }
|
||||
}
|
||||
}
|
||||
ty::ty_port(expected_sub) {
|
||||
alt struct(cx.tcx, actual) {
|
||||
ty::ty_port(actual_sub) {
|
||||
let result = unify_step(cx, expected_sub, actual_sub);
|
||||
alt result {
|
||||
ures_ok(result_sub) {
|
||||
ret ures_ok(mk_port(cx.tcx, result_sub));
|
||||
}
|
||||
_ { ret result; }
|
||||
}
|
||||
}
|
||||
_ { ret ures_err(terr_mismatch); }
|
||||
}
|
||||
}
|
||||
ty::ty_res(ex_id, ex_inner, ex_tps) {
|
||||
alt struct(cx.tcx, actual) {
|
||||
ty::ty_res(act_id, act_inner, act_tps) {
|
||||
@ -2667,20 +2584,6 @@ mod unify {
|
||||
_ { ret ures_err(terr_mismatch); }
|
||||
}
|
||||
}
|
||||
ty::ty_chan(expected_sub) {
|
||||
alt struct(cx.tcx, actual) {
|
||||
ty::ty_chan(actual_sub) {
|
||||
let result = unify_step(cx, expected_sub, actual_sub);
|
||||
alt result {
|
||||
ures_ok(result_sub) {
|
||||
ret ures_ok(mk_chan(cx.tcx, result_sub));
|
||||
}
|
||||
_ { ret result; }
|
||||
}
|
||||
}
|
||||
_ { ret ures_err(terr_mismatch); }
|
||||
}
|
||||
}
|
||||
ty::ty_rec(expected_fields) {
|
||||
alt struct(cx.tcx, actual) {
|
||||
ty::ty_rec(actual_fields) {
|
||||
|
@ -333,13 +333,6 @@ fn ast_ty_to_ty(tcx: &ty::ctxt, getter: &ty_getter, ast_ty: &@ast::ty) ->
|
||||
ast::ty_ptr(mt) {
|
||||
typ = ty::mk_ptr(tcx, ast_mt_to_mt(tcx, getter, mt));
|
||||
}
|
||||
ast::ty_task. { typ = ty::mk_task(tcx); }
|
||||
ast::ty_port(t) {
|
||||
typ = ty::mk_port(tcx, ast_ty_to_ty(tcx, getter, t));
|
||||
}
|
||||
ast::ty_chan(t) {
|
||||
typ = ty::mk_chan(tcx, ast_ty_to_ty(tcx, getter, t));
|
||||
}
|
||||
ast::ty_tup(fields) {
|
||||
let flds = vec::map(bind ast_ty_to_ty(tcx, getter, _), fields);
|
||||
typ = ty::mk_tup(tcx, flds);
|
||||
@ -1984,22 +1977,6 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
||||
check_binop_type_compat(fcx, expr.span, expr_ty(tcx, lhs),
|
||||
op);
|
||||
}
|
||||
ast::expr_send(lhs, rhs) {
|
||||
require_impure(tcx.sess, fcx.purity, expr.span);
|
||||
let rhs_t = next_ty_var(fcx);
|
||||
let chan_t = ty::mk_chan(tcx, rhs_t);
|
||||
bot = check_expr_with(fcx, lhs, chan_t) |
|
||||
check_expr_with(fcx, rhs, rhs_t);
|
||||
write::ty_only_fixup(fcx, id, chan_t);
|
||||
}
|
||||
ast::expr_recv(lhs, rhs) {
|
||||
require_impure(tcx.sess, fcx.purity, expr.span);
|
||||
let rhs_t = next_ty_var(fcx);
|
||||
let port_t = ty::mk_port(tcx, rhs_t);
|
||||
bot = check_expr_with(fcx, lhs, port_t) |
|
||||
check_expr_with(fcx, rhs, rhs_t);
|
||||
write::ty_only_fixup(fcx, id, rhs_t);
|
||||
}
|
||||
ast::expr_if(cond, thn, elsopt) {
|
||||
bot = check_expr_with(fcx, cond, ty::mk_bool(tcx)) |
|
||||
check_then_else(fcx, thn, elsopt, id, expr.span);
|
||||
@ -2187,28 +2164,6 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
||||
write::ty_only_fixup(fcx, id, t);
|
||||
require_impure(tcx.sess, fcx.purity, expr.span);
|
||||
}
|
||||
ast::expr_spawn(_, _, f, args) {
|
||||
bot = check_call(fcx, expr.span, f, args, kind_spawn);
|
||||
let fty = expr_ty(tcx, f);
|
||||
let ret_ty = alt structure_of(fcx, expr.span, fty) {
|
||||
ty::ty_fn(_, _, rt, _, _) { rt }
|
||||
ty::ty_native_fn(_, _, rt) { rt }
|
||||
_ { fail "LHS of spawn expr didn't have a function type?!" }
|
||||
};
|
||||
|
||||
demand::simple(fcx, f.span, ty::mk_nil(tcx), ret_ty);
|
||||
|
||||
// make sure they aren't spawning a function with type params
|
||||
if ty::expr_has_ty_params(tcx, f) {
|
||||
tcx.sess.span_fatal(
|
||||
f.span,
|
||||
"spawning functions with type params not allowed (for now)");
|
||||
}
|
||||
|
||||
// FIXME: Other typechecks needed
|
||||
let typ = ty::mk_task(tcx);
|
||||
write::ty_only_fixup(fcx, id, typ);
|
||||
}
|
||||
ast::expr_cast(e, t) {
|
||||
bot = check_expr(fcx, e);
|
||||
let t_1 = ast_ty_to_ty_crate(fcx.ccx, t);
|
||||
@ -2360,15 +2315,6 @@ fn check_expr_with_unifier(fcx: &@fn_ctxt, expr: &@ast::expr,
|
||||
}
|
||||
}
|
||||
}
|
||||
ast::expr_port(typ) {
|
||||
let pt = ty::mk_port(tcx, ast_ty_to_ty_crate_tyvar(fcx, typ));
|
||||
write::ty_only_fixup(fcx, id, pt);
|
||||
}
|
||||
ast::expr_chan(x) {
|
||||
let t = next_ty_var(fcx);
|
||||
check_expr_with(fcx, x, ty::mk_port(tcx, t));
|
||||
write::ty_only_fixup(fcx, id, ty::mk_chan(tcx, t));
|
||||
}
|
||||
ast::expr_anon_obj(ao) {
|
||||
let fields: [ast::anon_obj_field] = ~[];
|
||||
alt ao.fields { none. { } some(v) { fields = v; } }
|
||||
|
@ -298,7 +298,6 @@ tag expr_ {
|
||||
expr_tup([@expr]);
|
||||
expr_self_method(ident);
|
||||
expr_bind(@expr, [option::t[@expr]]);
|
||||
expr_spawn(spawn_dom, option::t[str], @expr, [@expr]);
|
||||
expr_binary(binop, @expr, @expr);
|
||||
expr_unary(unop, @expr);
|
||||
expr_lit(@lit);
|
||||
@ -321,8 +320,6 @@ tag expr_ {
|
||||
expr_assign(@expr, @expr);
|
||||
expr_swap(@expr, @expr);
|
||||
expr_assign_op(binop, @expr, @expr);
|
||||
expr_send(@expr, @expr);
|
||||
expr_recv(@expr, @expr);
|
||||
expr_field(@expr, ident);
|
||||
expr_index(@expr, @expr);
|
||||
expr_path(path);
|
||||
@ -340,8 +337,6 @@ tag expr_ {
|
||||
/* FIXME Would be nice if expr_check desugared
|
||||
to expr_if_check. */
|
||||
expr_if_check(@expr, blk, option::t[@expr]);
|
||||
expr_port(@ty);
|
||||
expr_chan(@expr);
|
||||
expr_anon_obj(anon_obj);
|
||||
expr_mac(mac);
|
||||
expr_uniq(@expr);
|
||||
|
@ -357,10 +357,6 @@ fn noop_fold_expr(e: &expr_, fld: ast_fold) -> expr_ {
|
||||
let opt_map_se = bind option::map(fld.fold_expr, _);
|
||||
expr_bind(fld.fold_expr(f), vec::map(opt_map_se, args))
|
||||
}
|
||||
expr_spawn(spawn_dom, name, f, args) {
|
||||
expr_spawn(spawn_dom, name, fld.fold_expr(f),
|
||||
fld.map_exprs(fld.fold_expr, args))
|
||||
}
|
||||
expr_binary(binop, lhs, rhs) {
|
||||
expr_binary(binop, fld.fold_expr(lhs), fld.fold_expr(rhs))
|
||||
}
|
||||
@ -409,12 +405,6 @@ fn noop_fold_expr(e: &expr_, fld: ast_fold) -> expr_ {
|
||||
expr_assign_op(op, el, er) {
|
||||
expr_assign_op(op, fld.fold_expr(el), fld.fold_expr(er))
|
||||
}
|
||||
expr_send(el, er) {
|
||||
expr_send(fld.fold_expr(el), fld.fold_expr(er))
|
||||
}
|
||||
expr_recv(el, er) {
|
||||
expr_recv(fld.fold_expr(el), fld.fold_expr(er))
|
||||
}
|
||||
expr_field(el, id) {
|
||||
expr_field(fld.fold_expr(el), fld.fold_ident(id))
|
||||
}
|
||||
@ -435,10 +425,6 @@ fn noop_fold_expr(e: &expr_, fld: ast_fold) -> expr_ {
|
||||
expr_if_check(fld.fold_expr(cond), fld.fold_block(tr),
|
||||
option::map(fld.fold_expr, fl))
|
||||
}
|
||||
expr_port(t) {
|
||||
expr_port(fld.fold_ty(t))
|
||||
}
|
||||
expr_chan(e) { expr_chan(fld.fold_expr(e)) }
|
||||
expr_anon_obj(ao) { expr_anon_obj(fold_anon_obj(ao)) }
|
||||
expr_mac(mac) { expr_mac(fold_mac(mac)) }
|
||||
expr_uniq(e) { expr_uniq(fld.fold_expr(e)) }
|
||||
|
@ -1351,21 +1351,6 @@ fn parse_alt_expr(p: &parser) -> @ast::expr {
|
||||
ret mk_expr(p, lo, hi, ast::expr_alt(discriminant, arms));
|
||||
}
|
||||
|
||||
fn parse_spawn_expr(p: &parser) -> @ast::expr {
|
||||
let lo = p.get_last_lo_pos();
|
||||
// FIXME: Parse domain and name
|
||||
// FIXME: why no full expr?
|
||||
|
||||
let fn_expr = parse_bottom_expr(p);
|
||||
let es =
|
||||
parse_seq(token::LPAREN, token::RPAREN, some(token::COMMA),
|
||||
parse_expr, p);
|
||||
let hi = es.span.hi;
|
||||
ret mk_expr(p, lo, hi,
|
||||
ast::expr_spawn(ast::dom_implicit, option::none, fn_expr,
|
||||
es.node));
|
||||
}
|
||||
|
||||
fn parse_expr(p: &parser) -> @ast::expr {
|
||||
ret parse_expr_res(p, UNRESTRICTED);
|
||||
}
|
||||
@ -1614,7 +1599,6 @@ fn stmt_ends_with_semi(stmt: &ast::stmt) -> bool {
|
||||
ast::expr_call(_, _) { true }
|
||||
ast::expr_self_method(_) { false }
|
||||
ast::expr_bind(_, _) { true }
|
||||
ast::expr_spawn(_, _, _, _) { true }
|
||||
ast::expr_binary(_, _, _) { true }
|
||||
ast::expr_unary(_, _) { true }
|
||||
ast::expr_lit(_) { true }
|
||||
@ -1632,8 +1616,6 @@ fn stmt_ends_with_semi(stmt: &ast::stmt) -> bool {
|
||||
ast::expr_assign(_, _) { true }
|
||||
ast::expr_swap(_, _) { true }
|
||||
ast::expr_assign_op(_, _, _) { true }
|
||||
ast::expr_send(_, _) { true }
|
||||
ast::expr_recv(_, _) { true }
|
||||
ast::expr_field(_, _) { true }
|
||||
ast::expr_index(_, _) { true }
|
||||
ast::expr_path(_) { true }
|
||||
@ -1647,8 +1629,6 @@ fn stmt_ends_with_semi(stmt: &ast::stmt) -> bool {
|
||||
ast::expr_log(_, _) { true }
|
||||
ast::expr_check(_, _) { true }
|
||||
ast::expr_if_check(_, _, _) { false }
|
||||
ast::expr_port(_) { true }
|
||||
ast::expr_chan(_) { true }
|
||||
ast::expr_anon_obj(_) { false }
|
||||
ast::expr_assert(_) { true }
|
||||
}
|
||||
|
@ -783,13 +783,6 @@ fn print_expr(s: &ps, expr: &@ast::expr) {
|
||||
commasep(s, inconsistent, args, print_opt);
|
||||
pclose(s);
|
||||
}
|
||||
ast::expr_spawn(_, _, e, es) {
|
||||
word_nbsp(s, "spawn");
|
||||
print_expr(s, e);
|
||||
popen(s);
|
||||
commasep_exprs(s, inconsistent, es);
|
||||
pclose(s);
|
||||
}
|
||||
ast::expr_binary(op, lhs, rhs) {
|
||||
let prec = operator_prec(op);
|
||||
print_maybe_parens(s, lhs, prec);
|
||||
@ -928,18 +921,6 @@ fn print_expr(s: &ps, expr: &@ast::expr) {
|
||||
word_space(s, "=");
|
||||
print_expr(s, rhs);
|
||||
}
|
||||
ast::expr_send(lhs, rhs) {
|
||||
print_expr(s, lhs);
|
||||
space(s.s);
|
||||
word_space(s, "<|");
|
||||
print_expr(s, rhs);
|
||||
}
|
||||
ast::expr_recv(lhs, rhs) {
|
||||
print_expr(s, lhs);
|
||||
space(s.s);
|
||||
word_space(s, "|>");
|
||||
print_expr(s, rhs);
|
||||
}
|
||||
ast::expr_field(expr, id) {
|
||||
print_expr_parens_if_unary(s, expr);
|
||||
word(s.s, ".");
|
||||
@ -997,21 +978,6 @@ fn print_expr(s: &ps, expr: &@ast::expr) {
|
||||
pclose(s);
|
||||
}
|
||||
ast::expr_mac(m) { print_mac(s, m); }
|
||||
ast::expr_port(t) {
|
||||
word(s.s, "port");
|
||||
alt t.node {
|
||||
ast::ty_infer. { }
|
||||
_ { word(s.s, "["); print_type(s, t); word(s.s, "]"); }
|
||||
}
|
||||
popen(s);
|
||||
pclose(s);
|
||||
}
|
||||
ast::expr_chan(expr) {
|
||||
word(s.s, "chan");
|
||||
popen(s);
|
||||
print_expr(s, expr);
|
||||
pclose(s);
|
||||
}
|
||||
ast::expr_anon_obj(anon_obj) {
|
||||
head(s, "obj");
|
||||
|
||||
|
@ -262,10 +262,6 @@ fn visit_expr[E](ex: &@expr, e: &E, v: &vt[E]) {
|
||||
v.visit_expr(callee, e, v);
|
||||
for eo: option::t[@expr] in args { visit_expr_opt(eo, e, v); }
|
||||
}
|
||||
expr_spawn(_, _, callee, args) {
|
||||
v.visit_expr(callee, e, v);
|
||||
visit_exprs(args, e, v);
|
||||
}
|
||||
expr_binary(_, a, b) { v.visit_expr(a, e, v); v.visit_expr(b, e, v); }
|
||||
expr_unary(_, a) { v.visit_expr(a, e, v); }
|
||||
expr_lit(_) { }
|
||||
@ -306,8 +302,6 @@ fn visit_expr[E](ex: &@expr, e: &E, v: &vt[E]) {
|
||||
v.visit_expr(b, e, v);
|
||||
v.visit_expr(a, e, v);
|
||||
}
|
||||
expr_send(a, b) { v.visit_expr(a, e, v); v.visit_expr(b, e, v); }
|
||||
expr_recv(a, b) { v.visit_expr(a, e, v); v.visit_expr(b, e, v); }
|
||||
expr_field(x, _) { v.visit_expr(x, e, v); }
|
||||
expr_index(a, b) { v.visit_expr(a, e, v); v.visit_expr(b, e, v); }
|
||||
expr_path(p) { for tp: @ty in p.node.types { v.visit_ty(tp, e, v); } }
|
||||
@ -320,8 +314,6 @@ fn visit_expr[E](ex: &@expr, e: &E, v: &vt[E]) {
|
||||
expr_log(_, x) { v.visit_expr(x, e, v); }
|
||||
expr_check(_, x) { v.visit_expr(x, e, v); }
|
||||
expr_assert(x) { v.visit_expr(x, e, v); }
|
||||
expr_port(t) { v.visit_ty(t, e, v); }
|
||||
expr_chan(x) { v.visit_expr(x, e, v); }
|
||||
expr_anon_obj(anon_obj) {
|
||||
alt anon_obj.fields {
|
||||
none. { }
|
||||
|
@ -94,10 +94,7 @@ fn ty_to_str(cx: &ctxt, typ: &t) -> str {
|
||||
ty_uniq(t) { s += "~" + ty_to_str(cx, t); }
|
||||
ty_vec(tm) { s += "vec[" + mt_to_str(cx, tm) + "]"; }
|
||||
ty_ivec(tm) { s += "[" + mt_to_str(cx, tm) + "]"; }
|
||||
ty_port(t) { s += "port[" + ty_to_str(cx, t) + "]"; }
|
||||
ty_chan(t) { s += "chan[" + ty_to_str(cx, t) + "]"; }
|
||||
ty_type. { s += "type"; }
|
||||
ty_task. { s += "task"; }
|
||||
ty_rec(elems) {
|
||||
let strs: [str] = ~[];
|
||||
for fld: field in elems { strs += ~[field_to_str(cx, fld)]; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user