about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc/middle/trans/base.rs21
-rw-r--r--src/librustc/middle/trans/closure.rs2
-rw-r--r--src/librustc/middle/trans/common.rs16
-rw-r--r--src/librustc/middle/trans/context.rs5
-rw-r--r--src/librustc/middle/trans/mod.rs1
-rw-r--r--src/librustc/middle/trans/shape.rs63
-rw-r--r--src/test/run-pass/shape_intrinsic_tag_then_rec.rs5
7 files changed, 22 insertions, 91 deletions
diff --git a/src/librustc/middle/trans/base.rs b/src/librustc/middle/trans/base.rs
index 0886704bbb1..ea90f554bab 100644
--- a/src/librustc/middle/trans/base.rs
+++ b/src/librustc/middle/trans/base.rs
@@ -55,7 +55,6 @@ use middle::trans::machine::{llalign_of_min, llsize_of};
 use middle::trans::meth;
 use middle::trans::monomorphize;
 use middle::trans::reachable;
-use middle::trans::shape::*;
 use middle::trans::tvec;
 use middle::trans::type_of;
 use middle::trans::type_of::*;
@@ -2870,6 +2869,26 @@ pub fn write_metadata(cx: &mut CrateContext, crate: &ast::crate) {
     }
 }
 
+fn mk_global(ccx: &CrateContext,
+             name: &str,
+             llval: ValueRef,
+             internal: bool)
+          -> ValueRef {
+    unsafe {
+        let llglobal = do str::as_c_str(name) |buf| {
+            llvm::LLVMAddGlobal(ccx.llmod, val_ty(llval).to_ref(), buf)
+        };
+        llvm::LLVMSetInitializer(llglobal, llval);
+        llvm::LLVMSetGlobalConstant(llglobal, True);
+
+        if internal {
+            lib::llvm::SetLinkage(llglobal, lib::llvm::InternalLinkage);
+        }
+
+        return llglobal;
+    }
+}
+
 // Writes the current ABI version into the crate.
 pub fn write_abi_version(ccx: &mut CrateContext) {
     mk_global(ccx, "rust_abi_version", C_uint(ccx, abi::abi_version), false);
diff --git a/src/librustc/middle/trans/closure.rs b/src/librustc/middle/trans/closure.rs
index 6cff996d0d4..227e2213163 100644
--- a/src/librustc/middle/trans/closure.rs
+++ b/src/librustc/middle/trans/closure.rs
@@ -210,7 +210,7 @@ pub fn store_environment(bcx: block,
     let ccx = bcx.ccx();
     let tcx = ccx.tcx;
 
-    // compute the shape of the closure
+    // compute the type of the closure
     let cdata_ty = mk_closure_tys(tcx, bound_values);
 
     // allocate closure in the heap
diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs
index 442ab475046..272d7b234aa 100644
--- a/src/librustc/middle/trans/common.rs
+++ b/src/librustc/middle/trans/common.rs
@@ -658,7 +658,7 @@ impl block_ {
 pub fn tuplify_box_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
     let ptr = ty::mk_ptr(
         tcx,
-        ty::mt {ty: ty::mk_nil(), mutbl: ast::m_imm}
+        ty::mt {ty: ty::mk_i8(), mutbl: ast::m_imm}
     );
     return ty::mk_tup(tcx, ~[ty::mk_uint(), ty::mk_type(tcx),
                          ptr, ptr,
@@ -826,20 +826,6 @@ pub fn C_bytes_plus_null(bytes: &[u8]) -> ValueRef {
     }
 }
 
-pub fn C_shape(ccx: &CrateContext, bytes: ~[u8]) -> ValueRef {
-    unsafe {
-        let llshape = C_bytes_plus_null(bytes);
-        let name = fmt!("shape%u", token::gensym("shape"));
-        let llglobal = do name.as_c_str |buf| {
-            llvm::LLVMAddGlobal(ccx.llmod, val_ty(llshape).to_ref(), buf)
-        };
-        llvm::LLVMSetInitializer(llglobal, llshape);
-        llvm::LLVMSetGlobalConstant(llglobal, True);
-        lib::llvm::SetLinkage(llglobal, lib::llvm::InternalLinkage);
-        return llvm::LLVMConstPointerCast(llglobal, Type::i8p().to_ref());
-    }
-}
-
 pub fn get_param(fndecl: ValueRef, param: uint) -> ValueRef {
     unsafe {
         llvm::LLVMGetParam(fndecl, param as c_uint)
diff --git a/src/librustc/middle/trans/context.rs b/src/librustc/middle/trans/context.rs
index 57cfb1474df..a0ae579c865 100644
--- a/src/librustc/middle/trans/context.rs
+++ b/src/librustc/middle/trans/context.rs
@@ -22,7 +22,6 @@ use middle::trans::adt;
 use middle::trans::base;
 use middle::trans::debuginfo;
 use middle::trans::reachable;
-use middle::trans::shape;
 use middle::trans::type_use;
 use middle::ty;
 
@@ -40,8 +39,6 @@ use middle::trans::common::{mono_id,new_namegen};
 
 use middle::trans::base::{decl_crate_map};
 
-use middle::trans::shape::{mk_ctxt};
-
 pub struct CrateContext {
      sess: session::Session,
      llmod: ModuleRef,
@@ -110,7 +107,6 @@ pub struct CrateContext {
      float_type: Type,
      opaque_vec_type: Type,
      builder: BuilderRef_res,
-     shape_cx: shape::Ctxt,
      crate_map: ValueRef,
      // Set when at least one function uses GC. Needed so that
      // decl_gc_metadata knows whether to link to the module metadata, which
@@ -223,7 +219,6 @@ impl CrateContext {
                   float_type: float_type,
                   opaque_vec_type: opaque_vec_type,
                   builder: BuilderRef_res(llvm::LLVMCreateBuilderInContext(llcx)),
-                  shape_cx: mk_ctxt(llmod),
                   crate_map: crate_map,
                   uses_gc: false,
                   dbg_cx: dbg_cx,
diff --git a/src/librustc/middle/trans/mod.rs b/src/librustc/middle/trans/mod.rs
index 1345b92418e..c2a25d80998 100644
--- a/src/librustc/middle/trans/mod.rs
+++ b/src/librustc/middle/trans/mod.rs
@@ -35,7 +35,6 @@ pub mod cabi_arm;
 pub mod cabi_mips;
 pub mod foreign;
 pub mod reflect;
-pub mod shape;
 pub mod debuginfo;
 pub mod type_use;
 pub mod reachable;
diff --git a/src/librustc/middle/trans/shape.rs b/src/librustc/middle/trans/shape.rs
deleted file mode 100644
index 4118291dca0..00000000000
--- a/src/librustc/middle/trans/shape.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// A "shape" is a compact encoding of a type that is used by interpreted glue.
-// This substitutes for the runtime tags used by e.g. MLs.
-
-
-use lib::llvm::llvm;
-use lib::llvm::{True, ModuleRef, ValueRef};
-use middle::trans::common::*;
-
-use middle::trans::type_::Type;
-
-use core::str;
-
-pub struct Ctxt {
-    next_tag_id: u16,
-    pad: u16,
-    pad2: u32
-}
-
-pub fn mk_global(ccx: &CrateContext,
-                 name: &str,
-                 llval: ValueRef,
-                 internal: bool)
-              -> ValueRef {
-    unsafe {
-        let llglobal = do str::as_c_str(name) |buf| {
-            llvm::LLVMAddGlobal(ccx.llmod, val_ty(llval).to_ref(), buf)
-        };
-        llvm::LLVMSetInitializer(llglobal, llval);
-        llvm::LLVMSetGlobalConstant(llglobal, True);
-
-        if internal {
-            ::lib::llvm::SetLinkage(llglobal,
-                                    ::lib::llvm::InternalLinkage);
-        }
-
-        return llglobal;
-    }
-}
-
-pub fn mk_ctxt(llmod: ModuleRef) -> Ctxt {
-    unsafe {
-        let llshapetablesty = Type::named_struct("shapes");
-        do "shapes".as_c_str |buf| {
-            llvm::LLVMAddGlobal(llmod, llshapetablesty.to_ref(), buf)
-        };
-
-        Ctxt {
-            next_tag_id: 0u16,
-            pad: 0u16,
-            pad2: 0u32
-        }
-    }
-}
diff --git a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs
index f29d0c6f108..34afc12f02e 100644
--- a/src/test/run-pass/shape_intrinsic_tag_then_rec.rs
+++ b/src/test/run-pass/shape_intrinsic_tag_then_rec.rs
@@ -1,5 +1,3 @@
-// xfail-fast
-
 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
@@ -14,9 +12,6 @@
 // on x86_64: when there is a enum embedded in an
 // interior record which is then itself interior to
 // something else, shape calculations were off.
-extern mod extra;
-use extra::list;
-use extra::list::list;
 
 enum opt_span {