Remove the last traces of shapes
This commit is contained in:
parent
87c1b59e8b
commit
2234f61038
7 changed files with 22 additions and 91 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
|
||||
|
|
Loading…
Reference in a new issue