Skip to content

Misc small fixes #7378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/etc/combine-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def scrub(b):
for t in stage2_tests:
p = os.path.join("test", "run-pass", t)
p = p.replace("\\", "\\\\")
d.write(" out.write_str(~\"run-pass [stage2]: %s\\n\");\n" % p)
d.write(" out.write_str(\"run-pass [stage2]: %s\\n\");\n" % p)
d.write(" t_%d::main();\n" % i)
i += 1
d.write("}\n")
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 @@ -2864,6 +2863,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