-
-
Notifications
You must be signed in to change notification settings - Fork 667
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
feat: support first class function via builtin function #2752
Conversation
Are you sure we shouldn't wait until we use Wasm GC? |
I think we can do it separately. First class is based on object module, it don't and shouldn't rely on wasm GC or __new. It only means we have a Function class and can manage it as normal object. |
By "first class function", do you mean closures? Those might be easier to implement in Wasm GC, since the heap doesn't have to be dealt with manually, and closure objects for child blocks would include the parent closure objects (at least the way I see it). |
We have memory allocation abstraction, and then we have GC object abstraction based on memory allocation. Those thing can be replaced by |
That's actually my point. The Meanwhile, with Wasm GC, we could just make GC structs without touching AS's type system (which would also be simplified). As a result, it would (theoretically) be much more convenient to write, debug, and maintain. |
Also, the current test should already work: see here. |
Yes. This pr will not support closure. It only wants to support store function instance in heap instead of in data section. I think it will be the first step to support closure. |
I don't quite understand what you mean. |
Oh, do you mean creating a new |
485f557
to
6b35f1e
Compare
This is binaryen bug which fixed in latest binaryen.
|
@HerrCai0907 Great news you are working on this!! 🙏 @CountBleck Is Wasm GC ready? |
Nope. Keep in mind that I'm a procrastinating 10th grader who has to deal with an annoying amount of English homework :P I'll try to get in more work towards the Wasm GC transition in my spare time, but the progress won't really be visible until I make a PR to Binaryen. |
5705cc3
to
758e86a
Compare
758e86a
to
41cf0f7
Compare
This is the first pr to support first class function.
Firstly we need to support allocating function object in heap instead of data area.