Clean up tydesc declaration to make it clear what is unused.

This commit is contained in:
Michael Sullivan 2012-06-08 12:54:23 -07:00
parent b22620624c
commit 665ba3531d
3 changed files with 16 additions and 21 deletions
src
rt
rustc/middle/trans

@ -42,29 +42,24 @@ static inline void *box_body(rust_opaque_box *box) {
return (void*)(box + 1);
}
// N.B. If you want to add a field to tydesc, please use one of the
// unused fields!
struct type_desc {
// First part of type_desc is known to compiler.
// first_param = &descs[1] if dynamic, null if static.
const type_desc **first_param;
size_t size;
size_t align;
glue_fn *take_glue;
glue_fn *drop_glue;
glue_fn *free_glue;
void *UNUSED;
glue_fn *sever_glue; // For GC.
glue_fn *mark_glue; // For GC.
uintptr_t unused2;
void *UNUSED_2;
glue_fn *visit_glue;
uintptr_t UNUSED_1;
uintptr_t UNUSED_2;
uintptr_t UNUSED_3;
uintptr_t UNUSED_4;
const uint8_t *shape;
const rust_shape_tables *shape_tables;
uintptr_t n_params;
uintptr_t n_obj_params;
// Residual fields past here are known only to runtime.
UT_hash_handle hh;
size_t n_descs;
const type_desc *descs[];
uintptr_t UNUSED_5;
uintptr_t UNUSED_6;
};
extern "C" type_desc *rust_clone_type_desc(type_desc*);

@ -630,14 +630,14 @@ fn emit_tydescs(ccx: @crate_ctxt) {
drop_glue, // drop_glue
free_glue, // free_glue
visit_glue, // visit_glue
C_null(glue_fn_ty), // sever_glue
C_null(glue_fn_ty), // mark_glue
C_null(glue_fn_ty), // unused
C_null(T_ptr(T_i8())), // cmp_glue
C_int(ccx, 0), // ununsed
C_int(ccx, 0), // ununsed
C_int(ccx, 0), // ununsed
C_int(ccx, 0), // ununsed
C_shape(ccx, shape), // shape
shape_tables, // shape_tables
C_int(ccx, 0), // n_params
C_int(ccx, 0)]); // n_obj_params
C_int(ccx, 0), // ununsed
C_int(ccx, 0)]); // unused
let gvar = ti.tydesc;
llvm::LLVMSetInitializer(gvar, tydesc);

@ -621,7 +621,7 @@ fn T_tydesc(targ_cfg: @session::config) -> TypeRef {
let elems =
[tydescpp, int_type, int_type,
glue_fn_ty, glue_fn_ty, glue_fn_ty, glue_fn_ty,
glue_fn_ty, glue_fn_ty, glue_fn_ty, T_ptr(T_i8()),
int_type, int_type, int_type, int_type,
T_ptr(T_i8()), T_ptr(T_i8()), int_type, int_type];
set_struct_body(tydesc, elems);
ret tydesc;