Skip to content

Commit 555ff7a

Browse files
committed
---
yaml --- r: 6716 b: refs/heads/master c: 1e3259e h: refs/heads/master v: v3
1 parent 777a1f2 commit 555ff7a

File tree

13 files changed

+684
-553
lines changed

13 files changed

+684
-553
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: d381cc072a9c9c0fef605c56ed77d538a49c8ead
2+
refs/heads/master: 1e3259e119b6370267415b9e07f3ea80869f839d

trunk/src/comp/back/abi.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,8 @@ const fn_field_code: int = 0;
7373
const fn_field_box: int = 1;
7474

7575
const closure_elt_tydesc: int = 0;
76-
const closure_elt_bindings: int = 1;
77-
//const closure_elt_n_ty_params: int = 2;
78-
const closure_elt_ty_params: int = 2; // 3;
76+
const closure_elt_ty_params: int = 1;
77+
const closure_elt_bindings: int = 2;
7978

8079
const vec_elt_fill: int = 0;
8180

trunk/src/comp/back/upcall.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ type upcalls =
1717
shared_malloc: ValueRef,
1818
shared_free: ValueRef,
1919
mark: ValueRef,
20-
clone_type_desc: ValueRef,
20+
create_shared_type_desc: ValueRef,
21+
free_shared_type_desc: ValueRef,
2122
get_type_desc: ValueRef,
2223
vec_grow: ValueRef,
2324
vec_push: ValueRef,
@@ -64,9 +65,11 @@ fn declare_upcalls(targ_cfg: @session::config,
6465
dv("shared_free", [T_ptr(T_i8())]),
6566
mark:
6667
d("mark", [T_ptr(T_i8())], int_t),
67-
clone_type_desc:
68-
d("clone_type_desc", [T_ptr(tydesc_type)],
68+
create_shared_type_desc:
69+
d("create_shared_type_desc", [T_ptr(tydesc_type)],
6970
T_ptr(tydesc_type)),
71+
free_shared_type_desc:
72+
dv("free_shared_type_desc", [T_ptr(tydesc_type)]),
7073
get_type_desc:
7174
d("get_type_desc",
7275
[T_ptr(T_nil()), size_t,

trunk/src/comp/middle/shape.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const shape_obj: u8 = 19u8;
5151
const shape_res: u8 = 20u8;
5252
const shape_var: u8 = 21u8;
5353
const shape_uniq: u8 = 22u8;
54+
const shape_opaque_closure: u8 = 23u8; // the closure itself.
5455

5556
// FIXME: This is a bad API in trans_common.
5657
fn C_u8(n: u8) -> ValueRef { ret trans_common::C_u8(n as uint); }
@@ -384,9 +385,6 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint],
384385
}
385386
add_substr(s, sub);
386387
}
387-
ty::ty_fn(_, _, _, _, _) {
388-
s += [shape_fn];
389-
}
390388
ty::ty_native_fn(_, _) { s += [shape_u32]; }
391389
ty::ty_obj(_) { s += [shape_obj]; }
392390
ty::ty_res(did, raw_subt, tps) {
@@ -412,19 +410,18 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t, ty_param_map: [uint],
412410
s += [shape_var, n as u8];
413411
} else {
414412
// Find the type parameter in the parameter list.
415-
let found = false;
416-
let i = 0u;
417-
while i < vec::len(ty_param_map) {
418-
if n == ty_param_map[i] {
419-
s += [shape_var, i as u8];
420-
found = true;
421-
break;
422-
}
423-
i += 1u;
413+
alt vec::position(n, ty_param_map) {
414+
some(i) { s += [shape_var, i as u8]; }
415+
none. { fail "ty param not found in ty_param_map"; }
424416
}
425-
assert (found);
426417
}
427418
}
419+
ty::ty_fn(_, _, _, _, _) {
420+
s += [shape_fn];
421+
}
422+
ty::ty_opaque_closure. {
423+
s += [shape_opaque_closure];
424+
}
428425
}
429426

430427
ret s;

0 commit comments

Comments
 (0)