Commit Graph

196282 Commits

Author SHA1 Message Date
bors
50166d5e5e Auto merge of #98748 - saethlin:optimize-bufreader, r=Mark-Simulacrum
Remove some redundant checks from BufReader

The implementation of BufReader contains a lot of redundant checks. While any one of these checks is not particularly expensive to execute, especially when taken together they dramatically inhibit LLVM's ability to make subsequent optimizations by confusing data flow increasing the code size of anything that uses BufReader.

In particular, these changes have a ~2x increase on the benchmark that this adds a `black_box` to. I'm adding that `black_box` here just in case LLVM gets clever enough to remove the reads entirely. Right now it can't, but these optimizations are really setting it up to do so.

We get this optimization by factoring all the actual buffer management and bounds-checking logic into a new module inside `bufreader` with a new `Buffer` type. This makes it much easier to ensure that we have correctly encapsulated the management of the region of the buffer that we have read bytes into, and it lets us provide a new faster way to do small reads. `Buffer::consume_with` lets a caller do a read from the buffer with a single bounds check, instead of the double-check that's required to use `buffer` + `consume`.

Unfortunately I'm not aware of a lot of open-source usage of `BufReader` in perf-critical environments. Some time ago I tweaked this code because I saw `BufReader` in a profile at work, and I contributed some benchmarks to the `bincode` crate which exercise `BufReader::buffer`. These changes appear to help those benchmarks at little, but all these sorts of benchmarks are kind of fragile so I'm wary of quoting anything specific.
2022-07-27 09:49:06 +00:00
bors
d814681429 Auto merge of #9249 - JohnTitor:book-prefer-checkout-v3, r=flip1995
Use `action/checkout@v3` in the book

As this type of document is often copied/pasted, using a newer version of `actions/checkout` would be better.

changelog: none

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-27 08:20:55 +00:00
Yuki Okushi
9164e3aa52
Use action/checkout@v3 in the book
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-27 16:49:34 +09:00
bors
ff693dc7b8 Auto merge of #99778 - ehuss:update-cargo, r=ehuss
Update cargo

5 commits in d8d30a75376f78bb0fabe3d28ee9d87aa8035309..85b500ccad8cd0b63995fd94a03ddd4b83f7905b
2022-07-19 13:59:17 +0000 to 2022-07-24 21:10:46 +0000
- Make the empty rustc-wrapper test more explicit. (rust-lang/cargo#10899)
- expand RUSTC_WRAPPER docs (rust-lang/cargo#10896)
- Stabilize Workspace Inheritance (rust-lang/cargo#10859)
- Fix typo in unstable docs: s/PROGJCT/PROJECT/ (rust-lang/cargo#10890)
- refactor(source): Open query API for adding more types of queries (rust-lang/cargo#10883)
2022-07-27 06:59:51 +00:00
Michael Goulet
1694ea1873 use check_region_obligations_and_report_errors in more places to avoid ICEs 2022-07-27 05:34:29 +00:00
bors
e33cc71a61 Auto merge of #99792 - JohnTitor:rollup-20i7ewx, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #98583 (Stabilize Windows `FileTypeExt` with `is_symlink_dir` and `is_symlink_file`)
 - #99698 (Prefer visibility map parents that are not `doc(hidden)` first)
 - #99700 (Add a clickable link to the layout section)
 - #99712 (passes: port more of `check_attr` module)
 - #99759 (Remove dead code from cg_llvm)
 - #99765 (Don't build std for *-uefi targets)
 - #99771 (Update pulldown-cmark version to 0.9.2 (fixes url encoding for some chars))
 - #99775 (rustdoc: do not allocate String when writing path full name)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-27 04:18:49 +00:00
Yuki Okushi
0d5bdcac5f
Rollup merge of #99775 - notriddle:notriddle/as-str, r=camelid
rustdoc: do not allocate String when writing path full name

No idea if this makes any perf difference, but it just seems like premature pessimisation to use String when str will do.
2022-07-27 11:52:59 +09:00
Yuki Okushi
f8f07dece7
Rollup merge of #99771 - GuillaumeGomez:update-pulldown-cmark, r=Urgau
Update pulldown-cmark version to 0.9.2 (fixes url encoding for some chars)

Fixes https://github.com/rust-lang/rust/issues/97125.

r? ``@Dylan-DPC``
2022-07-27 11:52:58 +09:00
Yuki Okushi
a76f2fe66e
Rollup merge of #99765 - nicholasbishop:bishop-disable-uefi-std-build, r=jyn514
Don't build std for *-uefi targets

https://github.com/rust-lang/rust/issues/97322
2022-07-27 11:52:57 +09:00
Yuki Okushi
7f608e99dc
Rollup merge of #99759 - bjorn3:remove_llvm_dead_code, r=nikic
Remove dead code from cg_llvm

Found while working on https://github.com/rust-lang/rust/pull/97485
2022-07-27 11:52:56 +09:00
Yuki Okushi
fe51d07b99
Rollup merge of #99712 - davidtwco:translation-migrate-passes-2, r=compiler-errors
passes: port more of `check_attr` module

Continues from #99213.

Port more diagnostics in `rustc_passes::check_attr` to using the diagnostic derive and translation machinery.

r? `@compiler-errors`
2022-07-27 11:52:55 +09:00
Yuki Okushi
181bf05d86
Rollup merge of #99700 - est31:rustdoc_layout_heading, r=GuillaumeGomez
Add a clickable link to the layout section

The layout section (activated by `--show-type-layout`) is currently not linkable to (outside of chrome's link to text feature). This PR makes it linkable via `#layout`.
2022-07-27 11:52:54 +09:00
Yuki Okushi
3ca1c3100d
Rollup merge of #99698 - compiler-errors:no-doc-hidden, r=cjgillot
Prefer visibility map parents that are not `doc(hidden)` first

Far simpler approach to #98876.

This only fixes the case where the parent is `doc(hidden)`, not where the child is `doc(hidden)` since I don't know how to get the attrs on the import statement given a `ModChild`... I'll try to follow up with that, but this is a good first step.
2022-07-27 11:52:53 +09:00
Yuki Okushi
1ff84f09b2
Rollup merge of #98583 - joshtriplett:stabilize-windows-symlink-types, r=thomcc
Stabilize Windows `FileTypeExt` with `is_symlink_dir` and `is_symlink_file`

These calls allow detecting whether a symlink is a file or a directory,
a distinction Windows maintains, and one important to software that
wants to do further operations on the symlink (e.g. removing it).
2022-07-27 11:52:52 +09:00
Ben Kimock
746afe8952 Clarify safety comments 2022-07-26 21:25:56 -04:00
bors
b573e10d21 Auto merge of #98553 - the8472:next_chunk_opt, r=Mark-Simulacrum
Optimized vec::IntoIter::next_chunk impl

```
x86_64v1, default
test vec::bench_next_chunk                               ... bench:         696 ns/iter (+/- 22)
x86_64v1, pr
test vec::bench_next_chunk                               ... bench:         309 ns/iter (+/- 4)

znver2, default
test vec::bench_next_chunk                               ... bench:      17,272 ns/iter (+/- 117)
znver2, pr
test vec::bench_next_chunk                               ... bench:         211 ns/iter (+/- 3)
```

On znver2 the default impl seems to be slow due to different inlining decisions. It goes through `core::array::iter_next_chunk`
which has a deep call tree.
2022-07-27 01:12:30 +00:00
Takayuki Maeda
ddd326fda4 use pluralize! 2022-07-27 10:09:06 +09:00
Ben Kimock
5fa1926634 Add Buffer::consume_with to enable direct buffer access with one check 2022-07-26 20:16:55 -04:00
Serial
f31937043d Implicitly set --type=cargo when using --category=cargo 2022-07-26 19:32:34 -04:00
Serial
c8ee8c30f0 Give the user more information during creation 2022-07-26 19:18:10 -04:00
Ben Kimock
e2e3a88771 Explain how *mut [T] helps, and how we rely on the check in split_at_mut 2022-07-26 18:37:00 -04:00
Michael Howell
9dcf1d9c1a rustdoc: remove Clean trait impl for ty::PolyTraitPredicate 2022-07-26 15:33:17 -07:00
Michael Howell
e94ef5cc76 rustdoc: remove Clean trait impls for ty::OutlivesPredicate 2022-07-26 15:33:13 -07:00
Michael Howell
791beb7a5c rustdoc: remove Clean trait impl for ProjectionPredicate 2022-07-26 15:33:10 -07:00
Michael Howell
4443fd5d76 rustdoc: remove Clean trait impl for ProjectionTy 2022-07-26 15:33:04 -07:00
Jubilee Young
d48a869b9d Force the Cow into a String 2022-07-26 14:45:28 -07:00
Jubilee Young
79e0543060 Use String::from_utf8_lossy in CStr demo 2022-07-26 13:26:05 -07:00
Eric Huss
56a7738c97 Update cargo 2022-07-26 12:48:39 -07:00
The 8472
4ba7cac359 add test for vec::IntoIter::next_chunk() impl
an adaption of the default impl's doctest
2022-07-26 21:43:25 +02:00
bors
4d6d601c8a Auto merge of #99574 - durin42:allocator-patch-redux, r=nikic
codegen: use new {re,de,}allocator annotations in llvm

This obviates the patch that teaches LLVM internals about
_rust_{re,de}alloc functions by putting annotations directly in the IR
for the optimizer.

The sole test change is required to anchor FileCheck to the body of the
`box_uninitialized` method, so it doesn't see the `allocalign` on
`__rust_alloc` and get mad about the string `alloca` showing up. Since I
was there anyway, I added some checks on the attributes to prove the
right attributes got set.

r? `@nikic`
2022-07-26 19:35:57 +00:00
Michael Howell
b8fb6e1032 rustdoc: do not allocate String when writing path full name
No idea if this makes any perf difference, but it just seems like premature
pessimisation to use String when str will do.
2022-07-26 12:23:59 -07:00
Guillaume Gomez
7f78a9acc5 Update pulldown-cmark version 2022-07-26 20:36:20 +02:00
The 8472
2f9f2e507e Optimized vec::IntoIter::next_chunk impl
```
test vec::bench_next_chunk                               ... bench:         696 ns/iter (+/- 22)
x86_64v1, pr
test vec::bench_next_chunk                               ... bench:         309 ns/iter (+/- 4)

znver2, default
test vec::bench_next_chunk                               ... bench:      17,272 ns/iter (+/- 117)
znver2, pr
test vec::bench_next_chunk                               ... bench:         211 ns/iter (+/- 3)
```

The znver2 default impl seems to be slow due to inlining decisions. It goes through `core::array::iter_next_chunk`
which has a deeper call tree.
2022-07-26 20:31:43 +02:00
Camille GILLOT
8edcf6cd1e Clippy fallout. 2022-07-26 19:00:31 +02:00
Camille GILLOT
4b2f06b8a9 Pacify tidy. 2022-07-26 19:00:31 +02:00
Camille GILLOT
034b6f99ad Replace LifetimeRes::Anonymous by LifetimeRes::Infer. 2022-07-26 19:00:31 +02:00
Camille GILLOT
e2b8f0d55c Clippy fallout. 2022-07-26 19:00:31 +02:00
Camille GILLOT
556b02704f Stop creating anonymous late lifetimes. 2022-07-26 19:00:31 +02:00
Camille GILLOT
ad1b1819eb Remove resolve_elided_lifetimes. 2022-07-26 19:00:31 +02:00
Camille GILLOT
30565e5871 Stop resolving lifetime elision on HIR. 2022-07-26 19:00:31 +02:00
Camille GILLOT
267d3620a5 Move fn parameter ribs outwards. 2022-07-26 19:00:31 +02:00
Camille GILLOT
ae70e366f3 Check that we do not ICE when anonymous lifetimes appear in AnonConst.
Fixes #98932.
2022-07-26 19:00:31 +02:00
Camille GILLOT
10be0dd8df Replace LifetimeRes::Anonymous by LifetimeRes::Infer. 2022-07-26 19:00:31 +02:00
Camille GILLOT
ab63591f00 Remove the distinction between LifetimeName::Implicit and LifetimeName::Underscore. 2022-07-26 19:00:31 +02:00
Camille GILLOT
a2254d5d7c Do not produce extra lifetime parameters when not needed. 2022-07-26 19:00:30 +02:00
bjorn3
30a5eb063e Merge commit 'd3a2366ee877075c59b38bd8ced55f224fc7ef51' into sync_cg_clif-2022-07-26 2022-07-26 18:53:46 +02:00
bors
c11207ec89 Auto merge of #99764 - matthiaskrgr:rollup-fawyb3m, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #99235 (rustdoc: Add support for `#[rustc_must_implement_one_of]`)
 - #99716 (remove useless mut from examples)
 - #99724 (Fix some broken link fragments.)
 - #99729 (Remove unused tuple fields)
 - #99757 (Make `transmute_copy` docs read better)
 - #99758 (remove useless `#[allow]` in a test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-26 16:47:36 +00:00
bjorn3
d3a2366ee8 Implement some more llvm float compare intrinsic options 2022-07-26 16:27:14 +00:00
bjorn3
d3099a40c7 Outline a bug! invocation
This reduces the amount of llvm ir lines for intrinsic related code from
23801 to 20478.
2022-07-26 16:26:35 +00:00
bjorn3
54eb0d992a Fully remove the intrinsic_match macro 2022-07-26 16:09:41 +00:00