Skip to content

Commit

Permalink
Merge branch 'upstream' into merge-upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
rossberg committed Jun 6, 2023
2 parents 4e16278 + e19508a commit 51c7216
Show file tree
Hide file tree
Showing 8 changed files with 255 additions and 847 deletions.
2 changes: 1 addition & 1 deletion document/core/appendix/embedding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ Tables

.. _embed-table-alloc:

:math:`\F{table\_alloc}(\store, \tabletype) : (\store, \tableaddr, \reff)`
:math:`\F{table\_alloc}(\store, \tabletype, \reff) : (\store, \tableaddr)`
..........................................................................

1. Pre-condition: :math:`\tabletype` is :ref:`valid <valid-tabletype>`.
Expand Down
4 changes: 2 additions & 2 deletions document/core/appendix/index-instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
Instruction(r'\V128.\STORE\K{16\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{59}', r'[\I32~\V128] \to []', r'valid-store-lane', r'exec-store-lane'),
Instruction(r'\V128.\STORE\K{32\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{5A}', r'[\I32~\V128] \to []', r'valid-store-lane', r'exec-store-lane'),
Instruction(r'\V128.\STORE\K{64\_lane}~\memarg~\laneidx', r'\hex{FD}~~\hex{5B}', r'[\I32~\V128] \to []', r'valid-store-lane', r'exec-store-lane'),
Instruction(r'\V128.\LOAD\K{32\_zero}~\memarg~\laneidx', r'\hex{FD}~~\hex{5C}', r'[\I32] \to [\V128]', r'valid-load-zero', r'exec-load-zero'),
Instruction(r'\V128.\LOAD\K{64\_zero}~\memarg~\laneidx', r'\hex{FD}~~\hex{5D}', r'[\I32] \to [\V128]', r'valid-load-zero', r'exec-load-zero'),
Instruction(r'\V128.\LOAD\K{32\_zero}~\memarg', r'\hex{FD}~~\hex{5C}', r'[\I32] \to [\V128]', r'valid-load-zero', r'exec-load-zero'),
Instruction(r'\V128.\LOAD\K{64\_zero}~\memarg', r'\hex{FD}~~\hex{5D}', r'[\I32] \to [\V128]', r'valid-load-zero', r'exec-load-zero'),
Instruction(r'\F32X4.\VDEMOTE\K{\_f64x2\_zero}', r'\hex{FD}~~\hex{5E}', r'[\V128] \to [\V128]', r'valid-vcvtop', r'exec-vcvtop', r'op-demote'),
Instruction(r'\F64X2.\VPROMOTE\K{\_low\_f32x4}', r'\hex{FD}~~\hex{5F}', r'[\V128] \to [\V128]', r'valid-vcvtop', r'exec-vcvtop', r'op-promote'),
Instruction(r'\I8X16.\VABS', r'\hex{FD}~~\hex{60}', r'[\V128] \to [\V128]', r'valid-vunop', r'exec-vunop', r'op-iabs'),
Expand Down
4 changes: 2 additions & 2 deletions document/core/text/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ An :ref:`element segment <text-elem>` can be given inline with a table definitio
\production{module field} &
\text{(}~\text{table}~~\Tid^?~~\Treftype~~\text{(}~\text{elem}~~\expr^n{:}\Tvec(\Telemexpr)~\text{)}~\text{)} \quad\equiv \\ & \qquad
\text{(}~\text{table}~~\Tid'~~n~~n~~\Treftype~\text{)} \\ & \qquad
\text{(}~\text{elem}~~\text{(}~\text{table}~~\Tid'~\text{)}~~\text{(}~\text{i32.const}~~\text{0}~\text{)}~~\Tvec(\Telemexpr)~\text{)}
\text{(}~\text{elem}~~\text{(}~\text{table}~~\Tid'~\text{)}~~\text{(}~\text{i32.const}~~\text{0}~\text{)}~~\Treftype~~\Tvec(\Telemexpr)~\text{)}
\\ & \qquad\qquad
(\iff \Tid^? \neq \epsilon \wedge \Tid' = \Tid^? \vee \Tid^? = \epsilon \wedge \Tid' \idfresh) \\
\end{array}
Expand All @@ -308,7 +308,7 @@ An :ref:`element segment <text-elem>` can be given inline with a table definitio
\production{module field} &
\text{(}~\text{table}~~\Tid^?~~\Treftype~~\text{(}~\text{elem}~~x^n{:}\Tvec(\Tfuncidx)~\text{)}~\text{)} \quad\equiv \\ & \qquad
\text{(}~\text{table}~~\Tid'~~n~~n~~\Treftype~\text{)} \\ & \qquad
\text{(}~\text{elem}~~\text{(}~\text{table}~~\Tid'~\text{)}~~\text{(}~\text{i32.const}~~\text{0}~\text{)}~~\Tvec(\Tfuncidx)~\text{)}
\text{(}~\text{elem}~~\text{(}~\text{table}~~\Tid'~\text{)}~~\text{(}~\text{i32.const}~~\text{0}~\text{)}~~\text{func}~~\Tvec(\Tfuncidx)~\text{)}
\\ & \qquad\qquad
(\iff \Tid^? \neq \epsilon \wedge \Tid' = \Tid^? \vee \Tid^? = \epsilon \wedge \Tid' \idfresh) \\
\end{array}
Expand Down
36 changes: 18 additions & 18 deletions document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1415,32 +1415,32 @@ An implementation must reject a module that exceeds one of the following limits
In practice, an implementation may run out of resources for valid modules below these limits.

<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 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>
<li>The maximum number of globals defined in a module is 1000000.</li>
<li>The maximum number of tags defined in a module is 1000000.</li>
<li>The maximum number of data segments defined in a module is 100000.</li>

<li>The maximum number of tables, including declared or imported tables, is 100000.</li>
<li>The maximum size of a table is 10000000.</li>
<li>The maximum number of table entries in any table initialization is 10000000.</li>
<li>The maximum size of a module is 1,073,741,824 bytes (1 GiB).</li>
<li>The maximum number of types defined in the types section is 1,000,000.</li>
<li>The maximum number of functions defined in a module is 1,000,000.</li>
<li>The maximum number of imports declared in a module is 100,000.</li>
<li>The maximum number of exports declared in a module is 100,000.</li>
<li>The maximum number of globals defined in a module is 1,000,000.</li>
<li>The maximum number of tags defined in a module is 1,000,000.</li>
<li>The maximum number of data segments defined in a module is 100,000.</li>

<li>The maximum number of tables, including declared or imported tables, is 100,000.</li>
<li>The maximum size of a table is 10,000,000.</li>
<li>The maximum number of table entries in any table initialization is 10,000,000.</li>
<li>The maximum number of memories, including declared or imported memories, is 1.</li>

<li>The maximum number of parameters to any function or block is 1000.</li>
<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 parameters to any function or block is 1,000.</li>
<li>The maximum number of return values for any function or block is 1,000.</li>
<li>The maximum size of a function body, including locals declarations, is 7,654,321 bytes.</li>
<li>The maximum number of locals declared in a function, including implicitly declared as parameters, is 50,000.</li>
</ul>

An implementation must throw a {{RuntimeError}} if one of the following limits is exceeded during runtime:
In practice, an implementation may run out of resources for valid modules below these limits.

<ul>
<li>The maximum size of a table is 10000000.</li>
<li>The maximum number of pages of a memory is 65536.</li>
<li>The maximum size of a table is 10,000,000.</li>
<li>The maximum number of pages of a memory is 65,536.</li>
</ul>

<h2 id="security-considerations">Security and Privacy Considerations</h2>
Expand Down
16 changes: 8 additions & 8 deletions interpreter/text/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -833,11 +833,11 @@ elem_expr_list :
elem_var_list :
| var_list
{ let f = function {at; _} as x -> [ref_func x @@ at] @@ at in
fun c lookup -> List.map f ($1 c lookup) }
fun c -> List.map f ($1 c func) }

elem_list :
| elem_kind elem_var_list
{ ($1, fun c -> $2 c func) }
{ ($1, fun c -> $2 c) }
| ref_type elem_expr_list
{ ($1, fun c -> $2 c) }

Expand Down Expand Up @@ -869,7 +869,7 @@ elem :
{ let at = at () in
fun c -> ignore ($3 c anon_elem bind_elem);
fun () ->
{ etype = FuncRefType; einit = $5 c func;
{ etype = FuncRefType; einit = $5 c;
emode = Active {index = 0l @@ at; offset = $4 c} @@ at } @@ at }

table :
Expand All @@ -889,19 +889,19 @@ table_fields :
| inline_export table_fields /* Sugar */
{ fun c x at -> let tabs, elems, ims, exs = $2 c x at in
tabs, elems, ims, $1 (TableExport x) c :: exs }
| ref_type LPAR ELEM elem_var_list RPAR /* Sugar */
| ref_type LPAR ELEM elem_expr elem_expr_list RPAR /* Sugar */
{ fun c x at ->
let offset = [i32_const (0l @@ at) @@ at] @@ at in
let einit = $4 c func in
let einit = $4 c :: $5 c in
let size = Lib.List32.length einit in
let emode = Active {index = x; offset} @@ at in
[{ttype = TableType ({min = size; max = Some size}, $1)} @@ at],
[{etype = FuncRefType; einit; emode} @@ at],
[{etype = $1; einit; emode} @@ at],
[], [] }
| ref_type LPAR ELEM elem_expr elem_expr_list RPAR /* Sugar */
| ref_type LPAR ELEM elem_var_list RPAR /* Sugar */
{ fun c x at ->
let offset = [i32_const (0l @@ at) @@ at] @@ at in
let einit = (fun c -> $4 c :: $5 c) c in
let einit = $4 c in
let size = Lib.List32.length einit in
let emode = Active {index = x; offset} @@ at in
[{ttype = TableType ({min = size; max = Some size}, $1)} @@ at],
Expand Down
Loading

0 comments on commit 51c7216

Please sign in to comment.