1
Fork 0
Commit graph

33 commits

Author SHA1 Message Date
David Tolnay
c737169fe5
Format libcore with rustfmt (including tests and benches) 2019-12-06 20:20:51 -08:00
Brian Wignall
16fabd8efd Fix spelling typos 2019-11-26 22:19:54 -05:00
Oliver Scherer
02f9167f94 Have tidy ensure that we document all unsafe blocks in libcore 2019-11-06 11:04:42 +01:00
Thomas Lively
2bf59bea48 Upgrade Emscripten targets to use upstream LLVM backend
- Compatible with Emscripten 1.38.46-upstream or later upstream.
 - Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the old incorrect wasm32 C call ABI with the correct one,
   preserving the old one as wasm32_bindgen_compat for wasm-bindgen
   compatibility.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Uses EMCC_CFLAGS on CI to avoid the timeout problems with #63649.
2019-10-16 17:06:48 -07:00
Tyler Mandry
d16b7f705b Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, r=alexcrichton"
This reverts commit 7870050796, reversing
changes made to 2e7244807a.
2019-10-05 21:38:45 -07:00
Thomas Lively
9a55103b98 Upgrade Emscripten targets to use upstream LLVM backend
- Refactors the Emscripten target spec to share code with other wasm
   targets.
 - Replaces the incorrect wasm32 C call ABI with the old asmjs
   version, which is correct for both wasm32 and JS.
 - Updates the varargs ABI used by Emscripten and deletes the old one.
 - Removes the obsolete wasm32-experimental-emscripten target.
 - Temporarily makes Emscripten targets use panic=abort by default
   because supporting unwinding will require an LLVM patch.
2019-10-04 00:47:21 -07:00
Arno Haase
eb48b5d983 broken hyperlinks in documentation 2019-09-18 12:31:34 +02:00
Arno Haase
f4f136e67b newly phrased documentation for spin loop hints 2019-09-17 12:09:07 +02:00
Arno Haase
51c49e2573 fixed linter error 2019-09-10 14:25:40 +02:00
Arno Haase
66e4b34471 typo fix 2019-09-10 14:04:52 +02:00
Arno Haase
356b4c81a0 documentation enhancement for 'spin loop hint': replace 'CPU' with 'CPU or core' 2019-09-10 14:03:31 +02:00
bors
e2b4165a6c Auto merge of #62891 - vext01:improve-black-box-docs, r=RalfJung,Centril,gnzlbg
Improve the documentation for std::hint::black_box.

The other day a colleague was reviewing some of my code which was using `black_box` to block constant propogation. There was a little confusion because the documentation kind of implies that `black_box` is only useful for dead code elimination, and only in benchmarking scenarios.

The docs currently say:

> A function that is opaque to the optimizer, to allow benchmarks to pretend to use outputs to assist in avoiding dead-code elimination.

Here is our discussion, in which I show (using godbolt) that a black box can also block constant propagation:
https://github.com/softdevteam/yk/pull/21#discussion_r302985038

This change makes the docstring for `black_box` a little more general, and while we are here, I've added an example (the same one from our discussion).

![image](https://user-images.githubusercontent.com/604955/61701322-ddf1e400-ad35-11e9-878c-b5b44a20770c.png)

OK to go in?
2019-08-26 04:10:54 +00:00
Edd Barrett
a4b3dbe4c1 Improve the documentation for std::hint::black_box. 2019-08-24 19:00:13 +01:00
Vadim Petrochenkov
73dae4eaf9 Remove derives Encodable/Decodable and unstabilize attribute #[bench] 2019-07-31 21:27:59 +03:00
Alex Crichton
8eb7f36a3b std: Remove internal definitions of cfg_if! macro
This is duplicated in a few locations throughout the sysroot to work
around issues with not exporting a macro in libstd but still wanting it
available to sysroot crates to define blocks. Nowadays though we can
simply depend on the `cfg-if` crate on crates.io, allowing us to use it
from there!
2019-06-10 10:58:44 -07:00
Taiki Endo
360432f1e8 libcore => 2018 2019-04-18 14:47:35 +09:00
Unreachable
62a7bfd1ba Remove parens 2019-04-05 17:42:09 +00:00
Unreachable
84096e0530 improve docs for std::hint::unreachable_unchecked() 2019-04-05 03:05:33 +00:00
Christian
becee90cfd Updated the reference in core::hint::spin_loop to the correct relative path. 2019-04-03 15:47:38 +02:00
Christian
ab3b657373 Updated the documentation of core::hints::spin_loop and core::sync::spin_loop_hint 2019-04-03 10:54:07 +02:00
gnzlbg
0c127e8494 Life's too short not to use cfg_if 2019-03-26 16:14:32 +01:00
gnzlbg
3b6b4899bf Document why the volatile read is used 2019-03-26 13:43:57 +01:00
gnzlbg
d189cab027 Use fallback on emscripten targets 2019-03-26 12:17:03 +01:00
gnzlbg
24db517419 black_box should use inline assembly on wasm32 2019-03-25 18:43:51 +01:00
gnzlbg
cfa76c438a black_box should inhibit optimizations on platforms without inline assembly 2019-03-25 11:49:08 +01:00
gnzlbg
f2443831e9 Remove dupplicated config 2019-03-25 11:44:06 +01:00
gnzlbg
f5d6b3af69 Moves test::black_box to core::hint
This changes removes a cyclic dependency between the "test" and "libtest"
crates, where "libtest" depends on "test" for "black_box", but "test" depends on
"libtest" for everything else.

I've chosen the "hint" module because there seems to be enough consensus in the
discussion of RFC2360 that this module is where such an intrinsic would belong,
but this PR does not implement that RFC! (note: if that RFC ever gets merged,
the API, docs, etc. of this API will need to change).

For backwards compatibility reasons I've chosen to also keep the "test" feature
gate for these instead of adding a new feature gate. If we change the feature
gate, we'll potentially all benchmarks, and while that's something that we could
do, it seems unnecessary to do that now - if RFC2360 gets merged, we'll need to
do that anyways.
2019-03-25 11:44:06 +01:00
gnzlbg
830c98d7fa Fix undefined behavior in hint::spin_loop for x86 targets without SSE2
The pause instruction requires SSE2 but was being unconditionally used
on targets without it, resulting in undefined behavior.

This PR fixes that by only using the pause intrinsic if SSE2 is available.

It also removes the inline assembly which was not required since these
instructions are available in core::arch, and extends support of
the spin_loop hint to arm targets with the v6 feature which also
support the yield instruction.

Closes #59237 .
2019-03-21 14:23:29 +01:00
Alexander Regueiro
99ed06eb88 libs: doc comments 2019-02-10 23:57:25 +00:00
Clar Fon
24ca530526 Move spin_loop_hint to core::hint module 2019-01-15 16:44:28 -05:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Alexander Regueiro
ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
kennytm
5fe8c59f12
Stabilize core::hint::unreachable_unchecked.
Closes #43751.
2018-04-16 18:29:40 +08:00