Skip to content

Commit 9d2e5f3

Browse files
committed
Merge branch 'rt-changes' into incoming
2 parents b9aa9de + a8db1bd commit 9d2e5f3

28 files changed

+116
-204
lines changed

src/libcore/sys.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ export log_str;
1010
export lock_and_signal, condition, methods;
1111

1212
enum type_desc = {
13-
first_param: **libc::c_int,
14-
size: libc::size_t,
15-
align: libc::size_t
13+
size: uint,
14+
align: uint
1615
// Remaining fields not listed
1716
};
1817

src/libstd/arena.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ impl arena for arena {
3131
head = chunk(uint::next_power_of_two(new_min_chunk_size + 1u));
3232
self.chunks = @cons(head, self.chunks);
3333

34-
ret self.alloc(n_bytes, align);
34+
ret self.alloc_inner(n_bytes, align);
3535
}
3636

3737
#[inline(always)]
38-
fn alloc(n_bytes: uint, align: uint) -> *() {
38+
fn alloc_inner(n_bytes: uint, align: uint) -> *() {
3939
let alignm1 = align - 1u;
4040
let mut head = list::head(self.chunks);
4141

@@ -52,5 +52,13 @@ impl arena for arena {
5252
ret unsafe::reinterpret_cast(p);
5353
}
5454
}
55+
56+
#[inline(always)]
57+
fn alloc(tydesc: *()) -> *() {
58+
unsafe {
59+
let tydesc = tydesc as *sys::type_desc;
60+
self.alloc_inner((*tydesc).size, (*tydesc).align)
61+
}
62+
}
5563
}
5664

src/libsyntax/ext/auto_serialize.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,6 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map,
459459
~[]
460460
}
461461

462-
ast::ty_vstore(@{node: ast::ty_vec(mt),_}, ast::vstore_uniq) |
463462
ast::ty_vec(mt) {
464463
let ser_e =
465464
cx.expr(
@@ -477,6 +476,11 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map,
477476
}]
478477
}
479478

479+
// For unique vstores, just pass through to the underlying vec or str
480+
ast::ty_vstore(ty, ast::vstore_uniq) {
481+
ser_ty(cx, tps, ty, s, v)
482+
}
483+
480484
ast::ty_vstore(_, _) {
481485
cx.span_unimpl(ty.span, "serialization for vstore types");
482486
}
@@ -685,12 +689,16 @@ fn deser_ty(cx: ext_ctxt, tps: deser_tps_map,
685689
#ast{ fail }
686690
}
687691

688-
ast::ty_vstore(@{node: ast::ty_vec(mt),_}, ast::vstore_uniq) |
689692
ast::ty_vec(mt) {
690693
let l = deser_lambda(cx, tps, mt.ty, cx.clone(d));
691694
#ast{ std::serialization::read_to_vec($(d), $(l)) }
692695
}
693696

697+
// For unique vstores, just pass through to the underlying vec or str
698+
ast::ty_vstore(ty, ast::vstore_uniq) {
699+
deser_ty(cx, tps, ty, d)
700+
}
701+
694702
ast::ty_vstore(_, _) {
695703
cx.span_unimpl(ty.span, "deserialization for vstore types");
696704
}

src/rt/rust_shape.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,7 @@ log::walk_res2(const rust_fn *dtor, const uint8_t *end_sp) {
484484

485485
extern "C" void
486486
shape_cmp_type(int8_t *result, const type_desc *tydesc,
487-
const type_desc **subtydescs, uint8_t *data_0,
488-
uint8_t *data_1, uint8_t cmp_type) {
487+
uint8_t *data_0, uint8_t *data_1, uint8_t cmp_type) {
489488
rust_task *task = rust_get_current_task();
490489
shape::arena arena;
491490

src/rt/rust_shape.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,6 @@ ctxt<T>::walk_tag0() {
407407
// Determine the size and alignment.
408408
tinfo.tag_sa = get_size_align(tinfo.info_ptr);
409409

410-
// Read in a dummy value; this used to be the number of parameters
411-
uint16_t number_of_params = get_u16_bump(sp);
412-
assert(number_of_params == 0 && "tag has type parameters on it");
413-
414410
// Call to the implementation.
415411
static_cast<T *>(this)->walk_tag1(tinfo);
416412
}
@@ -489,10 +485,6 @@ ctxt<T>::walk_res0() {
489485
reinterpret_cast<const rust_fn **>(tables->resources);
490486
const rust_fn *dtor = resources[dtor_offset];
491487

492-
// Read in a dummy value; this used to be the number of parameters
493-
uint16_t number_of_params = get_u16_bump(sp);
494-
assert(number_of_params == 0 && "resource has type parameters on it");
495-
496488
uint16_t sp_size = get_u16_bump(sp);
497489
const uint8_t *end_sp = sp + sp_size;
498490

src/rt/rust_type.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,15 @@ static inline void *box_body(rust_opaque_box *box) {
4545
return (void*)(box + 1);
4646
}
4747

48-
// N.B. If you want to add a field to tydesc, please use one of the
49-
// unused fields!
5048
struct type_desc {
51-
uintptr_t UNUSED_1;
5249
size_t size;
5350
size_t align;
5451
glue_fn *take_glue;
5552
glue_fn *drop_glue;
5653
glue_fn *free_glue;
5754
glue_fn *visit_glue;
58-
uintptr_t UNUSED_2;
59-
uintptr_t UNUSED_3;
60-
uintptr_t UNUSED_4;
61-
uintptr_t UNUSED_5;
6255
const uint8_t *shape;
6356
const rust_shape_tables *shape_tables;
64-
uintptr_t UNUSED_6;
65-
uintptr_t UNUSED_7;
6657
};
6758

6859
extern "C" type_desc *rust_clone_type_desc(type_desc*);

src/rt/rust_upcall.cpp

Lines changed: 4 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -335,59 +335,6 @@ upcall_str_new_shared(const char *cstr, size_t len) {
335335
}
336336

337337

338-
struct s_vec_grow_args {
339-
rust_task *task;
340-
rust_vec_box** vp;
341-
size_t new_sz;
342-
};
343-
344-
extern "C" CDECL void
345-
upcall_s_vec_grow(s_vec_grow_args *args) {
346-
rust_task *task = args->task;
347-
LOG_UPCALL_ENTRY(task);
348-
reserve_vec(task, args->vp, args->new_sz);
349-
(*args->vp)->body.fill = args->new_sz;
350-
}
351-
352-
extern "C" CDECL void
353-
upcall_vec_grow(rust_vec_box** vp, size_t new_sz) {
354-
rust_task *task = rust_get_current_task();
355-
s_vec_grow_args args = {task, vp, new_sz};
356-
UPCALL_SWITCH_STACK(task, &args, upcall_s_vec_grow);
357-
}
358-
359-
struct s_str_concat_args {
360-
rust_task *task;
361-
rust_vec_box* lhs;
362-
rust_vec_box* rhs;
363-
rust_vec_box* retval;
364-
};
365-
366-
extern "C" CDECL void
367-
upcall_s_str_concat(s_str_concat_args *args) {
368-
rust_vec *lhs = &args->lhs->body;
369-
rust_vec *rhs = &args->rhs->body;
370-
rust_task *task = args->task;
371-
size_t fill = lhs->fill + rhs->fill - 1;
372-
rust_vec_box* v = (rust_vec_box*)
373-
task->kernel->malloc(fill + sizeof(rust_vec_box),
374-
"str_concat");
375-
v->header.td = args->lhs->header.td;
376-
v->body.fill = v->body.alloc = fill;
377-
memmove(&v->body.data[0], &lhs->data[0], lhs->fill - 1);
378-
memmove(&v->body.data[lhs->fill - 1], &rhs->data[0], rhs->fill);
379-
args->retval = v;
380-
}
381-
382-
extern "C" CDECL rust_vec_box*
383-
upcall_str_concat(rust_vec_box* lhs, rust_vec_box* rhs) {
384-
rust_task *task = rust_get_current_task();
385-
s_str_concat_args args = {task, lhs, rhs, 0};
386-
UPCALL_SWITCH_STACK(task, &args, upcall_s_str_concat);
387-
return args.retval;
388-
}
389-
390-
391338
extern "C" _Unwind_Reason_Code
392339
__gxx_personality_v0(int version,
393340
_Unwind_Action actions,
@@ -444,30 +391,27 @@ upcall_rust_personality(int version,
444391

445392
extern "C" void
446393
shape_cmp_type(int8_t *result, const type_desc *tydesc,
447-
const type_desc **subtydescs, uint8_t *data_0,
448-
uint8_t *data_1, uint8_t cmp_type);
394+
uint8_t *data_0, uint8_t *data_1, uint8_t cmp_type);
449395

450396
struct s_cmp_type_args {
451397
int8_t *result;
452398
const type_desc *tydesc;
453-
const type_desc **subtydescs;
454399
uint8_t *data_0;
455400
uint8_t *data_1;
456401
uint8_t cmp_type;
457402
};
458403

459404
extern "C" void
460405
upcall_s_cmp_type(s_cmp_type_args *args) {
461-
shape_cmp_type(args->result, args->tydesc, args->subtydescs,
406+
shape_cmp_type(args->result, args->tydesc,
462407
args->data_0, args->data_1, args->cmp_type);
463408
}
464409

465410
extern "C" void
466411
upcall_cmp_type(int8_t *result, const type_desc *tydesc,
467-
const type_desc **subtydescs, uint8_t *data_0,
468-
uint8_t *data_1, uint8_t cmp_type) {
412+
uint8_t *data_0, uint8_t *data_1, uint8_t cmp_type) {
469413
rust_task *task = rust_get_current_task();
470-
s_cmp_type_args args = {result, tydesc, subtydescs,
414+
s_cmp_type_args args = {result, tydesc,
471415
data_0, data_1, cmp_type};
472416
UPCALL_SWITCH_STACK(task, &args, upcall_s_cmp_type);
473417
}

src/rt/rust_util.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,14 @@ uint8_t str_body_shape[] = {
1515
};
1616

1717
struct type_desc str_body_tydesc = {
18-
0, // unused
1918
1, // size
2019
1, // align
2120
NULL, // take_glue
2221
NULL, // drop_glue
2322
NULL, // free_glue
2423
NULL, // visit_glue
25-
0, // unused
26-
0, // unused
27-
0, // unused
28-
0, // unused
2924
str_body_shape, // shape
3025
&empty_shape_tables, // shape_tables
31-
0, // unused
32-
0, // unused
3326
};
3427

3528
//

src/rt/rustrt.def.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,8 @@ upcall_validate_box
7676
upcall_log_type
7777
upcall_malloc
7878
upcall_rust_personality
79-
upcall_vec_grow
80-
upcall_str_new
8179
upcall_str_new_uniq
8280
upcall_str_new_shared
83-
upcall_str_concat
8481
upcall_call_shim_on_c_stack
8582
upcall_call_shim_on_rust_stack
8683
upcall_new_stack

src/rustc/back/abi.rs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,15 @@ const box_field_body: uint = 4u;
3333

3434
const general_code_alignment: uint = 16u;
3535

36-
const tydesc_field_first_param: uint = 0u;
37-
const tydesc_field_size: uint = 1u;
38-
const tydesc_field_align: uint = 2u;
39-
const tydesc_field_take_glue: uint = 3u;
40-
const tydesc_field_drop_glue: uint = 4u;
41-
const tydesc_field_free_glue: uint = 5u;
42-
const tydesc_field_visit_glue: uint = 6u;
43-
const tydesc_field_sever_glue: uint = 7u;
44-
const tydesc_field_mark_glue: uint = 8u;
45-
const tydesc_field_unused2: uint = 9u;
46-
const tydesc_field_unused_2: uint = 10u;
47-
const tydesc_field_shape: uint = 11u;
48-
const tydesc_field_shape_tables: uint = 12u;
49-
const tydesc_field_n_params: uint = 13u;
50-
const tydesc_field_obj_params: uint = 14u; // FIXME unused (#2351)
51-
const n_tydesc_fields: uint = 15u;
36+
const tydesc_field_size: uint = 0u;
37+
const tydesc_field_align: uint = 1u;
38+
const tydesc_field_take_glue: uint = 2u;
39+
const tydesc_field_drop_glue: uint = 3u;
40+
const tydesc_field_free_glue: uint = 4u;
41+
const tydesc_field_visit_glue: uint = 5u;
42+
const tydesc_field_shape: uint = 6u;
43+
const tydesc_field_shape_tables: uint = 7u;
44+
const n_tydesc_fields: uint = 8u;
5245

5346
const cmp_glue_op_eq: uint = 0u;
5447

src/rustc/back/upcall.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ type upcalls =
1616
exchange_free: ValueRef,
1717
validate_box: ValueRef,
1818
mark: ValueRef,
19-
vec_grow: ValueRef,
2019
str_new_uniq: ValueRef,
2120
str_new_shared: ValueRef,
22-
str_concat: ValueRef,
2321
cmp_type: ValueRef,
2422
log_type: ValueRef,
2523
alloc_c_stack: ValueRef,
@@ -71,22 +69,16 @@ fn declare_upcalls(targ_cfg: @session::config,
7169
nothrow(dv("validate_box", ~[T_ptr(T_i8())])),
7270
mark:
7371
d("mark", ~[T_ptr(T_i8())], int_t),
74-
vec_grow:
75-
nothrow(dv("vec_grow", ~[T_ptr(T_ptr(T_i8())), int_t])),
7672
str_new_uniq:
7773
nothrow(d("str_new_uniq", ~[T_ptr(T_i8()), int_t],
7874
T_ptr(T_i8()))),
7975
str_new_shared:
8076
nothrow(d("str_new_shared", ~[T_ptr(T_i8()), int_t],
8177
T_ptr(T_i8()))),
82-
str_concat:
83-
nothrow(d("str_concat", ~[T_ptr(T_i8()),
84-
T_ptr(T_i8())],
85-
T_ptr(T_i8()))),
8678
cmp_type:
8779
dv("cmp_type",
8880
~[T_ptr(T_i1()), T_ptr(tydesc_type),
89-
T_ptr(T_ptr(tydesc_type)), T_ptr(T_i8()),
81+
T_ptr(T_i8()),
9082
T_ptr(T_i8()),
9183
T_i8()]),
9284
log_type:

0 commit comments

Comments
 (0)