Uh oh!
There was an error while loading. Please reload this page.
libstd: remove some mutable statics in sys::unix - #74006
Conversation
rust-highfive
commented
Jul 3, 2020
(rust_highfive has picked a reviewer for you, use r? to override) |
joshtriplett
commented
Jul 4, 2020
Could someone from @rust-lang/libs take a look at this? |
SimonSapin
left a comment
There was a problem hiding this comment.
Per https://blog.rust-lang.org/inside-rust/2020/07/02/Ownership-Std-Implementation.html I think @rust-lang/compiler could also handle this. Anyway, this looks good.
There was a problem hiding this comment.
Would it make a difference to move this load out of the loop?
There was a problem hiding this comment.
Unlikely to make a perf difference, but I like it anyway, because it'll make it clear that there is no expectation of this loop to ever load a different value while looping.
SimonSapin
commented
Jul 6, 2020
Looks good, thanks! @bors r+ |
bors
commented
Jul 6, 2020
📌 Commit 7d7f167 has been approved by |
…Sapin libstd: remove some mutable statics in sys::unix My understanding is that this achieves the same behavior and performance with safe code.
Manishearth
commented
Jul 6, 2020
euclio
commented
Jul 7, 2020
Fixed, should be ready for another run. |
oli-obk
commented
Jul 7, 2020
@bors r+ |
bors
commented
Jul 7, 2020
📌 Commit 792f2de has been approved by |
bors
commented
Jul 7, 2020
⌛ Testing commit 792f2de with merge 42108486723e0a2d7d03888673ca838dd2d19cde... |
libstd: remove some mutable statics in sys::unix My understanding is that this achieves the same behavior and performance with safe code.
Manishearth
commented
Jul 7, 2020
@bors retry yield |
bors
commented
Jul 7, 2020
Relaxed accesses are slightly stronger than non-atomic accesses that were used before, and optimized a bit less. (IOW, behavior is slightly different.) So in theory this could lead to slightly worse performance. That seems unlikely in practice though, unless these are used in tight loops. |
bors
commented
Jul 7, 2020
☀️ Test successful - checks-actions, checks-azure |
RalfJung
commented
Jul 8, 2020
This PR caused a regression: there are now aliasing violations in the argc/argv handling. |
RalfJung
commented
Jul 8, 2020
Ah, this is probably caused by the integer-ptr-casts that |
RalfJung
commented
Jul 8, 2020
I'll have to fix this by changes on the Miri side until we can handle int-ptr-casts better. |
we cannot track all machine memory any more due to int-ptr-casts Fixes a regression introduced by rust-lang/rust#74006
we cannot track all machine memory any more due to int-ptr-casts Fixes a regression introduced by rust-lang/rust#74006
Hermit: Unify `std::env::args` with Unix The only differences between these implementations of `std::env::args` are that Unix uses relaxed ordering, but Hermit uses acquire/release, and Unix truncates `argv` at the first null pointer, but Hermit doesn't. Since Hermit aims for Unix compatibility, unify it with Unix. The atomic orderings were established in rust-lang#74006 (cc `@euclio)` for Unix and rust-lang#100579 (cc `@joboet)` for Hermit and, before those, they used mutexes and non-atomic statics. I think the difference in orderings is simply from them being changed at different times. The commented explanation for using acquire/release for Hermit is “to broadcast writes by the OS”. I'm not experienced enough with atomics to accurately judge, but I think acquire/release is stronger than needed. Either way, they should match. Truncating at the first null pointer seems desirable, though I don't know whether it is necessary in practice on Hermit. cc `@mkroening` `@stlankes` for Hermit
Rollup merge of rust-lang#139711 - thaliaarchi:hermit-args, r=jhpratt Hermit: Unify `std::env::args` with Unix The only differences between these implementations of `std::env::args` are that Unix uses relaxed ordering, but Hermit uses acquire/release, and Unix truncates `argv` at the first null pointer, but Hermit doesn't. Since Hermit aims for Unix compatibility, unify it with Unix. The atomic orderings were established in rust-lang#74006 (cc `@euclio)` for Unix and rust-lang#100579 (cc `@joboet)` for Hermit and, before those, they used mutexes and non-atomic statics. I think the difference in orderings is simply from them being changed at different times. The commented explanation for using acquire/release for Hermit is “to broadcast writes by the OS”. I'm not experienced enough with atomics to accurately judge, but I think acquire/release is stronger than needed. Either way, they should match. Truncating at the first null pointer seems desirable, though I don't know whether it is necessary in practice on Hermit. cc `@mkroening` `@stlankes` for Hermit
Hermit: Unify `std::env::args` with Unix The only differences between these implementations of `std::env::args` are that Unix uses relaxed ordering, but Hermit uses acquire/release, and Unix truncates `argv` at the first null pointer, but Hermit doesn't. Since Hermit aims for Unix compatibility, unify it with Unix. The atomic orderings were established in rust-lang/rust#74006 (cc `@euclio)` for Unix and rust-lang/rust#100579 (cc `@joboet)` for Hermit and, before those, they used mutexes and non-atomic statics. I think the difference in orderings is simply from them being changed at different times. The commented explanation for using acquire/release for Hermit is “to broadcast writes by the OS”. I'm not experienced enough with atomics to accurately judge, but I think acquire/release is stronger than needed. Either way, they should match. Truncating at the first null pointer seems desirable, though I don't know whether it is necessary in practice on Hermit. cc `@mkroening` `@stlankes` for Hermit
Hermit: Unify `std::env::args` with Unix The only differences between these implementations of `std::env::args` are that Unix uses relaxed ordering, but Hermit uses acquire/release, and Unix truncates `argv` at the first null pointer, but Hermit doesn't. Since Hermit aims for Unix compatibility, unify it with Unix. The atomic orderings were established in rust-lang#74006 (cc `@euclio)` for Unix and rust-lang#100579 (cc `@joboet)` for Hermit and, before those, they used mutexes and non-atomic statics. I think the difference in orderings is simply from them being changed at different times. The commented explanation for using acquire/release for Hermit is “to broadcast writes by the OS”. I'm not experienced enough with atomics to accurately judge, but I think acquire/release is stronger than needed. Either way, they should match. Truncating at the first null pointer seems desirable, though I don't know whether it is necessary in practice on Hermit. cc `@mkroening` `@stlankes` for Hermit
Hermit: Unify `std::env::args` with Unix The only differences between these implementations of `std::env::args` are that Unix uses relaxed ordering, but Hermit uses acquire/release, and Unix truncates `argv` at the first null pointer, but Hermit doesn't. Since Hermit aims for Unix compatibility, unify it with Unix. The atomic orderings were established in rust-lang/rust#74006 (cc `@euclio)` for Unix and rust-lang/rust#100579 (cc `@joboet)` for Hermit and, before those, they used mutexes and non-atomic statics. I think the difference in orderings is simply from them being changed at different times. The commented explanation for using acquire/release for Hermit is “to broadcast writes by the OS”. I'm not experienced enough with atomics to accurately judge, but I think acquire/release is stronger than needed. Either way, they should match. Truncating at the first null pointer seems desirable, though I don't know whether it is necessary in practice on Hermit. cc `@mkroening` `@stlankes` for Hermit
My understanding is that this achieves the same behavior and performance with safe code.