Skip to content

Commit ba81d43

Browse files
committed
---
yaml --- r: 148277 b: refs/heads/try2 c: 0e885e4 h: refs/heads/master i: 148275: 6d33c00 v: v3
1 parent 46cfe2c commit ba81d43

32 files changed

+268
-308
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: e063e96ec90544c9ffa811396d14541761656d07
8+
refs/heads/try2: 0e885e42b1292fe2592488a52c35d54b9fe50fb8
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/Makefile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ export CFG_ENABLE_MINGW_CROSS
417417
export CFG_PREFIX
418418
export CFG_LIBDIR
419419
export CFG_RUSTLIBDIR
420-
export CFG_LIBDIR_RELATIVE
420+
export LIBDIR_RELATIVE
421421

422422
######################################################################
423423
# Subprograms
@@ -435,7 +435,7 @@ define SREQ
435435
# Destinations of artifacts for the host compiler
436436
HROOT$(1)_H_$(3) = $(3)/stage$(1)
437437
HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
438-
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
438+
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(LIBDIR_RELATIVE)
439439

440440
# Destinations of artifacts for target architectures
441441
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/$$(CFG_RUSTLIBDIR)/$(2)

branches/try2/configure

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,13 @@ valopt mandir "${CFG_PREFIX}/share/man" "install man pages in PATH"
401401
# On windows we just store the libraries in the bin directory because
402402
# there's no rpath
403403
# FIXME: Thise needs to parameterized over target triples. Do it in platform.mk
404-
CFG_LIBDIR_RELATIVE=lib
404+
LIBDIR_RELATIVE=lib
405405
if [ "$CFG_OSTYPE" = "pc-mingw32" ]
406406
then
407-
CFG_LIBDIR_RELATIVE=bin
407+
LIBDIR_RELATIVE=bin
408408
fi
409409

410-
valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries"
410+
valopt libdir "${CFG_PREFIX}/${LIBDIR_RELATIVE}" "install libraries"
411411
valopt rustlibdir "rustlib" "subdirectory name for rustc's libraries"
412412

413413
# Validate Options
@@ -771,16 +771,16 @@ do
771771
make_dir $h/stage$i/bin
772772

773773
# host lib dir
774-
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE
774+
make_dir $h/stage$i/$LIBDIR_RELATIVE
775775

776776
# host test dir
777777
make_dir $h/stage$i/test
778778

779779
# target bin dir
780-
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/$CFG_RUSTLIBDIR/$t/bin
780+
make_dir $h/stage$i/$LIBDIR_RELATIVE/$CFG_RUSTLIBDIR/$t/bin
781781

782782
# target lib dir
783-
make_dir $h/stage$i/$CFG_LIBDIR_RELATIVE/$CFG_RUSTLIBDIR/$t/lib
783+
make_dir $h/stage$i/$LIBDIR_RELATIVE/$CFG_RUSTLIBDIR/$t/lib
784784
done
785785
done
786786

@@ -1037,7 +1037,7 @@ putvar CFG_TARGET
10371037
putvar CFG_C_COMPILER
10381038
putvar CFG_LIBDIR
10391039
putvar CFG_RUSTLIBDIR
1040-
putvar CFG_LIBDIR_RELATIVE
1040+
putvar LIBDIR_RELATIVE
10411041
putvar CFG_DISABLE_MANAGE_SUBMODULES
10421042
putvar CFG_ANDROID_CROSS_PATH
10431043
putvar CFG_MINGW32_CROSS_PATH

branches/try2/mk/host.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ $$(HLIB$(2)_H_$(4))/$(CFG_LIBNATIVE_$(4)): \
149149
$$(HBIN$(2)_H_$(4))/:
150150
mkdir -p $$@
151151

152-
ifneq ($(CFG_LIBDIR_RELATIVE),bin)
152+
ifneq ($(LIBDIR_RELATIVE),bin)
153153
$$(HLIB$(2)_H_$(4))/:
154154
mkdir -p $$@
155155
endif

branches/try2/mk/tests.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ endif
103103
ifdef CFG_WINDOWSY_$(1)
104104
CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)$$(2)/$$(strip \
105105
$$(if $$(findstring stage0,$$(1)), \
106-
stage0/$$(CFG_LIBDIR_RELATIVE), \
106+
stage0/$$(LIBDIR_RELATIVE), \
107107
$$(if $$(findstring stage1,$$(1)), \
108-
stage1/$$(CFG_LIBDIR_RELATIVE), \
108+
stage1/$$(LIBDIR_RELATIVE), \
109109
$$(if $$(findstring stage2,$$(1)), \
110-
stage2/$$(CFG_LIBDIR_RELATIVE), \
110+
stage2/$$(LIBDIR_RELATIVE), \
111111
$$(if $$(findstring stage3,$$(1)), \
112-
stage3/$$(CFG_LIBDIR_RELATIVE), \
112+
stage3/$$(LIBDIR_RELATIVE), \
113113
)))))/$$(CFG_RUSTLIBDIR)/$$(CFG_BUILD)/lib
114114
CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(3)),$$(1))
115115
endif

branches/try2/src/librustc/metadata/filesearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ pub fn rust_path() -> ~[Path] {
244244
// The name of the directory rustc expects libraries to be located.
245245
// On Unix should be "lib", on windows "bin"
246246
pub fn libdir() -> ~str {
247-
(env!("CFG_LIBDIR_RELATIVE")).to_owned()
247+
(env!("LIBDIR_RELATIVE")).to_owned()
248248
}
249249

250250
// The name of rustc's own place to organize libraries.

branches/try2/src/librustc/middle/trans/_match.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,14 +1584,9 @@ fn compile_submatch_continue<'r,
15841584
}
15851585

15861586
if any_uniq_pat(m, col) {
1587-
let pat_ty = node_id_type(bcx, pat_id);
15881587
let llbox = Load(bcx, val);
1589-
let unboxed = match ty::get(pat_ty).sty {
1590-
ty::ty_uniq(..) if !ty::type_contents(bcx.tcx(), pat_ty).owns_managed() => llbox,
1591-
_ => GEPi(bcx, llbox, [0u, abi::box_field_body])
1592-
};
15931588
compile_submatch(bcx, enter_uniq(bcx, dm, m, col, val),
1594-
vec::append(~[unboxed], vals_left), chk);
1589+
vec::append(~[llbox], vals_left), chk);
15951590
return;
15961591
}
15971592

@@ -2231,13 +2226,8 @@ fn bind_irrefutable_pat<'a>(
22312226
}
22322227
}
22332228
ast::PatUniq(inner) => {
2234-
let pat_ty = node_id_type(bcx, pat.id);
22352229
let llbox = Load(bcx, val);
2236-
let unboxed = match ty::get(pat_ty).sty {
2237-
ty::ty_uniq(..) if !ty::type_contents(bcx.tcx(), pat_ty).owns_managed() => llbox,
2238-
_ => GEPi(bcx, llbox, [0u, abi::box_field_body])
2239-
};
2240-
bcx = bind_irrefutable_pat(bcx, inner, unboxed, binding_mode);
2230+
bcx = bind_irrefutable_pat(bcx, inner, llbox, binding_mode);
22412231
}
22422232
ast::PatRegion(inner) => {
22432233
let loaded_val = Load(bcx, val);

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 41 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -177,57 +177,32 @@ impl<'a> Drop for StatRecorder<'a> {
177177
}
178178

179179
// only use this for foreign function ABIs and glue, use `decl_rust_fn` for Rust functions
180-
fn decl_fn(llmod: ModuleRef, name: &str, cc: lib::llvm::CallConv,
181-
ty: Type, output: ty::t) -> ValueRef {
180+
pub fn decl_fn(llmod: ModuleRef, name: &str, cc: lib::llvm::CallConv, ty: Type) -> ValueRef {
182181
let llfn: ValueRef = name.with_c_str(|buf| {
183182
unsafe {
184183
llvm::LLVMGetOrInsertFunction(llmod, buf, ty.to_ref())
185184
}
186185
});
187186

188-
match ty::get(output).sty {
189-
// functions returning bottom may unwind, but can never return normally
190-
ty::ty_bot => {
191-
unsafe {
192-
llvm::LLVMAddFunctionAttr(llfn, lib::llvm::NoReturnAttribute as c_uint)
193-
}
194-
}
195-
// `~` pointer return values never alias because ownership is transferred
196-
// FIXME #6750 ~Trait cannot be directly marked as
197-
// noalias because the actual object pointer is nested.
198-
ty::ty_uniq(..) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) |
199-
ty::ty_vec(_, ty::vstore_uniq) | ty::ty_str(ty::vstore_uniq) => {
200-
unsafe {
201-
llvm::LLVMAddReturnAttribute(llfn, lib::llvm::NoAliasAttribute as c_uint);
202-
}
203-
}
204-
_ => {}
205-
}
206-
207187
lib::llvm::SetFunctionCallConv(llfn, cc);
208188
// Function addresses in Rust are never significant, allowing functions to be merged.
209189
lib::llvm::SetUnnamedAddr(llfn, true);
210-
211-
llfn
190+
return llfn;
212191
}
213192

214193
// only use this for foreign function ABIs and glue, use `decl_rust_fn` for Rust functions
215-
pub fn decl_cdecl_fn(llmod: ModuleRef,
216-
name: &str,
217-
ty: Type,
218-
output: ty::t) -> ValueRef {
219-
decl_fn(llmod, name, lib::llvm::CCallConv, ty, output)
194+
pub fn decl_cdecl_fn(llmod: ModuleRef, name: &str, ty: Type) -> ValueRef {
195+
return decl_fn(llmod, name, lib::llvm::CCallConv, ty);
220196
}
221197

222198
// only use this for foreign function ABIs and glue, use `get_extern_rust_fn` for Rust functions
223-
pub fn get_extern_fn(externs: &mut ExternMap, llmod: ModuleRef,
224-
name: &str, cc: lib::llvm::CallConv,
225-
ty: Type, output: ty::t) -> ValueRef {
199+
pub fn get_extern_fn(externs: &mut ExternMap, llmod: ModuleRef, name: &str,
200+
cc: lib::llvm::CallConv, ty: Type) -> ValueRef {
226201
match externs.find_equiv(&name) {
227202
Some(n) => return *n,
228-
None => {}
203+
None => ()
229204
}
230-
let f = decl_fn(llmod, name, cc, ty, output);
205+
let f = decl_fn(llmod, name, cc, ty);
231206
externs.insert(name.to_owned(), f);
232207
f
233208
}
@@ -258,7 +233,24 @@ fn decl_rust_fn(ccx: &CrateContext,
258233
output: ty::t,
259234
name: &str) -> ValueRef {
260235
let llfty = type_of_rust_fn(ccx, self_ty, inputs, output);
261-
let llfn = decl_cdecl_fn(ccx.llmod, name, llfty, output);
236+
let llfn = decl_cdecl_fn(ccx.llmod, name, llfty);
237+
238+
match ty::get(output).sty {
239+
// functions returning bottom may unwind, but can never return normally
240+
ty::ty_bot => {
241+
unsafe {
242+
llvm::LLVMAddFunctionAttr(llfn, lib::llvm::NoReturnAttribute as c_uint)
243+
}
244+
}
245+
// `~` pointer return values never alias because ownership is transferred
246+
ty::ty_uniq(..) |
247+
ty::ty_vec(_, ty::vstore_uniq) => {
248+
unsafe {
249+
llvm::LLVMAddReturnAttribute(llfn, lib::llvm::NoAliasAttribute as c_uint);
250+
}
251+
}
252+
_ => ()
253+
}
262254

263255
let uses_outptr = type_of::return_uses_outptr(ccx, output);
264256
let offset = if uses_outptr { 2 } else { 1 };
@@ -267,10 +259,8 @@ fn decl_rust_fn(ccx: &CrateContext,
267259
let llarg = unsafe { llvm::LLVMGetParam(llfn, (offset + i) as c_uint) };
268260
match ty::get(arg_ty).sty {
269261
// `~` pointer parameters never alias because ownership is transferred
270-
// FIXME #6750 ~Trait cannot be directly marked as
271-
// noalias because the actual object pointer is nested.
272-
ty::ty_uniq(..) | // ty::ty_trait(_, _, ty::UniqTraitStore, _, _) |
273-
ty::ty_vec(_, ty::vstore_uniq) | ty::ty_str(ty::vstore_uniq) |
262+
ty::ty_uniq(..) |
263+
ty::ty_vec(_, ty::vstore_uniq) |
274264
ty::ty_closure(ty::ClosureTy {sigil: ast::OwnedSigil, ..}) => {
275265
unsafe {
276266
llvm::LLVMAddAttribute(llarg, lib::llvm::NoAliasAttribute as c_uint);
@@ -368,7 +358,7 @@ pub fn malloc_raw_dyn<'a>(
368358
} else {
369359
// we treat ~fn, @fn and @[] as @ here, which isn't ideal
370360
let langcall = match heap {
371-
heap_managed | heap_managed_unique => {
361+
heap_managed => {
372362
require_alloc_fn(bcx, t, MallocFnLangItem)
373363
}
374364
heap_exchange_closure => {
@@ -392,9 +382,7 @@ pub fn malloc_raw_dyn<'a>(
392382
langcall,
393383
[tydesc, size],
394384
None);
395-
let r = rslt(r.bcx, PointerCast(r.bcx, r.val, llty));
396-
maybe_set_managed_unique_rc(r.bcx, r.val, heap);
397-
r
385+
rslt(r.bcx, PointerCast(r.bcx, r.val, llty))
398386
}
399387
}
400388

@@ -441,27 +429,6 @@ pub fn malloc_general<'a>(bcx: &'a Block, t: ty::t, heap: heap)
441429
malloc_general_dyn(bcx, t, heap, llsize_of(bcx.ccx(), ty))
442430
}
443431

444-
pub fn heap_for_unique(bcx: &Block, t: ty::t) -> heap {
445-
if ty::type_contents(bcx.tcx(), t).owns_managed() {
446-
heap_managed_unique
447-
} else {
448-
heap_exchange
449-
}
450-
}
451-
452-
pub fn maybe_set_managed_unique_rc(bcx: &Block, bx: ValueRef, heap: heap) {
453-
assert!(heap != heap_exchange);
454-
if heap == heap_managed_unique {
455-
// In cases where we are looking at a unique-typed allocation in the
456-
// managed heap (thus have refcount 1 from the managed allocator),
457-
// such as a ~(@foo) or such. These need to have their refcount forced
458-
// to -2 so the annihilator ignores them.
459-
let rc = GEPi(bcx, bx, [0u, abi::box_field_refcnt]);
460-
let rc_val = C_int(bcx.ccx(), -2);
461-
Store(bcx, rc_val, rc);
462-
}
463-
}
464-
465432
// Type descriptor and type glue stuff
466433

467434
pub fn get_tydesc_simple(ccx: &CrateContext, t: ty::t) -> ValueRef {
@@ -592,8 +559,11 @@ pub fn get_res_dtor(ccx: @CrateContext,
592559

593560
{
594561
let mut externs = ccx.externs.borrow_mut();
595-
get_extern_fn(externs.get(), ccx.llmod, name,
596-
lib::llvm::CCallConv, llty, ty::mk_nil())
562+
get_extern_fn(externs.get(),
563+
ccx.llmod,
564+
name,
565+
lib::llvm::CCallConv,
566+
llty)
597567
}
598568
}
599569
}
@@ -924,8 +894,7 @@ pub fn trans_external_path(ccx: &CrateContext, did: ast::DefId, t: ty::t) -> Val
924894
let cconv = c.unwrap_or(lib::llvm::CCallConv);
925895
let llty = type_of_fn_from_ty(ccx, None, t);
926896
let mut externs = ccx.externs.borrow_mut();
927-
get_extern_fn(externs.get(), ccx.llmod, name,
928-
cconv, llty, fn_ty.sig.output)
897+
get_extern_fn(externs.get(), ccx.llmod, name, cconv, llty)
929898
}
930899
}
931900
}
@@ -2541,13 +2510,13 @@ pub fn register_fn_llvmty(ccx: @CrateContext,
25412510
sym: ~str,
25422511
node_id: ast::NodeId,
25432512
cc: lib::llvm::CallConv,
2544-
fn_ty: Type,
2545-
output: ty::t) -> ValueRef {
2513+
fn_ty: Type)
2514+
-> ValueRef {
25462515
debug!("register_fn_fuller creating fn for item {} with path {}",
25472516
node_id,
25482517
ast_map::path_to_str(item_path(ccx, &node_id), token::get_ident_interner()));
25492518

2550-
let llfn = decl_fn(ccx.llmod, sym, cc, fn_ty, output);
2519+
let llfn = decl_fn(ccx.llmod, sym, cc, fn_ty);
25512520
finish_register_fn(ccx, sp, sym, node_id, llfn);
25522521
llfn
25532522
}
@@ -2579,7 +2548,7 @@ pub fn create_entry_wrapper(ccx: @CrateContext,
25792548
let llfty = Type::func([ccx.int_type, Type::i8().ptr_to().ptr_to()],
25802549
&ccx.int_type);
25812550

2582-
let llfn = decl_cdecl_fn(ccx.llmod, "main", llfty, ty::mk_nil());
2551+
let llfn = decl_cdecl_fn(ccx.llmod, "main", llfty);
25832552
let llbb = "top".with_c_str(|buf| {
25842553
unsafe {
25852554
llvm::LLVMAppendBasicBlockInContext(ccx.llcx, llfn, buf)
@@ -2983,8 +2952,7 @@ pub fn p2i(ccx: &CrateContext, v: ValueRef) -> ValueRef {
29832952
macro_rules! ifn (
29842953
($intrinsics:ident, $name:expr, $args:expr, $ret:expr) => ({
29852954
let name = $name;
2986-
// HACK(eddyb) dummy output type, shouln't affect anything.
2987-
let f = decl_cdecl_fn(llmod, name, Type::func($args, &$ret), ty::mk_nil());
2955+
let f = decl_cdecl_fn(llmod, name, Type::func($args, &$ret));
29882956
$intrinsics.insert(name, f);
29892957
})
29902958
)

branches/try2/src/librustc/middle/trans/closure.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,6 @@ pub fn mk_closure_tys(tcx: ty::ctxt,
150150
return cdata_ty;
151151
}
152152

153-
fn heap_for_unique_closure(bcx: &Block, t: ty::t) -> heap {
154-
if ty::type_contents(bcx.tcx(), t).owns_managed() {
155-
heap_managed_unique
156-
} else {
157-
heap_exchange_closure
158-
}
159-
}
160-
161153
pub fn allocate_cbox<'a>(
162154
bcx: &'a Block<'a>,
163155
sigil: ast::Sigil,
@@ -173,7 +165,7 @@ pub fn allocate_cbox<'a>(
173165
tcx.sess.bug("trying to trans allocation of @fn")
174166
}
175167
ast::OwnedSigil => {
176-
malloc_raw(bcx, cdata_ty, heap_for_unique_closure(bcx, cdata_ty))
168+
malloc_raw(bcx, cdata_ty, heap_exchange_closure)
177169
}
178170
ast::BorrowedSigil => {
179171
let cbox_ty = tuplify_box_ty(tcx, cdata_ty);

branches/try2/src/librustc/middle/trans/common.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ pub fn warn_not_to_commit(ccx: &CrateContext, msg: &str) {
316316
#[deriving(Eq)]
317317
pub enum heap {
318318
heap_managed,
319-
heap_managed_unique,
320319
heap_exchange,
321320
heap_exchange_closure
322321
}
@@ -498,7 +497,7 @@ pub fn add_clean_temp_mem_in_scope_(bcx: &Block, scope_id: Option<ast::NodeId>,
498497

499498
pub fn add_clean_free(cx: &Block, ptr: ValueRef, heap: heap) {
500499
let free_fn = match heap {
501-
heap_managed | heap_managed_unique => {
500+
heap_managed => {
502501
@GCHeapFreeingCleanupFunction {
503502
ptr: ptr,
504503
} as @CleanupFunction

0 commit comments

Comments
 (0)