Skip to content

Rollup of 11 pull requests #83247

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

Merged
merged 36 commits into from
Mar 18, 2021
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
1825810
Vec::dedup optimization
Soveu Feb 16, 2021
c114894
Vec::dedup optimization - panic gracefully
Soveu Feb 17, 2021
12c6a12
Emit error when trying to use assembler syntax directives in `asm!`
asquared31415 Feb 18, 2021
39dcd01
Take into account target default syntax
asquared31415 Feb 20, 2021
68f41b8
Add more links between hash and btree collections
jyn514 Feb 23, 2021
05ae666
Move default inline asm dialect to Session
asquared31415 Mar 8, 2021
4b13b81
Test x86 and arm outputs
asquared31415 Mar 9, 2021
2abab1f
Vec::dedup optimization - add tests
Soveu Mar 15, 2021
afdbc9e
Vec::dedup optimization - finishing polishes
Soveu Mar 15, 2021
d6a7c1d
Extend `proc_macro_back_compat` lint to `procedural-masquerade`
Aaron1011 Mar 15, 2021
2285f11
Vec::dedup optimization - add test for panic
Soveu Mar 15, 2021
96d6f22
Merge branch 'master' into dedup
Soveu Mar 15, 2021
1796cc0
Make source-based code coverage compatible with MIR inlining
tmiasko Mar 13, 2021
5a9538a
Functions inlined into reachable functions are reachable
tmiasko Mar 13, 2021
ad8f9af
Remove inline-instrument-coverage-fail.rs test case
tmiasko Mar 13, 2021
4b6cc0c
Add support for compile-flags in coverage tests
tmiasko Mar 15, 2021
0d84e0b
Add test case for -Zinline-mir & -Zinstrument-coverage
tmiasko Mar 16, 2021
bd2737f
ci/docker: Add SDK/NDK level 21 to android docker for 32bit platforms
kinnison Mar 16, 2021
b0092bc
Vec::dedup optimization - add benches
Soveu Mar 16, 2021
5bd50ef
Simplify C compilation for Fortanix-SGX target
Mar 16, 2021
e3031fe
Allow registering tool lints with `register_tool`
jyn514 Mar 16, 2021
f414c33
Display error details when a `mmap` call fails
JohnTitor Mar 17, 2021
a7491d9
fix whitespace
jyn514 Mar 17, 2021
ee98c6f
Don't show HTML diff if tidy isn't installed for rustdoc tests
GuillaumeGomez Mar 17, 2021
9a3e23f
riscvgc-unknown-none-elf use lp64d ABI
Mar 17, 2021
90797ef
Rollup merge of #82191 - Soveu:dedup, r=nagisa
Dylan-DPC Mar 17, 2021
16f6583
Rollup merge of #82270 - asquared31415:asm-syntax-directive-errors, r…
Dylan-DPC Mar 17, 2021
c99200f
Rollup merge of #82434 - jyn514:hash, r=JohnTitor
Dylan-DPC Mar 17, 2021
b688b69
Rollup merge of #83080 - tmiasko:inline-coverage, r=wesleywiser
Dylan-DPC Mar 17, 2021
7cd7dee
Rollup merge of #83168 - Aaron1011:lint-procedural-masquerade, r=petr…
Dylan-DPC Mar 17, 2021
1e23ab5
Rollup merge of #83192 - kinnison:add-android-21, r=Mark-Simulacrum
Dylan-DPC Mar 17, 2021
201893f
Rollup merge of #83204 - jethrogb:jb/sgx-c-build, r=joshtriplett,raou…
Dylan-DPC Mar 17, 2021
bcb9226
Rollup merge of #83216 - jyn514:register-tool, r=petrochenkov
Dylan-DPC Mar 17, 2021
0340045
Rollup merge of #83223 - JohnTitor:display-err-from-mmap, r=joshtriplett
Dylan-DPC Mar 17, 2021
22a9582
Rollup merge of #83228 - GuillaumeGomez:no-diff-if-no-tidy, r=jyn514
Dylan-DPC Mar 17, 2021
1839d1d
Rollup merge of #83231 - DieracDelta:lp64d-abi-for-riscvgc-unknown-no…
Dylan-DPC Mar 17, 2021
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
Vec::dedup optimization - finishing polishes
  • Loading branch information
Soveu committed Mar 15, 2021
commit afdbc9ece176ccac7b1d156efcb397d089d88b5a
18 changes: 7 additions & 11 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1538,13 +1538,9 @@ impl<T, A: Allocator> Vec<T, A> {

impl<'a, T, A: core::alloc::Allocator> Drop for FillGapOnDrop<'a, T, A> {
fn drop(&mut self) {
/* This code gets executed either at the end of `dedup_by` or
* when `same_bucket` panics */
/* This code gets executed when `same_bucket` panics */

/* SAFETY (if finishing successfully): self.read == len, so
* no data is copied and length is set correctly */

/* SAFETY (if panicing): invariant guarantees that `read - write`
/* SAFETY: invariant guarantees that `read - write`
* and `len - read` never overflow and that the copy is always
* in-bounds. */
unsafe {
Expand All @@ -1553,7 +1549,7 @@ impl<T, A: Allocator> Vec<T, A> {

/* How many items were left when `same_bucket` paniced.
* Basically vec[read..].len() */
let items_left = len - self.read;
let items_left = len.wrapping_sub(self.read);

/* Pointer to first item in vec[write..write+items_left] slice */
let dropped_ptr = ptr.add(self.write);
Expand All @@ -1566,15 +1562,14 @@ impl<T, A: Allocator> Vec<T, A> {

/* How many items have been already dropped
* Basically vec[read..write].len() */
let dropped = self.read - self.write;
let dropped = self.read.wrapping_sub(self.write);

self.vec.set_len(len - dropped);
}
}
}

let mut gap = FillGapOnDrop { read: 1, write: 1, vec: self };

let ptr = gap.vec.as_mut_ptr();

/* Drop items while going through Vec, it should be more efficient than
Expand All @@ -1593,8 +1588,9 @@ impl<T, A: Allocator> Vec<T, A> {
} else {
let write_ptr = ptr.add(gap.write);

/* Looks like doing just `copy` can be faster than
* conditional `copy_nonoverlapping` */
/* Because `read_ptr` can be equal to `write_ptr`, we either
* have to use `copy` or conditional `copy_nonoverlapping`.
* Looks like the first option is faster. */
ptr::copy(read_ptr, write_ptr, 1);

/* We have filled that place, so go further */
Expand Down