-
Notifications
You must be signed in to change notification settings - Fork 951
feat:add new target to support wasm freestanding #3072
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:add new target to support wasm freestanding #3072
Conversation
54cf07c
to
56f1495
Compare
@deadprogram plan to use this feature? |
I want to bikeshed the tag. |
@dgryski barewasm seems a reasonable tag name. I think developers are very much in need of #3068. Although WASM was originally designed for browser front-end development, new use cases are being raised for VMs in the blockchain dev communities, and various cross-platform algorithm implementations. One of the most important things is that WASM can take good advantage of the existing technical capabilities of various languages. |
for the bikeshed I think 'freestanding' is in use for wasm for something similar (maybe zig?) would be cool to use common conventions esp if there aren't strong feelings about it. @mathetake do you have any opinion? |
rust: unknown, zig: freestanding, so either works for me |
its better to use freestanding than unknown. @dgryski any better idea
|
c3d6e00
to
793144e
Compare
@codefromthecrypt please help to retry the ci? |
From the looks of those CI errors, someone needs to rebase this branch against the latest |
793144e
to
3eb4033
Compare
dprint is a code formatter written in Rust that supports plugins in bare wasm. The only thing These wasm files have to do is export some functions that dprint will then call, but it does not provide WASI or emscripten or any other interface. The dprint wasm plugins written in Rust all target |
so you are planning to use golang formatter to generate wasm plugin? |
Yes. I want to create a wasm binary including the shfmt shell formatter that is written in Go. Thus the plugin itself must also be written in Go, as it depends on shfmt. But back to the original question, how far is the progress on this? Is it already somehow usable? I am sure this target is what I need for my use case. |
there are still some behaviors that cannot be determined which method is better, especially the time part,should be panic or follow behavior suggested by @codefromthecrypt. If the current demand is strong, you can also consider this idea https://github.com/ipfs-force-community/go_tinygo_patch for using increasing value for time return, this could make ramdom worked, but increase risk because randomness can be predicted. |
It is more often the case that projects are enabling a freestanding target, and that may or may not have an exporting memory depending on how that's interpreted. This adds the ability to inspect memories similar to how you can already inspect compiled code prior to instantiation. For example, you can enforce an ABI constraint that "memory" must be exported even if WASI is not in use. See tinygo-org/tinygo#3072 cc @hunjixin Signed-off-by: Adrian Cole <[email protected]>
3eb4033
to
dcc39e2
Compare
dcc39e2
to
c0b37f4
Compare
Any update on this? Happy to contribute if needed, or are you still trying to establish behavior? |
This pr should work normally, but I don't know how to make tinygo accept this target. The behavioral aspect tends to keep the existing implemented behavior. There is a security risk in using self increasing time. development usually use time.Now as a random seed. especially in the financial smart contract. |
We're nearing a year since @hunjixin raised this. The last question was "how to make tinygo accept this target" Could someone lay out what is required to get this in, sounds like getting the build to pass is a given. What else can be checked off? |
Valid point @codefromthecrypt @dgryski @aykevl what are your thoughts on this? Also while keeping in mind upcoming changes for Go1.21+ |
when I build it
|
I would like to have this sort of functionality myself to be able to run TinyGo compiled code on WAMR. I think since the naming of Regarding getting this change accepted, there needs to be some tests showing that it works as expected. Some tests similar to the wasi target is the most likely place to look for inspiration. Thanks for working on this, and let me know how I can help out. |
Signed-off-by: deadprogram <[email protected]>
Signed-off-by: deadprogram <[email protected]>
Signed-off-by: deadprogram <[email protected]>
Signed-off-by: deadprogram <[email protected]>
Now that #4125 has been merged, I am closing this one. Thanks again everyone! |
resolve #3068