about summary refs log tree commit diff
path: root/library/std/src/sys/wasm
AgeCommit message (Collapse)AuthorLines
2024-01-11std: begin moving platform support modules into `pal`joboet-345/+0
2023-02-16std: replace generic thread parker with explicit no-op parkerjoboet-0/+2
2022-12-14std: use a more efficient `Once` on platforms without threadsjoboet-0/+2
2022-11-06std: remove lock wrappers in `sys_common`joboet-3/+3
2022-09-19std: use `sync::RwLock` for internal staticsjoboet-1/+1
2022-07-27Fix futex module imports on wasm+atomicssandydoo-2/+4
2022-06-03Lazily allocate+initialize locks.Mara Bos-2/+2
2022-05-09Use Rust 2021 prelude in std itself.Mara Bos-1/+0
2022-04-19Use futex locks on wasm+atomics.Mara Bos-354/+6
2022-04-19Make std::sys::wasm::futex consistent with unix::futex.Mara Bos-4/+18
2022-04-16Use a single ReentrantMutex implementation on all platforms.Mara Bos-93/+1
2022-04-14Use u32 instead of i32 for futexes.Mara Bos-5/+9
2022-04-06Rename RWLock to RwLock in std::sys.Mara Bos-7/+7
2022-03-22Move std::sys::{mutex, condvar, rwlock} to std::sys::locks.Mara Bos-12/+12
2021-12-14Fix a bunch of typosFrank Steffahn-7/+7
2021-11-10Review commentsAlex Crichton-1/+1
2021-11-10std: Get the standard library compiling for wasm64Alex Crichton-2/+2
This commit goes through and updates various `#[cfg]` as appropriate to get the wasm64-unknown-unknown target behaving similarly to the wasm32-unknown-unknown target. Most of this is just updating various conditions for `target_arch = "wasm32"` to also account for `target_arch = "wasm64"` where appropriate. This commit also lists `wasm64` as an allow-listed architecture to not have the `restricted_std` feature enabled, enabling experimentation with `-Z build-std` externally. The main goal of this commit is to enable playing around with `wasm64-unknown-unknown` externally via `-Z build-std` in a way that's similar to the `wasm32-unknown-unknown` target. These targets are effectively the same and only differ in their pointer size, but wasm64 is much newer and has much less ecosystem/library support so it'll still take time to get wasm64 fully-fledged.
2021-09-28Rename `std::thread::available_onccurrency` to ↵Yoshua Wuyts-1/+1
`std::thread::available_parallelism`
2021-07-03Move `os_str_bytes` to `sys::unix` and reuse it on other platforms.Christiaan Dirkx-2/+2
2021-07-02Fix double import in wasm threadThomas Versteeg-1/+0
The `unsupported` type is imported two times, as `super::unsupported` and as `crate::sys::unsupported`, throwing an error. Remove `super::unsupported` in favor of the other.
2021-06-21Use `Unsupported` on platforms where `available_concurrency` is not implemented.Christiaan Dirkx-4/+2
2021-06-21Move `available_concurrency` implementation to `sys`Christiaan Dirkx-0/+8
2021-06-01Multiple improvements to RwLocksBenoît du Garreau-0/+2
- Split `sys_common::RWLock` between `StaticRWLock` and `MovableRWLock` - Unbox `RwLock` on some platforms (Windows, Wasm and unsupported) - Simplify `RwLock::into_inner`
2021-05-07Rollup merge of #84655 - CDirkx:wasm, r=m-ou-seDylan DPC-65/+13
Cleanup of `wasm` Some more cleanup of `sys`, this time `wasm` - Reuse `unsupported::args` (functionally equivalent implementation, just an empty iterator). - Split out `atomics` implementation of `wasm::thread`, the non-`atomics` implementation is reused from `unsupported`. - Move all of the `atomics` code to a separate directory `wasm/atomics`. ````@rustbot```` label: +T-libs-impl r? ````@m-ou-se````
2021-04-30Auto merge of #84522 - CDirkx:cmath, r=yaahcbors-1/+1
Reuse `sys::unix::cmath` on other platforms Reuse `sys::unix::cmath` on all non-`windows` platforms. `unix` is chosen as the canonical location instead of `unsupported` or `common` because `unsupported` doesn't make sense semantically and `common` is reserved for code that is supported on all platforms. Also `unix` is already the home of some non-`windows` code that is technically not exclusive to `unix` like `unix::path`.
2021-04-28Reuse `unsupported::args` on `wasm`Christiaan Dirkx-42/+1
2021-04-28Move `wasm` atomics code to `wasm/atomics`Christiaan Dirkx-5/+5
2021-04-28Rework `wasm::thread` to `thread_atomics`Christiaan Dirkx-19/+8
2021-04-28Reuse `unix::cmath`Christiaan Dirkx-1/+1
2021-04-25Auto merge of #84115 - CDirkx:rt, r=m-ou-sebors-8/+0
Rework `init` and `cleanup` This PR reworks the code in `std` that runs before and after `main` and centralizes this code respectively in the functions `init` and `cleanup` in both `sys_common` and `sys`. This makes is easy to see what code is executed during initialization and cleanup on each platform just by looking at e.g. `sys::windows::init`. Full list of changes: - new module `rt` in `sys_common` to contain `init` and `cleanup` and the runtime macros. - `at_exit` and the mechanism to register exit handlers has been completely removed. In practice this was only used for closing sockets on windows and flushing stdout, which have been moved to `cleanup`. - <s>On windows `alloc` and `net` initialization is now done in `init`, this saves a runtime check in every allocation and network use.</s>
2021-04-23Explicitly implement `!Send` and `!Sync` for `sys::{Args, Env}`Christiaan Dirkx-3/+4
2021-04-22Rollup merge of #84413 - CDirkx:args_inner_debug, r=m-ou-seDylan DPC-3/+4
Remove `sys::args::Args::inner_debug` and use `Debug` instead This removes the method `sys::args::Args::inner_debug` on all platforms and implements `Debug` for `Args` instead. I believe this creates a more natural API for the different platforms under `sys`: export a type `Args: Debug + Iterator + ...` vs. `Args: Iterator + ...` and with a method `inner_debug`.
2021-04-22Move most init to `sys::init`Christiaan Dirkx-6/+0
2021-04-22Remove `sys::args::Args::inner_debug` and use `Debug` insteadChristiaan Dirkx-3/+4
2021-04-22Move all cleanup to `sys::cleanup`Christiaan Dirkx-2/+0
2021-04-20Change uses of never typeChristiaan Dirkx-1/+1
2021-04-20Replace `Void` with never typeChristiaan Dirkx-2/+2
2021-01-29sys: use `process::abort()` instead of `arch::wasm32::unreachable()`Miguel Ojeda-1/+1
Rationale: - `abort()` lowers to `wasm32::unreachable()` anyway. - `abort()` isn't `unsafe`. - `abort()` matches the comment better. - `abort()` avoids confusion by future readers (e.g. https://github.com/rust-lang/rust/pull/81527): the naming of wasm's `unreachable' instruction is a bit unfortunate because it is not related to the `unreachable()` intrinsic (intended to trigger UB). Codegen is likely to be different since `unreachable()` is `inline` while `abort()` is `cold`. Since it doesn't look like we are expecting here to trigger this case, the latter seems better anyway. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2020-11-17Rollup merge of #78138 - fortanix:raoul/dlmalloc0.2, r=Mark-SimulacrumMara Bos-1/+1
Upgrade dlmalloc to version 0.2 In preparation of adding dynamic memory management support for SGXv2-enabled platforms, the dlmalloc crate has been refactored. More specifically, support has been added to implement platform specification outside of the dlmalloc crate. (see https://github.com/alexcrichton/dlmalloc-rs/pull/15) This PR upgrades dlmalloc to version 0.2 for the `wasm` and `sgx` targets. As the dlmalloc changes have received a positive review, but have not been merged yet, this PR contains a commit to prevent tidy from aborting CI prematurely. cc: `@jethrogb`
2020-11-12Upgrading dlmalloc to 0.2.1Raoul Strackx-1/+1
2020-11-12Fix an intrinsic invocation on threaded wasmAlex Crichton-1/+1
This looks like it was forgotten to get updated in #74482 and wasm with threads isn't built on CI so we didn't catch this by accident.
2020-10-24Remove unnecessary unsafe block from condvar_atomics & mutex_atomicschansuke-3/+3
2020-10-24Fix unsafe operation of wasm32::memory_atomic_notifychansuke-1/+2
2020-10-24Add documents for DLMALLOCchansuke-4/+8
2020-10-24Add some description for (malloc/calloc/free/realloc)chansuke-0/+4
2020-10-24`#[deny(unsafe_op_in_unsafe_fn)]` in sys/wasmchansuke-18/+32
2020-10-16Rollup merge of #77619 - fusion-engineering-forks:wasm-parker, r=dtolnayDylan DPC-0/+19
Use futex-based thread-parker for Wasm32. This uses the existing `sys_common/thread_parker/futex.rs` futex-based thread parker (that was already used for Linux) for wasm32 as well (if the wasm32 atomics target feature is enabled, which is not the case by default). Wasm32 provides the basic futex operations as instructions: https://webassembly.github.io/threads/syntax/instructions.html These are now exposed from `sys::futex::{futex_wait, futex_wake}`, just like on Linux. So, `thread_parker/futex.rs` stays completely unmodified.
2020-10-13Deny unsafe_op_in_unsafe_fn for unsupported/common.rs through sys/wasm too.Mara Bos-0/+1
2020-10-06Use futex-based thread-parker for Wasm32.Mara Bos-0/+19
2020-10-02No longer put wasm condvars in a box.Mara Bos-1/+1
These condvars are just an AtomicUsize, so can be moved without problems.