rust/src/libstd
bors f51752774b Auto merge of #54951 - alexcrichton:more-wasm-threads, r=sfackler
std: Implement TLS for wasm32-unknown-unknown

This adds an implementation of thread local storage for the
`wasm32-unknown-unknown` target when the `atomics` feature is
implemented. This, however, comes with a notable caveat of that it
requires a new feature of the standard library, `wasm-bindgen-threads`,
to be enabled.

Thread local storage for wasm (when `atomics` are enabled and there's
actually more than one thread) is powered by the assumption that an
external entity can fill in some information for us. It's not currently
clear who will fill in this information nor whose responsibility it
should be long-term. In the meantime there's a strategy being gamed out
in the `wasm-bindgen` project specifically, and the hope is that we can
continue to test and iterate on the standard library without committing
to a particular strategy yet.

As to the details of `wasm-bindgen`'s strategy, LLVM doesn't currently
have the ability to emit custom `global` values (thread locals in a
`WebAssembly.Module`) so we leverage the `wasm-bindgen` CLI tool to do
it for us. To that end we have a few intrinsics, assuming two global values:

* `__wbindgen_current_id` - gets the current thread id as a 32-bit
  integer. It's `wasm-bindgen`'s responsibility to initialize this
  per-thread and then inform libstd of the id. Currently `wasm-bindgen`
  performs this initialization as part of the `start` function.
* `__wbindgen_tcb_{get,set}` - in addition to a thread id it's assumed
  that there's a global available for simply storing a pointer's worth
  of information (a thread control block, which currently only contains
  thread local storage). This would ideally be a native `global`
  injected by LLVM, but we don't have a great way to support that right
  now.

To reiterate, this is all intended to be unstable and purely intended
for testing out Rust on the web with threads. The story is very likely
to change in the future and we want to make sure that we're able to do
that!
2018-10-13 14:28:48 +00:00
..
collections Auto merge of #53804 - RalfJung:ptr-invalid, r=nagisa 2018-09-16 18:03:39 +00:00
ffi make CStr::from_bytes_with_nul_unchecked() a const fn 2018-10-02 04:25:40 -07:00
io Auto merge of #53517 - phungleson:fix-impl-from-for-error, r=frewsxcv 2018-10-07 22:00:04 +00:00
net Rollup merge of #53522 - phungleson:fix-impl-from-for-addr, r=TimNN 2018-09-18 10:21:33 +02:00
os Move std::os::raw::c_void into libcore and re-export in libstd 2018-09-14 16:19:59 +01:00
prelude Reformat std prelude source to show it is the sum of core and alloc preludes 2018-07-07 23:16:27 +02:00
sync Fix tracking issue for Once::is_completed 2018-10-07 12:00:41 +02:00
sys std: Implement TLS for wasm32-unknown-unknown 2018-10-11 09:57:55 -07:00
sys_common Improve output if no_lookup_host_duplicates fails 2018-09-15 17:17:35 +02:00
tests Breaking change upgrades 2018-09-04 13:22:08 -06:00
thread std: Implement TLS for wasm32-unknown-unknown 2018-10-11 09:57:55 -07:00
alloc.rs Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
ascii.rs Remove unstable and deprecated APIs 2018-07-30 18:18:23 +02:00
build.rs Add rustc SHA to released DWARF debuginfo 2018-09-10 10:10:38 -07:00
Cargo.toml std: Implement TLS for wasm32-unknown-unknown 2018-10-11 09:57:55 -07:00
env.rs make reference to dirs crate clickable in terminals 2018-07-12 12:48:10 +02:00
error.rs Rollup merge of #53523 - phungleson:fix-impl-from-for-std-error, r=GuillaumeGomez 2018-10-04 12:20:05 +02:00
f32.rs Clarify rational behind current implementation of .mod_euc() 2018-06-26 13:09:56 +02:00
f64.rs Clarify rational behind current implementation of .mod_euc() 2018-06-26 13:09:56 +02:00
fs.rs "(using ..." doesn't have the matching ")" 2018-10-10 01:09:18 -07:00
future.rs Remove spawning from task::Context 2018-09-19 15:01:19 -07:00
keyword_docs.rs Add struct keyword doc 2018-08-23 23:50:05 +02:00
lib.rs Stabilize min_const_fn 2018-10-05 10:36:14 +02:00
macros.rs Auto merge of #54317 - Centril:feature/dbg_macro, r=SimonSapin 2018-09-25 07:06:15 +00:00
memchr.rs Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
num.rs Stabilize num::NonZeroU* 2018-05-16 19:11:31 +02:00
panic.rs it's auto traits that make for automatic implementations 2018-10-08 17:44:33 +02:00
panicking.rs rustc: Allow #[no_mangle] anywhere in a crate 2018-10-06 13:57:30 -07:00
path.rs Add links to std::char::REPLACEMENT_CHARACTER from docs. 2018-08-11 15:42:35 -04:00
primitive_docs.rs Cleans trailing whitespace 2018-10-02 13:59:33 -03:00
process.rs document the platform-specific behavior of Command::current_dir 2018-08-20 17:02:45 -04:00
rt.rs Deny bare trait objects in src/libstd. 2018-07-10 20:35:36 +02:00
time.rs Stabilize SystemTime::UNIX_EPOCH 2018-05-28 18:24:01 -06:00