-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce the aggressiveness of reachability
Previously, all functions called by a reachable function were considered reachable, but this is only the case if the original function was possibly inlineable (if it's type generic or #[inline]-flagged).
- Loading branch information
1 parent
23df6f9
commit 681fda0
Showing
4 changed files
with
130 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2013 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. | ||
|
||
use std::unstable::dynamic_lib::DynamicLibrary; | ||
|
||
#[no_mangle] | ||
pub fn foo() { bar(); } | ||
|
||
pub fn foo2<T>() { | ||
fn bar2() { | ||
bar(); | ||
} | ||
bar2(); | ||
} | ||
|
||
#[no_mangle] | ||
fn bar() { } | ||
|
||
#[no_mangle] | ||
fn baz() { } | ||
|
||
pub fn test() { | ||
let lib = DynamicLibrary::open(None).unwrap(); | ||
unsafe { | ||
assert!(lib.symbol::<int>("foo").is_ok()); | ||
assert!(lib.symbol::<int>("baz").is_err()); | ||
assert!(lib.symbol::<int>("bar").is_err()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2013 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. | ||
|
||
// aux-build:linkage-visibility.rs | ||
// xfail-fast windows doesn't like aux-build | ||
|
||
extern mod foo(name = "linkage-visibility"); | ||
|
||
fn main() { | ||
foo::test(); | ||
foo::foo2::<int>(); | ||
foo::foo(); | ||
} |
681fda0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from pcwalton
at alexcrichton@681fda0
681fda0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging alexcrichton/rust/less-reachable = 681fda0 into auto
681fda0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alexcrichton/rust/less-reachable = 681fda0 merged ok, testing candidate = 3899f8d
681fda0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/2295
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-c/builds/141
success: http://buildbot.rust-lang.org/builders/auto-mac-32-nopt-t/builds/141
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/2299
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/1405
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/1404
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/2313
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/1405
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/1405
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/2314
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/1405
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/1405
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android/builds/1481
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2299
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/1403
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/1405
success: http://buildbot.rust-lang.org/builders/auto-bsd-64-opt/builds/2077
681fda0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = 3899f8d