Skip to content

Commit

Permalink
Remove the last traces of shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
Blei authored and jihyun committed Jun 28, 2013
1 parent 036b16f commit e994fb0
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 91 deletions.
21 changes: 20 additions & 1 deletion src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down Expand Up @@ -2869,6 +2868,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);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 1 addition & 15 deletions src/librustc/middle/trans/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 0 additions & 5 deletions src/librustc/middle/trans/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion src/librustc/middle/trans/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
63 changes: 0 additions & 63 deletions src/librustc/middle/trans/shape.rs

This file was deleted.

5 changes: 0 additions & 5 deletions src/test/run-pass/shape_intrinsic_tag_then_rec.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 {

Expand Down

0 comments on commit e994fb0

Please sign in to comment.