Skip to content

Reference interpreter, step Return, clear stack#1101

Merged
rossberg merged 1 commit intoWebAssembly:masterfrom
nomeata:return-stack
Nov 16, 2019
Merged

Reference interpreter, step Return, clear stack#1101
rossberg merged 1 commit intoWebAssembly:masterfrom
nomeata:return-stack

Conversation

@nomeata
Copy link
Contributor

@nomeata nomeata commented Nov 16, 2019

according to
https://webassembly.github.io/spec/core/exec/instructions.html#exec-return
the Return instruction pops the top of the stack, until the next
frame. The equivalent in the reference interpreter should be to set
the value stack to []. This is what is happening for Break as well.
So for consistency, also do it here.

This has no visible effect: If the first instruction is Returning, the
stack is ignored everywhere. So this is purely cosmetic.

(I am only 80% sure; if not I hope to at least learn something here.)

according to
https://webassembly.github.io/spec/core/exec/instructions.html#exec-return
the `Return` instruction pops the top of the stack, until the next
frame. The equivalent in the reference interpreter should be to set
the value stack to `[]`. This is what is happening for `Break` as well.
So for consistency, also do it here.

This has no visible effect: If the first instruction is `Returning`, the
stack is ignored.
@nomeata
Copy link
Contributor Author

nomeata commented Nov 16, 2019

(I just connected Github to my W3 account.)

Copy link
Member

@rossberg rossberg left a comment

Choose a reason for hiding this comment

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

Makes sense, thanks!

@rossberg rossberg merged commit f89d298 into WebAssembly:master Nov 16, 2019
@nomeata nomeata deleted the return-stack branch November 17, 2019 16:34
raoxiaojia pushed a commit to WasmCert/spec that referenced this pull request Apr 29, 2025
according to
https://webassembly.github.io/spec/core/exec/instructions.html#exec-return
the `Return` instruction pops the top of the stack, until the next
frame. The equivalent in the reference interpreter should be to set
the value stack to `[]`. This is what is happening for `Break` as well.
So for consistency, also do it here.

This has no visible effect: If the first instruction is `Returning`, the
stack is ignored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants