Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Wasm return_call demo #36288

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add Wasm return_call demo #36288

wants to merge 2 commits into from

Conversation

pepelsbey
Copy link
Member

@pepelsbey pepelsbey commented Oct 9, 2024

Description

  • Adds a new factorial demo
  • Explains existing demo

Motivation

Part of the Firefox 121 release notes task that got delayed due to the platform’s lack of support.

Additional details

@github-actions github-actions bot added Content:wasm WebAssembly docs size/s [PR only] 6-50 LoC changed labels Oct 9, 2024
Copy link
Contributor

github-actions bot commented Oct 9, 2024

Preview URLs

(comment last updated: 2024-10-11 00:00:53)

@pepelsbey pepelsbey marked this pull request as ready for review October 10, 2024 11:32
@pepelsbey pepelsbey requested a review from a team as a code owner October 10, 2024 11:32
@pepelsbey pepelsbey requested review from hamishwillee and removed request for a team October 10, 2024 11:32
Comment on lines +9 to +10
**`call`** calls a function, while **`call_indirect`** calls a function in a table.
**`return_call`** and **`return_call_indirect`** are the tail-call versions of `call` and `call_indirect`, respectively.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I appreciate that this predates you, but what is a tail-call? We should say, if you know?

It would be good to have an example of using call_indirect.

@@ -23,6 +24,20 @@ call $greet
| `return_call` | `0x12` |
| `return_call_indirect` | `0x13` |

## Examples
Copy link
Collaborator

@hamishwillee hamishwillee Oct 11, 2024

Choose a reason for hiding this comment

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

FYI Pushed this below syntax section, added headings for each example, and made the examples render as "taller".

There is no defined structure for examples and how they should be presented in WASM but the format used in Web APIs makes sense IMO. Note that this does mean that the example is duplicated from the top, but I am OK with that.

Copy link
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

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

@pepelsbey I've subedited to what I think is improved structure. I'd like an explanation of tail call ideally as per https://github.com/mdn/content/pull/36288/files#r1796238648
However if you don't want to do that because you consider it out of scope that is understandable - I'm approving so you have the choice to self merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:wasm WebAssembly docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants