Skip to content

Rollup of 29 pull requests #40089

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 74 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
cbafac5
Fix compilation on Redox
jackpot51 Feb 9, 2017
0e45a5e
[rustbuild] add a way to run command after failure
nagisa Feb 16, 2017
047a215
Set rustdoc --test files' path relative to the current directory
GuillaumeGomez Feb 15, 2017
2e756e2
add solaris sparcv9 support
binarycrusader Feb 17, 2017
038a166
Properly display note/expected details
estebank Feb 17, 2017
6091330
Follow rename of mx_handle_wait Magenta syscalls
raphlinus Feb 17, 2017
5205e2f
Normalize labeled and unlabeled breaks
cramertj Feb 15, 2017
4d65622
Properly implement labeled breaks in while conditions
cramertj Feb 16, 2017
56e519d
Add tests for control flow in while condition
cramertj Feb 17, 2017
a611bbc
Rename hir::Label to hir::Destination
cramertj Feb 18, 2017
9322a38
Use ARM instead of SystemZ for testing not installed targets
petrochenkov Feb 18, 2017
e606a43
Fix rustdoc test with new file path
GuillaumeGomez Feb 19, 2017
df28569
bootstrap: stop trashing (DY)LD_LIBRARY_PATH
ishitatsuyuki Feb 19, 2017
a84eb95
check_match: don't treat privately uninhabited types as uninhabited
arielb1 Feb 20, 2017
25b1488
Simplify adaptive hashmap
arthurprs Feb 20, 2017
0b06db5
incr-comp: track the -Z sanitizer flag
Feb 21, 2017
7af3406
Set metadata for vtable-related loads
Aatch Feb 21, 2017
18b0f88
travis: Fuchsia builder
petrhosek Feb 17, 2017
d80cf80
Update codegen test with new attributes
Aatch Feb 21, 2017
305aca8
travis: Compile a more compatible libc.a for musl
alexcrichton Feb 21, 2017
9a08f40
travis: Move -mrelax-relocations to Docker config
alexcrichton Feb 21, 2017
347e1af
std: Relax UnwindSafe impl for Unique
alexcrichton Feb 21, 2017
163698c
Switch Fuchsia to readdir (instead of readdir_r)
raphlinus Feb 21, 2017
9ce8bb9
Add save-analysis data to nightly manifests.
nrc Feb 22, 2017
802a826
Stabilize static_recursion
cramertj Feb 22, 2017
f557e71
Ignore ASM tests on powerpc
er-1 Feb 22, 2017
ffc6ddd
add `-C overflow-checks` option
froydnj Feb 17, 2017
b576abd
detect "bootstrap outputs" when serializing the dep-graph
nikomatsakis Feb 22, 2017
81b9b3c
Update name_bytes, scoop up latest libc
raphlinus Feb 22, 2017
b3ee249
Merge branch 'master' of https://github.com/rust-lang/rust into readdir
raphlinus Feb 22, 2017
b7b58ff
Added test for inclusive_range_syntax in compile-fail test suite
nikhilshagri Feb 22, 2017
958fbc5
Make path separator replacement for subfiles as well
GuillaumeGomez Feb 22, 2017
6f0447b
Change break or continue with no label to error nmbr 590
cramertj Feb 23, 2017
4ecdc68
Move MacroKind into Def::Macro
keeperofdakeys Feb 23, 2017
da6dc53
Add macro suggestions for macros imported with `use`
keeperofdakeys Feb 23, 2017
ae32b6e
Better handling of lib defaults
wagenet Feb 21, 2017
4e2c993
trans: don't ICE when trying to create ADT trans-items
arielb1 Feb 23, 2017
69c5359
Add tests for lib defaults
wagenet Feb 23, 2017
87e544b
use a more conservative inhabitableness rule
arielb1 Feb 23, 2017
1b9b322
Implement non-capturing closure to fn coercion
est31 Feb 22, 2017
f753a6e
Feature gate
est31 Feb 23, 2017
21c3898
Two more tests
est31 Feb 23, 2017
77f131d
Review changes
est31 Feb 23, 2017
1f75085
Add Gankro's table to nomicon/src/phantom-data.md
Rufflewind Feb 24, 2017
07a8026
Move COMPILER_TESTS.md out of the root directory
danobi Feb 25, 2017
49a9b93
Rollup merge of #39859 - GuillaumeGomez:rustdoc-test-relative-path, r…
eddyb Feb 25, 2017
2cf3aa7
Rollup merge of #39864 - cramertj:normalize-breaks, r=nikomatsakis
eddyb Feb 25, 2017
6547e3d
Rollup merge of #39888 - nagisa:on-fail-bootstrap, r=alexcrichton
eddyb Feb 25, 2017
967357a
Rollup merge of #39903 - binarycrusader:issue-39901, r=alexcrichton
eddyb Feb 25, 2017
bed1113
Rollup merge of #39905 - estebank:useless-error, r=arielb1
eddyb Feb 25, 2017
8978248
Rollup merge of #39914 - raphlinus:mx_handle_wait, r=alexcrichton
eddyb Feb 25, 2017
30987d6
Rollup merge of #39918 - petrhosek:fuchsia-ci, r=alexcrichton
eddyb Feb 25, 2017
e62199a
Rollup merge of #39945 - petrochenkov:llvmtarg, r=alexcrichton
eddyb Feb 25, 2017
9273c89
Rollup merge of #39950 - ishitatsuyuki:stop-trashing-ldpath, r=alexcr…
eddyb Feb 25, 2017
fb3836a
Rollup merge of #39953 - keeperofdakeys:macro-error, r=jseyfried
eddyb Feb 25, 2017
6a0f654
Rollup merge of #39961 - redox-os:redox, r=alexcrichton
eddyb Feb 25, 2017
6446af5
Rollup merge of #39980 - arielb1:privately-uninhabited, r=nikomatsakis
eddyb Feb 25, 2017
045970f
Rollup merge of #39988 - arthurprs:hm-adapt2, r=alexcrichton
eddyb Feb 25, 2017
5e89830
Rollup merge of #39993 - japaric:incr-san, r=alexcrichton
eddyb Feb 25, 2017
e71db58
Rollup merge of #39995 - Aatch:vtable-ptr-metadata, r=arielb1
eddyb Feb 25, 2017
974151a
Rollup merge of #40019 - alexcrichton:fix-musl, r=brson
eddyb Feb 25, 2017
422979f
Rollup merge of #40020 - alexcrichton:fix-unwind-safe, r=sfackler
eddyb Feb 25, 2017
cf9e560
Rollup merge of #40022 - wagenet:lib-defaults, r=alexcrichton
eddyb Feb 25, 2017
a9a4f5a
Rollup merge of #40024 - raphlinus:readdir, r=alexcrichton
eddyb Feb 25, 2017
a7a349a
Rollup merge of #40025 - est31:master, r=eddyb
eddyb Feb 25, 2017
b0b29ef
Rollup merge of #40026 - nrc:analysis-manifest, r=alexcrichton
eddyb Feb 25, 2017
6b07e88
Rollup merge of #40027 - cramertj:stabilize_static_recursion, r=nrc
eddyb Feb 25, 2017
e7a9acb
Rollup merge of #40031 - cynicaldevil:master, r=est31
eddyb Feb 25, 2017
2d93019
Rollup merge of #40035 - er-1:master, r=alexcrichton
eddyb Feb 25, 2017
e69d234
Rollup merge of #40037 - froydnj:overflow-checks, r=alexcrichton
eddyb Feb 25, 2017
6251e95
Rollup merge of #40038 - nikomatsakis:issue-39828, r=michaelwoerister
eddyb Feb 25, 2017
f658ce4
Rollup merge of #40064 - arielb1:virtual-enum, r=nikomatsakis
eddyb Feb 25, 2017
d5f2371
Rollup merge of #40069 - Rufflewind:master, r=steveklabnik
eddyb Feb 25, 2017
9e919ad
Rollup merge of #40086 - danobi:move-compiler_tests, r=brson
eddyb Feb 25, 2017
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
Prev Previous commit
Next Next commit
Set metadata for vtable-related loads
Give LLVM much more information about vtable pointers. Without the extra
information, LLVM has to be rather pessimistic about vtables, preventing
a number of obvious optimisations.

* Makes the vtable pointer argument noalias and readonly.
* Marks loads of the vtable pointer as nonnull.
* Marks load from the vtable with `!invariant.load` metadata.

Fixes #39992
  • Loading branch information
Aatch committed Feb 21, 2017
commit 7af3406a49eb27f54d043cc45e99b986c7f05d7c
4 changes: 4 additions & 0 deletions src/librustc_trans/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,11 @@ impl FnType {
if let Some(inner) = rust_ptr_attrs(ty, &mut data) {
data.attrs.set(ArgAttribute::NonNull);
if ccx.tcx().struct_tail(inner).is_trait() {
// vtables can be safely marked non-null, readonly
// and noalias.
info.attrs.set(ArgAttribute::NonNull);
info.attrs.set(ArgAttribute::ReadOnly);
info.attrs.set(ArgAttribute::NoAlias);
}
}
args.push(data);
Expand Down
11 changes: 9 additions & 2 deletions src/librustc_trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,15 @@ pub fn load_fat_ptr<'a, 'tcx>(
b.load(ptr, alignment.to_align())
};

// FIXME: emit metadata on `meta`.
let meta = b.load(get_meta(b, src), alignment.to_align());
let meta = get_meta(b, src);
let meta_ty = val_ty(meta);
// If the 'meta' field is a pointer, it's a vtable, so use load_nonnull
// instead
let meta = if meta_ty.element_type().kind() == llvm::TypeKind::Pointer {
b.load_nonnull(meta, None)
} else {
b.load(meta, None)
};

(ptr, meta)
}
Expand Down
7 changes: 7 additions & 0 deletions src/librustc_trans/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
}
}

pub fn set_invariant_load(&self, load: ValueRef) {
unsafe {
llvm::LLVMSetMetadata(load, llvm::MD_invariant_load as c_uint,
llvm::LLVMMDNodeInContext(self.ccx.llcx(), ptr::null(), 0));
}
}

/// Returns the ptr value that should be used for storing `val`.
fn check_store<'b>(&self,
val: ValueRef,
Expand Down
10 changes: 9 additions & 1 deletion src/librustc_trans/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,15 @@ pub fn size_and_align_of_dst<'a, 'tcx>(bcx: &Builder<'a, 'tcx>, t: Ty<'tcx>, inf
let info = bcx.pointercast(info, Type::int(bcx.ccx).ptr_to());
let size_ptr = bcx.gepi(info, &[1]);
let align_ptr = bcx.gepi(info, &[2]);
(bcx.load(size_ptr, None), bcx.load(align_ptr, None))

let size = bcx.load(size_ptr, None);
let align = bcx.load(align_ptr, None);

// Vtable loads are invariant
bcx.set_invariant_load(size);
bcx.set_invariant_load(align);

(size, align)
}
ty::TySlice(_) | ty::TyStr => {
let unit_ty = t.sequence_element_type(bcx.tcx());
Expand Down
8 changes: 5 additions & 3 deletions src/librustc_trans/meth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ const VTABLE_OFFSET: usize = 3;
/// Extracts a method from a trait object's vtable, at the specified index.
pub fn get_virtual_method<'a, 'tcx>(bcx: &Builder<'a, 'tcx>,
llvtable: ValueRef,
vtable_index: usize)
-> ValueRef {
vtable_index: usize) -> ValueRef {
// Load the data pointer from the object.
debug!("get_virtual_method(vtable_index={}, llvtable={:?})",
vtable_index, Value(llvtable));

bcx.load(bcx.gepi(llvtable, &[vtable_index + VTABLE_OFFSET]), None)
let ptr = bcx.load_nonnull(bcx.gepi(llvtable, &[vtable_index + VTABLE_OFFSET]), None);
// Vtable loads are invariant
bcx.set_invariant_load(ptr);
ptr
}

/// Generate a shim function that allows an object type like `SomeTrait` to
Expand Down