Skip to content

Commit 8f2d922

Browse files
committed
---
yaml --- r: 83192 b: refs/heads/try c: 0efc482 h: refs/heads/master v: v3
1 parent 4d96950 commit 8f2d922

File tree

22 files changed

+1530
-286
lines changed

22 files changed

+1530
-286
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: 823ebb14ba6ed99df1198c6d1b47c5d2964196da
5+
refs/heads/try: 0efc4822e93221714aa7d142de44a057bdbad2ca
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libextra/workcache.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ impl Database {
198198
}
199199
}
200200

201-
// FIXME #4330: use &mut self here
202201
#[unsafe_destructor]
203202
impl Drop for Database {
204203
fn drop(&mut self) {

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

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2559,10 +2559,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
25592559
// LLVM type is not fully determined by the Rust type.
25602560
let (v, inlineable) = consts::const_expr(ccx, expr);
25612561
ccx.const_values.insert(id, v);
2562-
if !inlineable {
2563-
debug!("%s not inlined", sym);
2564-
ccx.non_inlineable_statics.insert(id);
2565-
}
2562+
let mut inlineable = inlineable;
25662563
exprt = true;
25672564

25682565
unsafe {
@@ -2578,8 +2575,30 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
25782575
lib::llvm::SetUnnamedAddr(g, true);
25792576
lib::llvm::SetLinkage(g,
25802577
lib::llvm::InternalLinkage);
2578+
2579+
// This is a curious case where we must make
2580+
// all of these statics inlineable. If a
2581+
// global is tagged as
2582+
// address_insignificant, then LLVM won't
2583+
// coalesce globals unless they have an
2584+
// internal linkage type. This means that
2585+
// external crates cannot use this global.
2586+
// This is a problem for things like inner
2587+
// statics in generic functions, because the
2588+
// function will be inlined into another
2589+
// crate and then attempt to link to the
2590+
// static in the original crate, only to
2591+
// find that it's not there. On the other
2592+
// side of inlininig, the crates knows to
2593+
// not declare this static as
2594+
// available_externally (because it isn't)
2595+
inlineable = true;
25812596
}
25822597

2598+
if !inlineable {
2599+
debug!("%s not inlined", sym);
2600+
ccx.non_inlineable_statics.insert(id);
2601+
}
25832602
ccx.item_symbols.insert(i.id, sym);
25842603
g
25852604
}

branches/try/src/librustc/middle/trans/inline.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use std::vec;
2121
use syntax::ast;
2222
use syntax::ast_map::path_name;
2323
use syntax::ast_util::local_def;
24+
use syntax::attr;
2425

2526
pub fn maybe_instantiate_inline(ccx: @mut CrateContext, fn_id: ast::DefId)
2627
-> ast::DefId {
@@ -68,7 +69,12 @@ pub fn maybe_instantiate_inline(ccx: @mut CrateContext, fn_id: ast::DefId)
6869
match item.node {
6970
ast::item_static(*) => {
7071
let g = get_item_val(ccx, item.id);
71-
SetLinkage(g, AvailableExternallyLinkage);
72+
// see the comment in get_item_val() as to why this check is
73+
// performed here.
74+
if !attr::contains_name(item.attrs,
75+
"address_insignificant") {
76+
SetLinkage(g, AvailableExternallyLinkage);
77+
}
7278
}
7379
_ => {}
7480
}

branches/try/src/libstd/os.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,7 @@ pub fn env() -> ~[(~str,~str)] {
196196
if (ch as uint == 0) {
197197
fail!("os::env() failure getting env string from OS: %s", os::last_os_error());
198198
}
199-
let mut curr_ptr: uint = ch as uint;
200-
let mut result = ~[];
201-
while(*(curr_ptr as *libc::c_char) != 0 as libc::c_char) {
202-
let env_pair = str::raw::from_c_str(
203-
curr_ptr as *libc::c_char);
204-
result.push(env_pair);
205-
curr_ptr +=
206-
libc::strlen(curr_ptr as *libc::c_char) as uint
207-
+ 1;
208-
}
199+
let result = str::raw::from_c_multistring(ch as *libc::c_char, None);
209200
FreeEnvironmentStringsA(ch);
210201
result
211202
}

0 commit comments

Comments
 (0)