| Age | Commit message (Collapse) | Author | Lines | |
|---|---|---|---|---|
| 2020-10-11 | Auto merge of #77727 - thomcc:mach-info-order, r=Amanieu | bors | -42/+50 | |
| Avoid SeqCst or static mut in mach_timebase_info and QueryPerformanceFrequency caches This patch went through a couple iterations but the end result is replacing a pattern where an `AtomicUsize` (updated with many SeqCst ops) guards a `static mut` with a single `AtomicU64` that is known to use 0 as a value indicating that it is not initialized. The code in both places exists to cache values used in the conversion of Instants to Durations on macOS, iOS, and Windows. I have no numbers to prove that this improves performance (It seems a little futile to benchmark something like this), but it's much simpler, safer, and in practice we'd expect it to be faster everywhere where Relaxed operations on AtomicU64 are cheaper than SeqCst operations on AtomicUsize, which is a lot of places. Anyway, it also removes a bunch of unsafe code and greatly simplifies the logic, so IMO that alone would be worth it unless it was a regression. If you want to take a look at the assembly output though, see https://godbolt.org/z/rbr6vn for x86_64, https://godbolt.org/z/cqcbqv for aarch64 (Note that this just the output of the mac side, but i'd expect the windows part to be the same and don't feel like doing another godbolt for it). There are several versions of this function in the godbolt: - `info_new`: version in the current patch - `info_less_new`: version in initial PR - `info_original`: version currently in the tree - `info_orig_but_better_orderings`: a version that just tries to change the original code's orderings from SeqCst to the (probably) minimal orderings required for soundness/correctness. The biggest concern I have here is if we can use AtomicU64, or if there are targets that dont have it that this code supports. AFAICT: no. (If that changes in the future, it's easy enough to do something different for them) r? `@Amanieu` because he caught a couple issues last time I tried to do a patch reducing orderings 😅 --- <details> <summary>I rewrote this whole message so the original is inside here</summary> I happened to notice the code we use for caching the result of mach_timebase_info uses SeqCst exclusively. However, thinking a little more, it's actually pretty easy to avoid the static mut by packing the timebase info into an AtomicU64. This entirely avoids needing to do the compare_exchange. The AtomicU64 can be read/written using Relaxed ops, which on current macos/ios platforms (x86_64/aarch64) have no overhead compared to direct loads/stores. This simplifies the code and makes it a lot safer too. I have no numbers to prove that this improves performance (It seems a little futile to benchmark something like this), although it should do that on both targets it applies to. That said, it also removes a bunch of unsafe code and simplifies the logic (arguably at least — there are only two states now, initialized or not), so I think it's a net win even without concrete numbers. If you want to take a look at the assembly output though, see below. It has the new version, the original, and a version of the original with lower Orderings (which is still worse than the version in this PR) - godbolt.org/z/obfqf9 x86_64-apple-darwin - godbolt.org/z/Wz5cWc aarch64-unknown-linux-gnu (godbolt can't do aarch64-apple-ios but that doesn't matter here) A different (and more efficient) option than this would be to just use the AtomicU64 and use the knowledge that after initialization the denominator should be nonzero... That felt like it's relying on too many things I'm not confident in, so I didn't want to do that. </details> | ||||
| 2020-10-11 | add hermit to the list of omit OS | Stefan Lankes | -0/+1 | |
| 2020-10-11 | revise code to pass the format check | Stefan Lankes | -3/+3 | |
| 2020-10-11 | fix typos in new method | Stefan Lankes | -1/+5 | |
| 2020-10-11 | revise comments and descriptions of the helper functions | Stefan Lankes | -3/+2 | |
| 2020-10-11 | revise code to pass the format check | Stefan Lankes | -14/+5 | |
| 2020-10-11 | revise Hermit's mutex interface to support the behaviour of StaticMutex | Stefan Lankes | -8/+182 | |
| rust-lang/rust#77147 simplifies things by splitting this Mutex type into two types matching the two use cases: StaticMutex and MovableMutex. To support the behavior of StaticMutex, we move part of the mutex implementation into libstd. | ||||
| 2020-10-11 | Rollup merge of #77748 - mati865:dead-code-cleanup, r=petrochenkov | Yuki Okushi | -64/+0 | |
| Dead code cleanup in windows-gnu std Closes https://github.com/rust-lang/rust/issues/77622 This is the only leftover I could find. | ||||
| 2020-10-10 | Fix unresolved link to `SocketAncillary` | LinkTed | -0/+2 | |
| 2020-10-10 | Fix `libc` is ambiguous for Windows | LinkTed | -9/+6 | |
| 2020-10-10 | Fix import errors for `#[cfg(doc)]` target | LinkTed | -2/+4 | |
| 2020-10-10 | Add fake definitions for Windows | LinkTed | -0/+10 | |
| 2020-10-10 | Fix imports for MacOs | LinkTed | -8/+4 | |
| 2020-10-10 | Change imports for `cfg(doc)` | LinkTed | -30/+29 | |
| 2020-10-10 | Remove `passcred` for `emscripten` | LinkTed | -6/+6 | |
| 2020-10-10 | Remove unnecessary trailing semicolon | LinkTed | -1/+1 | |
| 2020-10-10 | Fix type mismatching for different OSes. | LinkTed | -41/+105 | |
| 2020-10-10 | Remove `SocketCred` for `emscripten` | LinkTed | -13/+9 | |
| 2020-10-10 | Fix unused import for `IoSliceMut` for macos | LinkTed | -0/+9 | |
| 2020-10-10 | Fix `SO_PASSCRED` for macos | LinkTed | -0/+2 | |
| 2020-10-10 | Fix `MSG_CMSG_CLOEXEC` for macos | LinkTed | -0/+18 | |
| 2020-10-10 | Add conditional compilation for import | LinkTed | -0/+1 | |
| 2020-10-10 | Fix cfg condition for test | LinkTed | -1/+1 | |
| 2020-10-10 | Remove `target_os`, which does not have `SO_PASSCRED` constant in `libc` | LinkTed | -56/+5 | |
| 2020-10-10 | Remove `target_os`, which does not have `cmsghdr` struct in `libc` | LinkTed | -12/+0 | |
| 2020-10-10 | Remove `target_os`, which does not have `MSG_CMSG_CLOEXEC` constant in `libc` | LinkTed | -54/+31 | |
| 2020-10-10 | Add the code of the tracking issue | LinkTed | -36/+36 | |
| 2020-10-10 | Replace `assert` with `unreachable` | LinkTed | -3/+3 | |
| 2020-10-10 | Cast boolean into int directly in function set_passcred | LinkTed | -2/+1 | |
| 2020-10-10 | Remove unsupported target_os for SocketCred | LinkTed | -125/+7 | |
| 2020-10-10 | Change standard types to libc types | LinkTed | -6/+8 | |
| 2020-10-10 | Change name of struct to SocketCred | LinkTed | -9/+9 | |
| 2020-10-10 | Change API to unsafe and add doc comments | LinkTed | -3/+20 | |
| 2020-10-10 | Add `set_passcred` and `passcred` methods to `UnixStream` and `UnixDatagram` | LinkTed | -11/+131 | |
| 2020-10-10 | Rename `test.rs` to `tests.rs` | LinkTed | -625/+19 | |
| 2020-10-10 | Add doc comments | LinkTed | -1/+21 | |
| 2020-10-10 | Add doc(cfg(...)) | LinkTed | -0/+24 | |
| 2020-10-10 | Reduce impl trait by using macro in `raw_fd.rs` | LinkTed | -61/+34 | |
| 2020-10-10 | Move conditional compilation to the upper module and sort the target OS list ↵ | LinkTed | -189/+199 | |
| alphabetically | ||||
| 2020-10-10 | Remove unnecessary path | LinkTed | -1/+1 | |
| 2020-10-10 | Use `fill` instead of `memset` | LinkTed | -9/+16 | |
| 2020-10-10 | Remove inner function in `bind`, `connect` and `send_to` | LinkTed | -49/+33 | |
| 2020-10-10 | Remove lifetime annotation in `messages` function | LinkTed | -1/+1 | |
| 2020-10-10 | Remove `Clone` trait bound in `add_to_ancillary_data` | LinkTed | -1/+1 | |
| 2020-10-10 | Add integer overflow check | LinkTed | -1/+9 | |
| 2020-10-10 | Replace `TryFrom` of `AncillaryData` with a private method. | LinkTed | -23/+18 | |
| 2020-10-10 | Using `read_unaligned` instead of `memcpy`. | LinkTed | -8/+6 | |
| 2020-10-10 | Move `add_to_ancillary_data` and `AncillaryDataIter` to ancillary.rs | LinkTed | -87/+86 | |
| 2020-10-10 | Add UCred struct | LinkTed | -9/+53 | |
| 2020-10-10 | Add AncillaryError | LinkTed | -29/+44 | |
