Skip to content

Commit 18759dd

Browse files
flagxorjfbastien
authored andcommitted
Merge PostMVP into FutureFeatures for clarity. (WebAssembly#845)
1 parent aa1215b commit 18759dd

File tree

15 files changed

+160
-157
lines changed

15 files changed

+160
-157
lines changed

BinaryEncoding.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The binary encoding is a dense representation of module information that enables
66
small files, fast decoding, and reduced memory usage.
77
See the [rationale document](Rationale.md#why-a-binary-encoding) for more detail.
88

9-
[:unicorn:][future general] = Planned [future](PostMVP.md) feature
9+
[:unicorn:][future general] = Planned [future][future general] feature
1010

1111
The encoding is split into three layers:
1212

@@ -736,9 +736,9 @@ for [future :unicorn:][future multiple tables] use and must be 0 in the MVP.
736736
| `f32.reinterpret/i32` | `0xbe` | | |
737737
| `f64.reinterpret/i64` | `0xbf` | | |
738738

739-
[future general]: PostMVP.md
740-
[future multiple return]: PostMVP.md#multiple-return
741-
[future threads]: PostMVP.md#threads
739+
[future general]: FutureFeatures.md
740+
[future multiple return]: FutureFeatures.md#multiple-return
741+
[future threads]: FutureFeatures.md#threads
742742
[future types]: FutureFeatures.md#more-table-operators-and-types
743743
[future multiple tables]: FutureFeatures.md#multiple-tables-and-memories
744744
[future compression]: https://github.com/WebAssembly/decompressor-prototype/blob/master/CompressionLayer1.md

CAndC++.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ compilers need to support high-quality implementations.
4141
While [the MVP](MVP.md) will be fully functional, additional features enabling
4242
greater performance will be added soon after, including:
4343

44-
* [Support for multi-threaded execution with shared memory](PostMVP.md#threads).
44+
* [Support for multi-threaded execution with shared memory](FutureFeatures.md#threads).
4545

46-
* [Zero-cost C++ exception handling](PostMVP.md#zero-cost-exception-handling).
46+
* [Zero-cost C++ exception handling](FutureFeatures.md#zero-cost-exception-handling).
4747
C++ exceptions can be implemented without this, but this feature will
4848
enable them to have lower runtime overhead.
4949

50-
* Support for [128-bit SIMD](PostMVP.md#fixed-width-simd). SIMD will be
50+
* Support for [128-bit SIMD](FutureFeatures.md#fixed-width-simd). SIMD will be
5151
exposed to C/C++ though explicit APIs such as [LLVM's vector extensions]
5252
and [GCC's vector extensions], auto-vectorization, and emulated APIs from
5353
other platforms such as `<xmmintrin.h>`.

FeatureTest.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ See [rationale](Rationale.md#feature-testing---motivating-scenarios) for motivat
22

33
# Feature Test
44

5-
[PostMVP :unicorn:][future general], applications will be able to query which features are
5+
[Post-MVP :unicorn:][future general], applications will be able to query which features are
66
supported via
77
[`has_feature` or a similar API :unicorn:][future feature testing]. This
88
accounts for the pragmatic reality that features are shipped in different orders
@@ -59,7 +59,7 @@ To illustrate, consider 4 examples:
5959
the application to test `(has_feature "mprotect")` to avoid calling the
6060
`abort()`. The `has_feature` query could be exposed to C++ code via
6161
the existing `__builtin_cpu_supports`.
62-
* [SIMD](PostMVP.md#fixed-width-simd) - When SIMD operators have a good-enough
62+
* [SIMD]][future simd] - When SIMD operators have a good-enough
6363
polyfill, e.g., `f32x4.fma` via `f32x4.mul`/`add`, Strategy 2 could be used
6464
(similar to the `i32.min_s` example above). However, when a SIMD feature has no
6565
efficient polyfill (e.g., `f64x2`, which introduces both operators *and*
@@ -100,8 +100,9 @@ can evolve over time.
100100
See also the [better feature testing support :unicorn:][future feature testing]
101101
future feature.
102102

103-
[future general]: PostMVP.md
104-
[future feature testing]: PostMVP.md#feature-testing
103+
[future general]: FutureFeatures.md
104+
[future feature testing]: FutureFeatures.md#feature-testing
105105
[future integer]: FutureFeatures.md#additional-integer-operators
106-
[future thread]: PostMVP.md#threads
106+
[future threads]: FutureFeatures.md#threads
107+
[future simd]: FutureFeatures.md#fixed-width-simd
107108
[future memory control]: FutureFeatures.md#finer-grained-control-over-memory

FutureFeatures.md

Lines changed: 119 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,104 @@
11
# Features to add after the MVP
22

33
These are features that make sense in the context of the
4-
[high-level goals](HighLevelGoals.md) of WebAssembly but are not considered part
5-
of the [Minimum Viable Product](MVP.md) or the essential
6-
[post-MVP :unicorn:](PostMVP.md)
7-
feature set which are expected to be standardized immediately after the
8-
MVP. These will be prioritized based on developer feedback, and will be
4+
[high-level goals](HighLevelGoals.md) of WebAssembly but won't be part of the
5+
initial [Minimum Viable Product](MVP.md) release.
6+
7+
We expect several essential features to be standardized immediately after the
8+
MVP. Others will be prioritized based on developer feedback, and all will be
99
available under [feature tests](FeatureTest.md).
1010

11-
## Great tooling support
11+
:star: = Essential features we want to prioritize adding shortly after
12+
the [MVP](MVP.md).
13+
14+
## On Deck for Immediate Design
15+
16+
### Great tooling support :star: :star: :star:
1217

1318
This is covered in the [tooling](Tooling.md) section.
1419

15-
## Finer-grained control over memory
20+
### Threads :star: :star:
21+
22+
Provide low-level buildings blocks for pthreads-style shared memory: shared
23+
memory between threads, atomics and futexes (or [synchronic][]).
24+
25+
New atomic memory operators, including loads/stores annotated with their atomic
26+
ordering property, will follow the [C++11 memory model][], similarly to the
27+
[PNaCl atomic support][] and the [SharedArrayBuffer][] proposal. Regular loads
28+
and stores will be bound by a happens-before relationship to atomic operators
29+
in the same thread of execution, which themselves synchronize-with atomics in
30+
other threads. Following these rules, regular load/store operators can still be
31+
elided, duplicated, and split up. This guarantees that data-race free code
32+
executes as if it were sequentially consistent. Even when there are data races,
33+
WebAssembly will ensure that the [nondeterminism](Nondeterminism.md) remains
34+
limited and local.
35+
36+
Modules can have thread-local variables that are disjoint from linear memory
37+
and can thus be represented efficiently by the engine.
38+
39+
[synchronic]: http://wg21.link/n4195
40+
[C++11 memory model]: http://www.hboehm.info/c++mm/
41+
[PNaCl atomic support]: https://developer.chrome.com/native-client/reference/pnacl-c-cpp-language-support#memory-model-and-atomics
42+
[SharedArrayBuffer]: https://github.com/tc39/ecmascript_sharedmem
43+
44+
### Fixed-width SIMD :star:
45+
46+
Support fixed-width SIMD vectors, initially only for 128-bit wide vectors as
47+
demonstrated in [PNaCl's SIMD][] and [SIMD.js][].
48+
49+
SIMD adds new local types (e.g., `f32x4`) so it has to be part of the core
50+
semantics. SIMD operators (e.g., `f32x4.add`) could be either builtin
51+
operators (no different from `i32.add`) or exports of a builtin SIMD module.
52+
53+
[PNaCl's SIMD]: https://developer.chrome.com/native-client/reference/pnacl-c-cpp-language-support#portable-simd-vectors
54+
[SIMD.js]: https://github.com/tc39/ecmascript_simd
55+
56+
### Zero-cost Exception Handling :star:
57+
58+
The WebAssembly MVP may support four no-exception
59+
modes for C++:
60+
61+
* Compiler transforms `throw` to `abort()`.
62+
* Compiler-enforced `-fno-exceptions` mode (note [caveats][]).
63+
* Compiler conversion of exceptions to branching at all callsites.
64+
* In a Web environment exception handling can be emulated using JavaScript
65+
exception handling, which can provide correct semantics but isn't fast.
66+
67+
These modes are suboptimal for code bases which rely on C++ exception handling,
68+
but are perfectly acceptable for C code, or for C++ code which avoids
69+
exceptions. This doesn't prevent developers from using the C++ standard library:
70+
their code will function correctly (albeit slower at times) as long as it
71+
doesn't encounter exceptional cases.
72+
73+
Post-MVP, WebAssembly will gain support for developer access to stack unwinding,
74+
inspection, and limited manipulation. These are critical to supporting zero-cost
75+
exception handling by exposing [low-level capabilities][].
76+
77+
In turn, stack unwinding, inspection, and limited manipulation will be used to
78+
implement `setjmp`/`longjmp`. This can enable all of the defined behavior of
79+
`setjmp`/`longjmp`, namely unwinding the stack without calling C++
80+
destructors. It does not, however, allow the undefined behavior case of jumping
81+
forward to a stack that was already unwound which is sometimes used to implement
82+
coroutines. Coroutine support is being
83+
[considered separately](FutureFeatures.md#coroutines).
84+
85+
[caveats]: https://blog.mozilla.org/nnethercote/2011/01/18/the-dangers-of-fno-exceptions
86+
[low-level capabilities]: https://extensiblewebmanifesto.org
87+
88+
### Feature Testing :star:
89+
90+
Post-MVP, some form of feature-testing will be required. We don't yet have the
91+
experience writing polyfills to know whether `has_feature` is the right
92+
primitive building block so we're not defining it (or something else) until we
93+
gain this experience. In the interim, it's possible to do a crude feature test
94+
(as people do in JavaScript) by just `eval`-ing WebAssembly code and catching
95+
validation errors.
96+
97+
See [Feature test](FeatureTest.md) for a more detailed sketch.
98+
99+
## Proposals we might consider in the future
100+
101+
### Finer-grained control over memory
16102

17103
Provide access to safe OS-provided functionality including:
18104

@@ -49,13 +135,13 @@ provided by the `mmap` OS primitive. One significant exception is that `mmap`
49135
can allocate noncontiguous virtual address ranges. See the
50136
[FAQ](FAQ.md#what-about-mmap) for rationale.
51137

52-
## Large page support
138+
### Large page support
53139

54140
Some platforms offer support for memory pages as large as 16GiB, which
55141
can improve the efficiency of memory management in some situations. WebAssembly
56142
may offer programs the option to specify a larger page size than the [default](Semantics.md#resizing).
57143

58-
## More expressive control flow
144+
### More expressive control flow
59145

60146
Some types of control flow (especially irreducible and indirect) cannot be
61147
expressed with maximum efficiency in WebAssembly without patterned output by the
@@ -76,11 +162,11 @@ Options under consideration:
76162
making it easier to support other languages, especially functional programming
77163
languages.
78164

79-
## GC/DOM Integration
165+
### GC/DOM Integration
80166

81167
See [GC.md](GC.md).
82168

83-
## Linear memory bigger than 4 GiB
169+
### Linear memory bigger than 4 GiB
84170

85171
The WebAssembly MVP will support the wasm32 mode of WebAssembly, with linear
86172
memory sizes up to 4 GiB using 32-bit linear memory indices. To support larger
@@ -101,7 +187,7 @@ instance. However, operators with 32-bit indices and operators with 64-bit
101187
indices will be given separate names to leave open the possibility of
102188
supporting both in the same instance in the future.
103189

104-
## Source maps integration
190+
### Source maps integration
105191

106192
* Add a new source maps [module section type](MVP.md#module-structure).
107193
* Either embed the source maps directly or just a URL from which source maps can
@@ -111,14 +197,14 @@ supporting both in the same instance in the future.
111197
* Gestate ideas and start discussions at the
112198
[Source Map RFC repository](https://github.com/source-map/source-map-rfc/issues)
113199

114-
## Coroutines
200+
### Coroutines
115201

116202
Coroutines will [eventually be part of C++][] and is already popular in other
117203
programming languages that WebAssembly will support.
118204

119205
[eventually be part of C++]: http://wg21.link/n4499
120206

121-
## Signature-restricted Proper Tail Calls
207+
### Signature-restricted Proper Tail Calls
122208

123209
See the [asm.js RFC][] for a full description of signature-restricted Proper
124210
Tail Calls (PTC).
@@ -139,18 +225,18 @@ Useful properties of signature-restricted PTCs:
139225

140226
[asm.js RFC]: http://discourse.specifiction.org/t/request-for-comments-add-a-restricted-subset-of-proper-tail-calls-to-asm-js
141227

142-
## General-purpose Proper Tail Calls
228+
### General-purpose Proper Tail Calls
143229

144230
General-purpose Proper Tail Calls would have no signature restrictions, and
145231
therefore be more broadly usable than
146232
[Signature-restricted Proper Tail Calls](Semantics.md#signature-restricted-proper-tail-calls),
147233
though there would be some different performance characteristics.
148234

149-
## Asynchronous Signals
235+
### Asynchronous Signals
150236

151237
TODO
152238

153-
## "Long SIMD"
239+
### "Long SIMD"
154240

155241
The initial SIMD API will be a "short SIMD" API, centered around fixed-width
156242
128-bit types and explicit SIMD operators. This is quite portable and useful,
@@ -176,7 +262,7 @@ include:
176262

177263
[a proposal in the SIMD.js repository]: https://github.com/tc39/ecmascript_simd/issues/180
178264

179-
## Platform-independent Just-in-Time (JIT) compilation
265+
### Platform-independent Just-in-Time (JIT) compilation
180266

181267
WebAssembly is a new virtual ISA, and as such applications won't be able to
182268
simply reuse their existing JIT-compiler backends. Applications will instead
@@ -205,13 +291,13 @@ are use cases for higher-level functionality and optimization too. One avenue
205291
for addressing these use cases is a
206292
[JIT and Optimization library](JITLibrary.md).
207293

208-
## Multiprocess support
294+
### Multiprocess support
209295

210296
* `vfork`.
211297
* Inter-process communication.
212298
* Inter-process `mmap`.
213299

214-
## Trapping or non-trapping strategies.
300+
### Trapping or non-trapping strategies.
215301

216302
Presently, when an instruction traps, the program is immediately terminated.
217303
This suits C/C++ code, where trapping conditions indicate Undefined Behavior at
@@ -236,7 +322,7 @@ use cases:
236322
resuming execution at the trapping instruction with the execution state
237323
altered, if there can be a reasonable way to specify how that should work.
238324

239-
## Additional integer operators
325+
### Additional integer operators
240326

241327
* The following operators can be built from other operators already present,
242328
however in doing so they read at least one non-constant input multiple times,
@@ -259,7 +345,7 @@ use cases:
259345
* `i64.mor`: sign-agnostic [8x8 bit-matrix multiply with or](http://mmix.cs.hm.edu/doc/instructions-en.html#MOR)
260346
* `i64.mxor`: sign-agnostic [8x8 bit-matrix multiply with xor](http://mmix.cs.hm.edu/doc/instructions-en.html#MXOR)
261347

262-
## Additional floating point operators
348+
### Additional floating point operators
263349

264350
* `f32.minnum`: minimum; if exactly one operand is NaN, returns the other operand
265351
* `f32.maxnum`: maximum; if exactly one operand is NaN, returns the other operand
@@ -275,7 +361,7 @@ Note that some operators, like `fma`, may not be available or may not perform
275361
well on all platforms. These should be guarded by
276362
[feature tests](FeatureTest.md) so that if available, they behave consistently.
277363

278-
## Floating point approximation operators
364+
### Floating point approximation operators
279365

280366
* `f32.reciprocal_approximation`: reciprocal approximation
281367
* `f64.reciprocal_approximation`: reciprocal approximation
@@ -285,7 +371,7 @@ well on all platforms. These should be guarded by
285371
These operators would not required to be fully precise, but the specifics
286372
would need clarification.
287373

288-
## 16-bit and 128-bit floating point support
374+
### 16-bit and 128-bit floating point support
289375

290376
For 16-bit floating point support, it may make sense to split the feature
291377
into two parts: support for just converting between 16-bit and 32-bit or
@@ -301,7 +387,7 @@ techniques such as double-double arithmetic. If we standardize 128-bit
301387
floating point in WebAssembly, it will probably be standard IEEE 754-2008
302388
quadruple precision.
303389

304-
## Full IEEE 754-2008 conformance
390+
### Full IEEE 754-2008 conformance
305391

306392
WebAssembly floating point conforms IEEE 754-2008 in most respects, but there
307393
are a few areas that are
@@ -333,15 +419,15 @@ enabled only from developer tools, that would enable traps on selected floating
333419
point exceptions, however care should be taken, since not all floating point
334420
exceptions indicate bugs.
335421

336-
## Flushing Subnormal Values to Zero
422+
### Flushing Subnormal Values to Zero
337423

338424
Many popular CPUs have significant stalls when processing subnormal values,
339425
and support modes where subnormal values are flushed to zero which avoid
340426
these stalls. And, ARMv7 NEON has no support for subnormal values and always
341427
flushes them. A mode where floating point computations have subnormals flushed
342428
to zero in WebAssembly would address these two issues.
343429

344-
## Integer Overflow Detection
430+
### Integer Overflow Detection
345431

346432
There are two different use cases here, one where the application wishes to
347433
handle overflow locally, and one where it doesn't.
@@ -371,7 +457,7 @@ general-purpose use on several of today's popular hardware architectures.
371457

372458
[handle trap specially]: FutureFeatures.md#trapping-or-non-trapping-strategies
373459

374-
## Better feature testing support
460+
### Better feature testing support
375461

376462
The [MVP feature testing situation](FeatureTest.md) could be improved by
377463
allowing unknown/unsupported instructions to decode and validate. The runtime
@@ -382,7 +468,7 @@ lighter-weight alternative to load-time polyfilling (approach 2 in
382468
were to be standardized and performed natively such that no user-space translation
383469
pass was otherwise necessary.
384470

385-
## Mutable global variables
471+
### Mutable global variables
386472

387473
In the MVP, there are no global variables; C/C++ global variables are stored in
388474
linear memory and thus accessed through normal
@@ -397,7 +483,7 @@ reduce fragmentation issues. Languages like Fortran which limit aliasing would b
397483
one use case. C/C++ compilers could also determine that some global variables never
398484
have their address taken.
399485

400-
## Streaming Compilation
486+
### Streaming Compilation
401487

402488
The WebAssembly binary format is designed to allow streaming decoding,
403489
validation and compilation. In the MVP, however, the only way to compile
@@ -421,12 +507,12 @@ of WebAssembly in browsers:
421507
custom compression (on top of the spec-defined binary format, under generic
422508
HTTP `Content-Encoding` compression).
423509

424-
## Multiple Return
510+
### Multiple Return
425511

426512
The stack based nature of WebAssembly lends itself to the possibility
427513
of supporting multiple return values from blocks / functions.
428514

429-
## Multiple Tables and Memories
515+
### Multiple Tables and Memories
430516

431517
The MVP limits modules to at most one memory and at most one table (the default
432518
ones) and there are only operators for accessing the default table and memory.
@@ -444,7 +530,7 @@ would return a first-class reference. Beyond tables and memories, this could
444530
also be used for function definitions to get a reference to a function (which,
445531
since opaque, could be implemented as a raw function pointer).
446532

447-
## More Table Operators and Types
533+
### More Table Operators and Types
448534

449535
In the MVP, WebAssembly has limited functionality for operating on
450536
[tables](Semantics.md#table) and the host-environment can do much more (e.g.,

0 commit comments

Comments
 (0)