From 9869aebf7d21e5076e16193f2fad9c7f9446fdc6 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 1 Mar 2011 16:58:13 -0800 Subject: rustc: Remove the static "size" field from the tag info --- src/comp/middle/trans.rs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 0aaf582d..e961acb4 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -61,7 +61,6 @@ type glue_fns = rec(ValueRef activate_glue, type tag_info = rec( type_handle th, - mutable uint size, mutable @hashmap[ast.def_id,ValueRef] lldiscrims ); @@ -4491,15 +4490,6 @@ fn trans_tag_variant(@crate_ctxt cx, ast.def_id tag_id, auto arg_tys = arg_tys_of_fn(variant.ann); copy_args_to_allocas(bcx, none[TypeRef], fn_args, arg_tys); - // FIXME: This is wrong for generic tags. We should be dynamically - // computing "size" below based on the tydescs passed in. - auto info = cx.tags.get(mk_plain_tag(tag_id)); - - auto lltagty = T_struct(vec(T_int(), T_array(T_i8(), info.size))); - - // FIXME: better name. - llvm.LLVMAddTypeName(cx.llmod, _str.buf("tag"), lltagty); - auto lldiscrimptr = bcx.build.GEP(fcx.llretptr, vec(C_int(0), C_int(0))); bcx.build.Store(C_int(index), lldiscrimptr); @@ -4718,7 +4708,6 @@ fn collect_item(&@crate_ctxt cx, @ast.item i) -> @crate_ctxt { auto info = @rec( th=mk_type_handle(), - mutable size=0u, mutable lldiscrims=@new_def_hash[ValueRef]() ); @@ -4780,6 +4769,9 @@ fn collect_tag_ctors(@crate_ctxt cx, @ast.crate crate) { fn resolve_tag_types_for_item(&@crate_ctxt cx, @ast.item i) -> @crate_ctxt { alt (i.node) { case (ast.item_tag(_, ?variants, _, ?tag_id)) { + // FIXME: This is all wrong. Now sizes and alignments are computed + // dynamically instead of up front. + auto max_align = 0u; auto max_size = 0u; @@ -4799,8 +4791,6 @@ fn resolve_tag_types_for_item(&@crate_ctxt cx, @ast.item i) -> @crate_ctxt { } } - info.size = max_size; - // FIXME: alignment is wrong here, manually insert padding I // guess :( auto tag_ty = T_struct(vec(T_int(), T_array(T_i8(), max_size))); -- cgit v1.2.3