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

AssemblyScript example optimized version fails #73

Open
Tracked by #84
tolauwae opened this issue Jun 1, 2022 · 2 comments · May be fixed by #197
Open
Tracked by #84

AssemblyScript example optimized version fails #73

tolauwae opened this issue Jun 1, 2022 · 2 comments · May be fixed by #197
Labels
bug Something isn't working

Comments

@tolauwae
Copy link
Member

tolauwae commented Jun 1, 2022

Trying to run the AssemblyScript example without the mqtt fails. (= programming demo example)

When the busy loop is empty, binaryen optimizes away callback functions. It eliminates the funcref table and passes the function's own index to the subscribe_interrupt primitive.

    while (true) {    
        wd.sleep(5); // Sleep for 5 seconds    
    }

The resulting index is obviously out of range since there is no table. This causes an unhandled exception whenever the VM wants to resolve an event.

It seems users of Asyncify have run into similar problems: WebAssembly/binaryen#4484

@tolauwae tolauwae added the bug Something isn't working label Jun 1, 2022
@tolauwae tolauwae mentioned this issue Jun 2, 2022
16 tasks
@tolauwae tolauwae mentioned this issue Sep 16, 2022
29 tasks
@tolauwae tolauwae linked a pull request Jul 13, 2023 that will close this issue
@tolauwae tolauwae linked a pull request Jul 13, 2023 that will close this issue
@carllocos
Copy link
Contributor

I also experience this issue, however, in my case, the table is not compiled away but the table index is clearly out-of-range

@tolauwae
Copy link
Member Author

tolauwae commented Jul 13, 2023

The table is never compiled away anymore. I fixed that issue a while back by setting the correct compiler options.

But callbacks still don't work, because the table index is passed through wasm memory now instead of directly (like before). See PR #197 for a temporary fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants