Skip to content

Commit

Permalink
Remove unused shape fields from typedescs
Browse files Browse the repository at this point in the history
  • Loading branch information
Blei committed Jun 23, 2013
1 parent 179ce39 commit 8bf0033
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 27 deletions.
4 changes: 1 addition & 3 deletions src/librustc/back/abi.rs
Expand Up @@ -49,9 +49,7 @@ pub static tydesc_field_take_glue: uint = 2u;
pub static tydesc_field_drop_glue: uint = 3u;
pub static tydesc_field_free_glue: uint = 4u;
pub static tydesc_field_visit_glue: uint = 5u;
pub static tydesc_field_shape: uint = 6u;
pub static tydesc_field_shape_tables: uint = 7u;
pub static n_tydesc_fields: uint = 8u;
pub static n_tydesc_fields: uint = 6u;

// The two halves of a closure: code and environment.
pub static fn_field_code: uint = 0u;
Expand Down
18 changes: 6 additions & 12 deletions src/librustc/middle/trans/glue.rs
Expand Up @@ -765,19 +765,13 @@ pub fn emit_tydescs(ccx: &mut CrateContext) {
}
};


let shape = C_null(Type::i8p());
let shape_tables = C_null(Type::i8p());

let tydesc = C_named_struct(ccx.tydesc_type,
[ti.size, // size
ti.align, // align
take_glue, // take_glue
drop_glue, // drop_glue
free_glue, // free_glue
visit_glue, // visit_glue
shape, // shape
shape_tables]); // shape_tables
[ti.size, // size
ti.align, // align
take_glue, // take_glue
drop_glue, // drop_glue
free_glue, // free_glue
visit_glue]); // visit_glue

unsafe {
let gvar = ti.tydesc;
Expand Down
3 changes: 1 addition & 2 deletions src/librustc/middle/trans/type_.rs
Expand Up @@ -211,8 +211,7 @@ impl Type {

let elems = [
int_ty, int_ty,
glue_fn_ty, glue_fn_ty, glue_fn_ty, glue_fn_ty,
pvoid, pvoid
glue_fn_ty, glue_fn_ty, glue_fn_ty, glue_fn_ty
];

tydesc.set_struct_body(elems, false);
Expand Down
2 changes: 0 additions & 2 deletions src/libstd/unstable/intrinsics.rs
Expand Up @@ -48,8 +48,6 @@ pub struct TyDesc {
drop_glue: GlueFn,
free_glue: GlueFn,
visit_glue: GlueFn,
shape: *i8,
shape_tables: *i8
}

#[lang="opaque"]
Expand Down
7 changes: 3 additions & 4 deletions src/rt/rust_builtin.cpp
Expand Up @@ -732,10 +732,9 @@ rust_task_deref(rust_task *task) {
// Must call on rust stack.
extern "C" CDECL void
rust_call_tydesc_glue(void *root, size_t *tydesc, size_t glue_index) {
void (*glue_fn)(void *, void *, void *) =
(void (*)(void *, void *, void *))tydesc[glue_index];
if (glue_fn)
glue_fn(0, 0, root);
glue_fn *fn = (glue_fn*) tydesc[glue_index];
if (fn)
fn(0, 0, root);
}

// Don't run on the Rust stack!
Expand Down
2 changes: 0 additions & 2 deletions src/rt/rust_type.h
Expand Up @@ -57,8 +57,6 @@ struct type_desc {
glue_fn *drop_glue;
glue_fn *free_glue;
glue_fn *visit_glue;
const uint8_t *unused;
const uint8_t *unused2;
};

extern "C" type_desc *rust_clone_type_desc(type_desc*);
Expand Down
2 changes: 0 additions & 2 deletions src/rt/rust_util.cpp
Expand Up @@ -21,8 +21,6 @@ struct type_desc str_body_tydesc = {
NULL, // drop_glue
NULL, // free_glue
NULL, // visit_glue
NULL, // shape
NULL, // shape_tables
};

//
Expand Down

0 comments on commit 8bf0033

Please sign in to comment.