Skip to content

Staged Miniwasm Interpreter #88

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

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft

Staged Miniwasm Interpreter #88

wants to merge 26 commits into from

Conversation

butterunderflow
Copy link
Contributor

No description provided.

@@ -0,0 +1,499 @@
package gensym.wasm.miniwasm
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you want to change the package name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once this version is stable, it will be moved to a dedicated package for staging code

// when tail call, share the continuation for returning with the callee
eval(body, List(), newFrame, kont, List(kont))
// when tail call, return to the caller's return continuation
eval(body, List(), newFrame, trail.last, List(trail.last))
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for spotting this!

Comment on lines 18 to 20
global.get 1
i32.const 3
global.set 2 ;; TODO: this line was compiled to global.get, fix the parser!
Copy link
Contributor

@ahuoguo ahuoguo Apr 29, 2025

Choose a reason for hiding this comment

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

You only have one global here. So you can only global.get/set 0.

I guess here you want to have global.get 0 and global.set 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file is not intended for execution (check the comment at the top of this file). It's more like a playground to see if our compiler works for each instruction, I'm sorry didn't mention that in the first place.

It seems there are some problems in our parser, the GlobalSet instruction is not exist in the parsed AST.

Copy link
Contributor

Choose a reason for hiding this comment

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

It was a typo. Thanks for spotting that.

@virtualize
trait StagedWasmEvaluator extends SAIOps {
def module: ModuleInstance
// NOTE: we don't need the following statements anymore, but where are they initialized?
Copy link
Member

Choose a reason for hiding this comment

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

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.

3 participants