Open cwebber opened 3 years ago
This post shows how you can run a wasm-compiled Go program, but the gist of it is if you have a file called fib.wasm
that exports a function of one argument called fib
, you can run it with:
#lang racket
(require wasm/private/binary
wasm/private/vm)
(define m (call-with-input-file "fib.wasm" read-wasm))
(define v (make-vm m (hash)))
(define fib (vm-ref v "fib"))
(fib 8)
You can also take the WASM module and compile it into Racket code:
(require wasm/private/compiler)
(define-values (ns sexp init!)
(compile-mod m (hash)))
(parameterize ([current-namespace ns])
(eval (compile sexp))
(init!)
(namespace-require ''wasm)
((namespace-variable-value 'fib) 8))
Could you please share the "go-runtime.rkt" file that you use in the blog post?
Could you please share the "go-runtime.rkt" file that you use in the blog post?
It's easy to miss, but the blog post does link to go-runtime.rkt. Note that if you try to use it with a recent version of Go, you might have to make some changes. I believe I was using Go 1.15 or 1.16 when I wrote that.
Okay, thanks! Sorry I missed it.
@Bogdanp the repository seems to only contain tests for the validation code. Have you tested the interpreter in some way? Have you ever tried to validate it against the official WASM tests? I'm thinking of this: https://github.com/WebAssembly/spec/tree/w3c-1.0/test/core
I'd like to give this project a try but I don't quite know how to try anything yet... even a braindump might be nice :)