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

Update TinyGo Compiler Flag note for WASI #131

Open
torch2424 opened this issue Jul 30, 2021 · 2 comments
Open

Update TinyGo Compiler Flag note for WASI #131

torch2424 opened this issue Jul 30, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@torch2424
Copy link
Owner

torch2424 commented Jul 30, 2021

From Dan Kegel in the Tinygo slack: "Hey Aaron, I think gc on wasm is conservative-ish by default since tinygo-org/tinygo#1853, maybe remove mention of -gc=conservative? I dunno, I just work here 🙂 but I hear -scheduler=none and/or -gc=leaking are the flags to try when odd crashes happen..."

@torch2424 torch2424 added the bug Something isn't working label Jul 30, 2021
@torch2424 torch2424 self-assigned this Jul 30, 2021
@aykevl
Copy link

aykevl commented Aug 1, 2021

You also don't need -wasm-abi=generic: this is the default for WASI.

# Note, some features aren't fully supported by WASI. So if you hit nil pointer references
# You may want to play around with the scheduler and gc flags. For example:
# "-scheduler=none -gc=conservative" or "-scheduler=coroutines -gc=leaking"

Some other notes:

  • It's not really WASI that causes these bugs, it's TinyGo. WebAssembly currently doesn't support direct access to the stack which is why TinyGo has to do things differently on WebAssembly compared to other architectures.
  • The default for WebAssembly is indeed -gc=conservative -scheduler=coroutines. You can inspect these values like this:
$ tinygo info wasi
LLVM triple:       wasm32--wasi
GOOS:              linux
GOARCH:            arm
build tags:        tinygo.wasm wasi tinygo math_big_pure_go gc.conservative scheduler.coroutines serial.none
garbage collector: conservative
scheduler:         coroutines
cached GOROOT:     /home/ayke/.cache/tinygo/goroot-go1.16.2-c80939e3ef7edbc184c2946545bb39c528b92e6385a60d8c810f1438cfb5211f-syscall

To rule out bugs in the GC or scheduler passes, you can try -gc=leaking or -scheduler=none, or both.

@torch2424
Copy link
Owner Author

@aykevl Ah! Thank you very much for this insight! I'll go ahead and try to convert this in the example when I get the time! Thank you! 😀🎉

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

No branches or pull requests

2 participants