Skip to content
This repository was archived by the owner on Nov 3, 2021. It is now read-only.

table.fill: Bounds check before mutating the table - #106

Merged
rossberg merged 1 commit into
WebAssembly:masterfrom
fitzgen:table-fill-eager-bounds-check
Jul 21, 2020
Merged

rossberg merged 1 commit into
WebAssembly:masterfrom
fitzgen:table-fill-eager-bounds-check

Conversation

@fitzgen

@fitzgen fitzgen commented Jul 14, 2020

Copy link
Copy Markdown
Contributor

Fixes #105

@rossberg please take a look. Thanks!

19. Execute the instruction :math:`\TABLEFILL~x`.

.. math::
\begin{array}{l}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formal notation needs to be fixed too -- this will still partially fill.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps someone else could fix that part? I'm not super familiar with latex / our conventions for the formal notation.

@rossberg

Copy link
Copy Markdown
Member

Thanks for looking into this. The corresponding formal rules should look something like this:

.. math::
   \begin{array}{l}
   S; F; (\I32.\CONST~i)~\val~(\I32.\CONST~n)~(\TABLEFILL~x)
     \quad\stepto\quad S; F; \TRAP
     \\ \qquad
     \begin{array}[t]{@{}r@{~}l@{}}
     (\iff & i + n > |S.\STABLES[F.\AMODULE.\MITABLES[x]].\TIELEM|) \\
     \end{array}
   \\[1ex]
   S; F; (\I32.\CONST~i)~\val~(\I32.\CONST~0)~(\TABLEFILL~x)
     \quad\stepto\quad S; F; \epsilon
     \\ \qquad
     (\otherwise)
   \\[1ex]
   S; F; (\I32.\CONST~i)~\val~(\I32.\CONST~n+1)~(\TABLEFILL~x)
     \quad\stepto\quad S; F;
       \begin{array}[t]{@{}l@{}}
       (\I32.\CONST~i)~\val~(\TABLESET~x) \\
       (\I32.\CONST~i+1)~\val~(\I32.\CONST~n)~(\TABLEFILL~x) \\
       \end{array}
     \\ \qquad
     (\otherwise) \\
   \end{array}

@fitzgen
fitzgen force-pushed the table-fill-eager-bounds-check branch from 150ee7b to 465b37d Compare July 21, 2020 16:15
@fitzgen

fitzgen commented Jul 21, 2020

Copy link
Copy Markdown
Contributor Author

The corresponding formal rules should look something like this:

Thanks! I've added that to the commit.

@fitzgen

fitzgen commented Jul 21, 2020

Copy link
Copy Markdown
Contributor Author

(Note: I don't have merge permissions myself)

@rossberg
rossberg merged commit c360086 into WebAssembly:master Jul 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

table.fill needs to bounds check before executing table.set?

3 participants