Skip to content

Commit

Permalink
Document new implementation-defined limits (#360)
Browse files Browse the repository at this point in the history
Based on discussion in #335 and subgroup meetings.
  • Loading branch information
tlively authored Mar 23, 2023
1 parent bd24853 commit db976cc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1398,6 +1398,8 @@ In practice, an implementation may run out of resources for valid modules below
<ul>
<li>The maximum size of a module is 1073741824 bytes (1 GiB).</li>
<li>The maximum number of types defined in the types section is 1000000.</li>
<li>The maximum number of recursion groups defined in the types sections is 1000000.</li>
<li>The maximum depth of a defined subtype hierarchy is 63 (where a type defined with no supertype has depth 0).
<li>The maximum number of functions defined in a module is 1000000.</li>
<li>The maximum number of imports declared in a module is 100000.</li>
<li>The maximum number of exports declared in a module is 100000.</li>
Expand All @@ -1413,6 +1415,8 @@ In practice, an implementation may run out of resources for valid modules below
<li>The maximum number of return values for any function or block is 1000.</li>
<li>The maximum size of a function body, including locals declarations, is 7654321 bytes.</li>
<li>The maximum number of locals declared in a function, including implicitly declared as parameters, is 50000.</li>
<li>The maximum number of fields in a struct is 10000.</li>
<li>The maximum number of operands to `array.new_fixed` is 10000.</li>
</ul>

An implementation must throw a {{RuntimeError}} if one of the following limits is exceeded during runtime:
Expand Down
13 changes: 13 additions & 0 deletions proposals/gc/MVP-JS.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,16 @@ internal reference value that is being externalized:

_TODO: avoid having to patch the behavior of `extern.internalize` and
`extern.internalize` by converting to/from JS numbers separately._

## Implementation-defined Limits

The following limits will be added to the Implementation-defined Limits
[section](https://webassembly.github.io/spec/js-api/index.html#limits) of the JS
API.

- The maximum number of recursion groups is 1000000. (The maximum number of
individual types remains unchanged and is also 1000000.)
- The maximum number of struct fields is 10000.
- The maximum number of operands to `array.new_fixed` is 10000.
- The maximum length of a supertype chain is 63. (A type declared with no
supertypes has a supertype chain of length 0)
5 changes: 2 additions & 3 deletions proposals/gc/MVP.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ New abbreviations are introduced for reference types in binary and text format,
- `module ::= {..., types vec(<deftype>)}`
- a `rec` definition defines a group of mutually recursive types that can refer to each other; it thereby defines several type indices at a time
- a single type definition, as in Wasm before this proposal, is reinterpreted as a short-hand for a recursive group containing just one type
- Note that the number of type section entries is now the number of recursion groups rather than the number of individual types.
- Note that the number of type section entries is now the number of recursion groups rather than the number of individual types.

* `subtype` is a new category of type defining a single type, as a subtype of possible other types
- `subtype ::= sub final? <typeidx>* <strtype>`
Expand Down Expand Up @@ -782,8 +782,7 @@ The opcode for heap types is encoded as an `s33`.

## JS API

See [GC JS API document](MVP-JS.md) .

See [GC JS API document](MVP-JS.md).

## Questions

Expand Down

0 comments on commit db976cc

Please sign in to comment.