about summary refs log tree commit diff
path: root/src/rustc
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-09-25 16:39:52 -0700
committerPatrick Walton <pcwalton@mimiga.net>2012-09-25 16:40:37 -0700
commita66e23d236bfcfbd1fd1829565ce56d696b19b8b (patch)
treea4c6fed6270c783136847c92da1929453631d5af /src/rustc
parente85a3d82470e2e45db370b62e4fd54175c4b144d (diff)
rustc: Stop generating shape tables
Diffstat (limited to 'src/rustc')
-rw-r--r--src/rustc/middle/trans/base.rs4
-rw-r--r--src/rustc/middle/trans/glue.rs10
-rw-r--r--src/rustc/middle/trans/shape.rs49
3 files changed, 4 insertions, 59 deletions
diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs
index 65a788991bf..2e2e2937cf1 100644
--- a/src/rustc/middle/trans/base.rs
+++ b/src/rustc/middle/trans/base.rs
@@ -2701,11 +2701,7 @@ fn trans_crate(sess: session::session,
 
     decl_gc_metadata(ccx, llmod_id);
     fill_crate_map(ccx, crate_map);
-    // NB: Must call force_declare_tydescs before emit_tydescs to break
-    // cyclical dependency with shape code! See shape.rs for details.
-    force_declare_tydescs(ccx);
     glue::emit_tydescs(ccx);
-    gen_shape_tables(ccx);
     write_abi_version(ccx);
 
     // Translate the metadata.
diff --git a/src/rustc/middle/trans/glue.rs b/src/rustc/middle/trans/glue.rs
index 8ac42bc2284..0fc72e8dc15 100644
--- a/src/rustc/middle/trans/glue.rs
+++ b/src/rustc/middle/trans/glue.rs
@@ -679,7 +679,7 @@ fn emit_tydescs(ccx: @crate_ctxt) {
     let _icx = ccx.insn_ctxt("emit_tydescs");
     // As of this point, allow no more tydescs to be created.
     ccx.finished_tydescs = true;
-    for ccx.tydescs.each |key, val| {
+    for ccx.tydescs.each |_key, val| {
         let glue_fn_ty = T_ptr(T_generic_glue_fn(ccx));
         let ti = val;
 
@@ -720,10 +720,8 @@ fn emit_tydescs(ccx: @crate_ctxt) {
               }
             };
 
-        let shape = shape_of(ccx, key);
-        let shape_tables =
-            llvm::LLVMConstPointerCast(ccx.shape_cx.llshapetables,
-                                       T_ptr(T_i8()));
+        let shape = C_null(T_ptr(T_i8()));
+        let shape_tables = C_null(T_ptr(T_i8()));
 
         let tydesc =
             C_named_struct(ccx.tydesc_type,
@@ -733,7 +731,7 @@ fn emit_tydescs(ccx: @crate_ctxt) {
                              drop_glue, // drop_glue
                              free_glue, // free_glue
                              visit_glue, // visit_glue
-                             C_shape(ccx, shape), // shape
+                             shape, // shape
                              shape_tables]); // shape_tables
 
         let gvar = ti.tydesc;
diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs
index 28d24be77df..708bf149d07 100644
--- a/src/rustc/middle/trans/shape.rs
+++ b/src/rustc/middle/trans/shape.rs
@@ -591,52 +591,3 @@ fn gen_resource_shapes(ccx: @crate_ctxt) -> ValueRef {
     return mk_global(ccx, ~"resource_shapes", C_struct(dtors), true);
 }
 
-// This function serves to break a cyclical dependence between
-// emit_tydescs and gen_shape_tables.
-//
-//  * emit_tydescs calls shape_of, which causes changes to the shape
-//    tables
-//  * gen_shape_tables transitively calls get_tydesc, which causes new
-//    tydescs to be created
-//
-// We force those tydescs to be emitted now, thus breaking the
-// dependency.
-fn force_declare_tydescs(ccx: @crate_ctxt) {
-    // Walk all known tydescs first to force shape code to declare
-    // dependencies.
-    for ccx.tydescs.each |key, _val| {
-        shape_of(ccx, key);
-    }
-
-    // Then walk all resource shapes to force emit all dtors.
-    let len = ccx.shape_cx.resources.len();
-    for uint::range(0u, len) |i| {
-        let ri = ccx.shape_cx.resources.get(i);
-        for ri.tps.each() |s| { assert !ty::type_has_params(*s); }
-        do ri.parent_id.iter |id| {
-            trans::base::get_res_dtor(ccx, ri.did, id, ri.tps);
-        }
-    }
-}
-
-fn gen_shape_tables(ccx: @crate_ctxt) {
-    let lltagstable = gen_enum_shapes(ccx);
-    let llresourcestable = gen_resource_shapes(ccx);
-    trans::common::set_struct_body(ccx.shape_cx.llshapetablesty,
-                                   ~[val_ty(lltagstable),
-                                    val_ty(llresourcestable)]);
-
-    let lltables =
-        C_named_struct(ccx.shape_cx.llshapetablesty,
-                       ~[lltagstable, llresourcestable]);
-    lib::llvm::llvm::LLVMSetInitializer(ccx.shape_cx.llshapetables, lltables);
-    lib::llvm::llvm::LLVMSetGlobalConstant(ccx.shape_cx.llshapetables, True);
-    lib::llvm::SetLinkage(ccx.shape_cx.llshapetables,
-                          lib::llvm::InternalLinkage);
-}
-
-// Computes the static size of a enum, without using mk_tup(), which is
-// bad for performance.
-//
-// NB: Migrate trans over to use this.
-