Skip to content

Commit

Permalink
auto merge of #7955 : thestinger/rust/snapshot, r=huonw
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Jul 22, 2013
2 parents 3d6c0bc + f51e2ad commit 74f4bad
Show file tree
Hide file tree
Showing 34 changed files with 27 additions and 814 deletions.
1 change: 0 additions & 1 deletion src/libextra/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ struct RWARCInner<T> { priv lock: RWlock, priv failed: bool, priv data: T }
*
* Unlike mutex_arcs, rw_arcs are safe, because they cannot be nested.
*/
#[mutable] // XXX remove after snap
#[no_freeze]
struct RWARC<T> {
priv x: UnsafeAtomicRcBox<RWARCInner<T>>,
Expand Down
26 changes: 2 additions & 24 deletions src/libextra/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,7 @@ use std::sys;
use std::uint;
use std::vec;
use std::unstable::intrinsics;
use std::unstable::intrinsics::{TyDesc};

#[cfg(not(stage0))]
use std::unstable::intrinsics::{get_tydesc};

#[cfg(stage0)]
unsafe fn get_tydesc<T>() -> *TyDesc {
intrinsics::get_tydesc::<T>() as *TyDesc
}
use std::unstable::intrinsics::{TyDesc, get_tydesc};

// The way arena uses arrays is really deeply awful. The arrays are
// allocated, and have capacities reserved, but the fill for the array
Expand All @@ -65,7 +57,6 @@ struct Chunk {
is_pod: bool,
}

#[mutable] // XXX remove after snap
#[no_freeze]
pub struct Arena {
// The head is separated out from the list as a unbenchmarked
Expand Down Expand Up @@ -117,19 +108,6 @@ fn round_up_to(base: uint, align: uint) -> uint {
(base + (align - 1)) & !(align - 1)
}

#[inline]
#[cfg(not(stage0))]
unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) {
// This function should be inlined when stage0 is gone
((*tydesc).drop_glue)(data);
}

#[inline]
#[cfg(stage0)]
unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) {
((*tydesc).drop_glue)(0 as **TyDesc, data);
}

// Walk down a chunk, running the destructors for any objects stored
// in it.
unsafe fn destroy_chunk(chunk: &Chunk) {
Expand All @@ -149,7 +127,7 @@ unsafe fn destroy_chunk(chunk: &Chunk) {
//debug!("freeing object: idx = %u, size = %u, align = %u, done = %b",
// start, size, align, is_done);
if is_done {
call_drop_glue(tydesc, ptr::offset(buf, start) as *i8);
((*tydesc).drop_glue)(ptr::offset(buf, start) as *i8);
}

// Find where the next tydesc lives
Expand Down
6 changes: 0 additions & 6 deletions src/libextra/dbg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@
#[allow(missing_doc)];

use std::cast::transmute;
#[cfg(stage0)]
use intrinsic::{get_tydesc};
#[cfg(not(stage0))]
use std::unstable::intrinsics::{get_tydesc};

pub mod rustrt {
#[cfg(stage0)]
use intrinsic::{TyDesc};
#[cfg(not(stage0))]
use std::unstable::intrinsics::{TyDesc};

#[abi = "cdecl"]
Expand Down
2 changes: 0 additions & 2 deletions src/libextra/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ struct RcMutBox<T> {
}

/// Mutable reference counted pointer type
#[non_owned]
#[no_send]
#[mutable] // XXX remove after snap
#[no_freeze]
#[unsafe_no_drop_flag]
pub struct RcMut<T> {
Expand Down
3 changes: 0 additions & 3 deletions src/libextra/rl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ pub unsafe fn read(prompt: &str) -> Option<~str> {

pub type CompletionCb = @fn(~str, @fn(~str));

#[cfg(not(stage0))]
static complete_key: local_data::Key<@CompletionCb> = &local_data::Key;
#[cfg(stage0)]
fn complete_key(_: @CompletionCb) {}

/// Bind to the main completion callback
pub unsafe fn complete(cb: CompletionCb) {
Expand Down
8 changes: 0 additions & 8 deletions src/librustc/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ pub mod jit {
use metadata::cstore;

use std::cast;
#[cfg(not(stage0))]
use std::local_data;
use std::unstable::intrinsics;

Expand Down Expand Up @@ -204,22 +203,15 @@ pub mod jit {

// The stage1 compiler won't work, but that doesn't really matter. TLS
// changed only very recently to allow storage of owned values.
#[cfg(not(stage0))]
static engine_key: local_data::Key<~Engine> = &local_data::Key;

#[cfg(not(stage0))]
fn set_engine(engine: ~Engine) {
local_data::set(engine_key, engine)
}
#[cfg(stage0)]
fn set_engine(_: ~Engine) {}

#[cfg(not(stage0))]
pub fn consume_engine() -> Option<~Engine> {
local_data::pop(engine_key)
}
#[cfg(stage0)]
pub fn consume_engine() -> Option<~Engine> { None }
}

pub mod write {
Expand Down
3 changes: 0 additions & 3 deletions src/librustc/middle/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ use syntax::abi::{X86, X86_64, Arm, Mips};

pub use middle::trans::context::task_llcx;

#[cfg(not(stage0))]
static task_local_insn_key: local_data::Key<@~[&'static str]> = &local_data::Key;
#[cfg(stage0)]
fn task_local_insn_key(_: @~[&'static str]) {}

pub fn with_insn_ctxt(blk: &fn(&[&'static str])) {
let opt = local_data::get(task_local_insn_key, |k| k.map(|&k| *k));
Expand Down
3 changes: 0 additions & 3 deletions src/librustc/middle/trans/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,6 @@ impl Drop for CrateContext {
}
}

#[cfg(stage0)]
fn task_local_llcx_key(_v: @ContextRef) {}
#[cfg(not(stage0))]
static task_local_llcx_key: local_data::Key<@ContextRef> = &local_data::Key;

pub fn task_llcx() -> ContextRef {
Expand Down
139 changes: 0 additions & 139 deletions src/librustc/middle/trans/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,6 @@ fn tuple_metadata(cx: &mut CrateContext,
span);
}

// The stage0 snapshot does not yet support the fixes from PR #7557, so there are two versions of
// following function for now
#[cfg(not(stage0))]
fn enum_metadata(cx: &mut CrateContext,
enum_type: ty::t,
enum_def_id: ast::def_id,
Expand Down Expand Up @@ -772,142 +769,6 @@ fn enum_metadata(cx: &mut CrateContext,
}
}

#[cfg(stage0)]
fn enum_metadata(cx: &mut CrateContext,
enum_type: ty::t,
enum_def_id: ast::def_id,
substs: &ty::substs,
span: span)
-> DIType {

let enum_name = ty_to_str(cx.tcx, enum_type);

// For empty enums there is an early exit. Just describe it as an empty struct with the
// appropriate type name
if ty::type_is_empty(cx.tcx, enum_type) {
return composite_type_metadata(cx, Type::nil(), enum_name, &[], &[], &[], span);
}

// Prepare some data (llvm type, size, align, ...) about the discriminant. This data will be
// needed in all of the following cases.
let discriminant_llvm_type = Type::enum_discrim(cx);
let (discriminant_size, discriminant_align) = size_and_align_of(cx, discriminant_llvm_type);

assert!(Type::enum_discrim(cx) == cx.int_type);
let discriminant_type_metadata = type_metadata(cx, ty::mk_int(), span);

let variants: &[@ty::VariantInfo] = *ty::enum_variants(cx.tcx, enum_def_id);

let enumerators_metadata: ~[DIDescriptor] = variants
.iter()
.transform(|v| {
let name: &str = cx.sess.str_of(v.name);
let discriminant_value = v.disr_val as c_ulonglong;

do name.as_c_str |name| {
unsafe {
llvm::LLVMDIBuilderCreateEnumerator(
DIB(cx),
name,
discriminant_value)
}
}
})
.collect();

let loc = span_start(cx, span);
let file_metadata = file_metadata(cx, loc.file.name);

let discriminant_type_metadata = do enum_name.as_c_str |enum_name| {
unsafe {
llvm::LLVMDIBuilderCreateEnumerationType(
DIB(cx),
file_metadata,
enum_name,
file_metadata,
loc.line as c_uint,
bytes_to_bits(discriminant_size),
bytes_to_bits(discriminant_align),
create_DIArray(DIB(cx), enumerators_metadata),
discriminant_type_metadata)
}
};

if ty::type_is_c_like_enum(cx.tcx, enum_type) {
return discriminant_type_metadata;
}

let is_univariant = variants.len() == 1;

let variants_metadata = do variants.map |&vi| {

let raw_types: &[ty::t] = vi.args;
let arg_types = do raw_types.map |&raw_type| { ty::subst(cx.tcx, substs, raw_type) };

let mut arg_llvm_types = do arg_types.map |&ty| { type_of::type_of(cx, ty) };
let mut arg_names = match vi.arg_names {
Some(ref names) => do names.map |ident| { cx.sess.str_of(*ident).to_owned() },
None => do arg_types.map |_| { ~"" }
};

let mut arg_metadata = do arg_types.map |&ty| { type_metadata(cx, ty, span) };

if !is_univariant {
arg_llvm_types.insert(0, discriminant_llvm_type);
arg_names.insert(0, ~"");
arg_metadata.insert(0, discriminant_type_metadata);
}

let variant_llvm_type = Type::struct_(arg_llvm_types, false);
let (variant_type_size, variant_type_align) = size_and_align_of(cx, variant_llvm_type);

let variant_type_metadata = composite_type_metadata(
cx,
variant_llvm_type,
&"",
arg_llvm_types,
arg_names,
arg_metadata,
span);

do "".as_c_str |name| {
unsafe {
llvm::LLVMDIBuilderCreateMemberType(
DIB(cx),
file_metadata,
name,
file_metadata,
loc.line as c_uint,
bytes_to_bits(variant_type_size),
bytes_to_bits(variant_type_align),
bytes_to_bits(0),
0,
variant_type_metadata)
}
}
};

let enum_llvm_type = type_of::type_of(cx, enum_type);
let (enum_type_size, enum_type_align) = size_and_align_of(cx, enum_llvm_type);

return do enum_name.as_c_str |enum_name| {
unsafe {
llvm::LLVMDIBuilderCreateUnionType(
DIB(cx),
file_metadata,
enum_name,
file_metadata,
loc.line as c_uint,
bytes_to_bits(enum_type_size),
bytes_to_bits(enum_type_align),
0, // Flags
create_DIArray(DIB(cx), variants_metadata),
0) // RuntimeLang
}
};
}


/// Creates debug information for a composite type, that is, anything that results in a LLVM struct.
///
/// Examples of Rust types to use this are: structs, tuples, boxes, vecs, and enums.
Expand Down
8 changes: 5 additions & 3 deletions src/librustpkg/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,8 @@ fn test_install_invalid() {

// Tests above should (maybe) be converted to shell out to rustpkg, too

#[test] #[ignore(cfg(target_arch = "x86"))]
// FIXME: #7956: temporarily disabled
#[ignore(cfg(target_arch = "x86"))]
fn test_install_git() {
let sysroot = test_sysroot();
debug!("sysroot = %s", sysroot.to_str());
Expand Down Expand Up @@ -566,7 +567,8 @@ fn test_package_ids_must_be_relative_path_like() {

}

#[test] #[ignore(cfg(target_arch = "x86"))]
// FIXME: #7956: temporarily disabled
#[ignore(cfg(target_arch = "x86"))]
fn test_package_version() {
let local_path = "mockgit.luolix.top/catamorphism/test_pkg_version";
let repo = init_git_repo(&Path(local_path));
Expand Down Expand Up @@ -678,7 +680,7 @@ fn rustpkg_install_url_2() {
&temp_dir);
}

#[test]
// FIXME: #7956: temporarily disabled
fn rustpkg_library_target() {
let foo_repo = init_git_repo(&Path("foo"));
let package_dir = foo_repo.push("foo");
Expand Down
1 change: 0 additions & 1 deletion src/libstd/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ A dynamic, mutable location.
Similar to a mutable option type, but friendlier.
*/

#[mutable] // XXX remove after snap
#[no_freeze]
#[deriving(Clone, DeepClone, Eq)]
#[allow(missing_doc)]
Expand Down
15 changes: 1 addition & 14 deletions src/libstd/cleanup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,6 @@ fn debug_mem() -> bool {
false
}

#[inline]
#[cfg(not(stage0))]
unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) {
// This function should be inlined when stage0 is gone
((*tydesc).drop_glue)(data);
}

#[inline]
#[cfg(stage0)]
unsafe fn call_drop_glue(tydesc: *TyDesc, data: *i8) {
((*tydesc).drop_glue)(0 as **TyDesc, data);
}

/// Destroys all managed memory (i.e. @ boxes) held by the current task.
pub unsafe fn annihilate() {
use rt::local_heap::local_free;
Expand Down Expand Up @@ -128,7 +115,7 @@ pub unsafe fn annihilate() {
if !uniq {
let tydesc: *TyDesc = transmute((*box).header.type_desc);
let data = transmute(&(*box).data);
call_drop_glue(tydesc, data);
((*tydesc).drop_glue)(data);
}
}

Expand Down
Loading

0 comments on commit 74f4bad

Please sign in to comment.