Comments (17)
The fix for this issue is to update to the latest version of wagon ... and then you'll hit go-interpreter/wagon#69
from life.
I have gotten this working in olin.
Relevant commits:
Example web assembly module and its output:
xena at luna in ~/go/src/github.com/Xe/olin/internal/abi/wasmgo on master
❯ go test -v
=== RUN TestWasmGo
=== RUN TestWasmGo/github.com/Xe/olin/internal/abi/wasmgo.testNothing
nothing
--- PASS: TestWasmGo (1.66s)
--- PASS: TestWasmGo/github.com/Xe/olin/internal/abi/wasmgo.testNothing (1.66s)
PASS
ok github.com/Xe/olin/internal/abi/wasmgo 1.696s
More info here.
from life.
@Xe - syscall/js is always included when building for the js/wasm
platform. The current model in Go1.11 basically assumes that your Web Assembly runtime is the browser. And the only way to pass anything between the host and the WASM module is via the syscall/js callback APIs.
from life.
Hi guys,
I've managed to create a minimal, hardcoded exec.ImportResolver that can actually work with Go1.11 GOOS=js GOARCH=wasm executables.
You could use it for tinkering around or getting ideas about creating your own stuff.
It's definitely gonna change as i'm going to adapt it to event-sourcing and concurrency, but it's at least something.
What i have here is:
panic printing
Log() function
Call() function that allows you to asynchronously handle Callbacks, once VM is waiting for external event.
see usage example at: https://gitlab.com/albert_einstein/kwasm/tree/master/example
Any usage of other external communications (i.e. stdin,/stdout, http, sockets, files and etc) will cause your VM to mysteriously fail.
from life.
Instead of trying to support go's js/wasm
target, how about wasi/wasm
?
https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/
https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md
Relevant issue: golang/go#31105
from life.
Friends, we are still having this issue, even using the updated version of wagon (using @mastersingh24 's fork). Anyone able to use life at the moment?
from life.
Keeping this thread updated: it seems that including most of the standard library brings in syscall/js somehow. This is getting annoying fast. I am going to fork the Go compiler with a custom GOOS (olin
or dagger
, can't pick which) at https://github.com/Xe/go. I will need to do a lot of low-level runtime hacking in order to genericize the code for js/wasm
to work on webassembly in general, while still offering the Javascript features for things that need JS.
from life.
Yay weird linker errors: Xe/go@37bc30e
from life.
from life.
@mastersingh24 could you please update us on the status of this issue?
I thought go-interpreter/wagon#69 was going to be closed in go-interpreter/wagon#70, but that hasn't been merged yet.
from life.
@mastersingh24 how much of browser runtime can be pulled into life?
from life.
Can we use something like Otto to replace the JS runtime?
from life.
I have looked into using Otto to replace the JS runtime. I don't feel comfortable doing it because I don't know how much deviation it has from how browser JS does it.
from life.
Any updates with Go 1.12?
from life.
Go 1.12 is actually no better here.
FWIW - people might want to checkout tinygo ... it creates much cleaner WASM and does not assume the browser as the host environment
from life.
I got parts of the runtime working in Olin. Here's the code: https://github.com/Xe/olin/tree/master/internal/abi/wasmgo
from life.
The wasi/wasm target post-dates this issue
from life.
Related Issues (20)
- There is a problem in the judgment of was unreachable
- Snapshotting
- Compile once, execute many times
- inconsistent stack pattern: pt = false, lpt = false, ls = 2, sd = 0 HOT 2
- Comparison to V8
- Gas on StartSection
- User-friendly Fix: Need to panic that DefaultMemoryPages config option should be 1 or more HOT 2
- Is it possible to run go generated WASMs in the VM? HOT 1
- Call wasm function with string parameter?
- too many arguments in call to disasm.Disassemble HOT 3
- SSA advantages HOT 1
- How AddGas injected? HOT 1
- I use emcc compile a simple cpp to wasm. but can't works in `life` HOT 1
- Can it load multiple wasm file?
- why retrun value 0 when enable polymerase?
- Add golangci linter
- WASI support
- No exported functions HOT 1
- Floating point operation is very inaccurate
- cannot return error while panic
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from life.