All Projects → gate-computer → Wag

gate-computer / Wag

Licence: bsd-3-clause
WebAssembly compiler implemented in Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Wag

Jwebassembly
Java bytecode to WebAssembly compiler
Stars: ✭ 426 (+140.68%)
Mutual labels:  compiler, webassembly, wasm
Rappel
A linux-based assembly REPL for x86, amd64, armv7, and armv8
Stars: ✭ 818 (+362.15%)
Mutual labels:  arm64, x86-64, aarch64
Docker Cloudflare Ddns
A small amd64/ARM/ARM64 Docker image that allows you to use CloudFlare as a DDNS / DynDNS Provider.
Stars: ✭ 467 (+163.84%)
Mutual labels:  arm64, x86-64, aarch64
AheuiJIT
Aheui JIT compiler for PC and web
Stars: ✭ 27 (-84.75%)
Mutual labels:  x86-64, wasm, aarch64
Docker Homebridge
Homebridge Docker. HomeKit support for the impatient using Docker on x86_64, Raspberry Pi (armhf) and ARM64. Includes ffmpeg + libfdk-aac.
Stars: ✭ 1,847 (+943.5%)
Mutual labels:  arm64, x86-64, aarch64
interp
Interpreter experiment. Testing dispatch methods: Switching, Direct/Indirect Threaded Code, Tail-Calls and Inlining
Stars: ✭ 32 (-81.92%)
Mutual labels:  x86-64, wasm, aarch64
Webassemblyjs
Toolchain for WebAssembly
Stars: ✭ 566 (+219.77%)
Mutual labels:  compiler, webassembly, wasm
profiler-api
The portable version of JetBrains profiler API for .NET Framework / .NET Core / .NET / .NET Standard / Mono
Stars: ✭ 21 (-88.14%)
Mutual labels:  x86-64, arm64, aarch64
Wasm Forth
A Forth implementation compiling to WebAssembly.
Stars: ✭ 92 (-48.02%)
Mutual labels:  compiler, webassembly, wasm
Mir
A light-weight JIT compiler based on MIR (Medium Internal Representation)
Stars: ✭ 1,075 (+507.34%)
Mutual labels:  compiler, x86-64, aarch64
insaneworks-packer-template
CentOS 7-8 8Stream / AlmaLinux 8 / FreeBSD 12 - 13 x64 + VirtualBox / VMWare for Packer Template + FreeBSD 13 / AlmaLinux 9 + Parallels
Stars: ✭ 38 (-78.53%)
Mutual labels:  x86-64, arm64, aarch64
Assemblyscript
A TypeScript-like language for WebAssembly.
Stars: ✭ 13,152 (+7330.51%)
Mutual labels:  compiler, webassembly, wasm
pinktrace
Pink's Tracing Library
Stars: ✭ 20 (-88.7%)
Mutual labels:  x86-64, arm64, aarch64
Dora
Dora VM
Stars: ✭ 371 (+109.6%)
Mutual labels:  compiler, x86-64, aarch64
docker-dns-ad-blocker
A lightweight dnsmasq DNS server to block traffic to known ad servers with optional DNSCrypt support. Supports x86_64 and Raspberry Pi (armhf).
Stars: ✭ 78 (-55.93%)
Mutual labels:  x86-64, arm64, aarch64
Capstone
Capstone disassembly/disassembler framework: Core (Arm, Arm64, BPF, EVM, M68K, M680X, MOS65xx, Mips, PPC, RISCV, Sparc, SystemZ, TMS320C64x, Web Assembly, X86, X86_64, XCore) + bindings.
Stars: ✭ 5,374 (+2936.16%)
Mutual labels:  arm64, x86-64, webassembly
Ppci
A compiler for ARM, X86, MSP430, xtensa and more implemented in pure Python
Stars: ✭ 210 (+18.64%)
Mutual labels:  compiler, x86-64, webassembly
Asmjit
Machine code generation for C++
Stars: ✭ 2,874 (+1523.73%)
Mutual labels:  compiler, x86-64, aarch64
Viper
[WIP] A Pythonesque language with a design that focuses on efficiency and expressiveness. Compiles to WebAssembly
Stars: ✭ 23 (-87.01%)
Mutual labels:  compiler, webassembly, wasm
Grain
The Grain compiler toolchain and CLI. Home of the modern web staple. 🌾
Stars: ✭ 2,199 (+1142.37%)
Mutual labels:  compiler, webassembly, wasm

wag is a WebAssembly compiler implemented as a Go package.

Features

  • The input is a wasm binary module.

  • The output is machine code.

  • It is only a compiler. A runtime environment for the compiled program, including all import functions, needs to be implemented separately. (But see wasys for an example runtime.)

  • Single-pass, fast ahead-of-time compilation. Early functions can be executed while the latter functions are still being compiled, even while the source is still being downloaded.

  • The generated code requires minimal runtime support; it's designed to be executed in an isolated environment. Calling standard library ABIs is not directly supported, but see wasys for an example which exposes syscalls as WebAssembly import functions.

  • Supports snapshot-and-restore across compiler versions and CPU architectures.

  • Supports breakpoint debugging via recompilation.

  • Cross-compilation is supported via Go build tags. If wagamd64 is specified, the x86-64 code generator is used regardless of host architecture, and CPU feature detection is disabled with pessimistic assumptions. Likewise for wagarm64 (but feature detection is not used for ARM64).

Status

  • Supports WebAssembly version 1 (wasm32). No wasm extensions are supported.

  • Supports x86-64 and ARM64 code generation.

  • Generated x86-64 code requires SSE4.1 ROUNDSS/ROUNDSD instructions.

Security

Spectre variant 1: Out-of-bounds linear memory access detection requires that addressable but unallocated memory is inaccessible. It naturally prevents conditional branch exploitation.

Spectre variant 2: On x86, Retpoline is used to protect the runtime environment (although user programs shouldn't be able to inject arbitrary addresses into the branch target buffer).

Testing

Requires Linux, Go, make, cmake, clang++ and libcapstone. About 75% of the WebAssembly spec testsuite is run, by first converting the tests to binary format:

  • git clone --recurse-submodules https://github.com/gate-computer/wag.git
  • cd wag
  • make check

Screenshot #1

$ go get gate.computer/wag/cmd/wasys
$ wasys -v $GOPATH/src/gate.computer/wag/testdata/hello.wasm
import write(i32, i32, i32) i32
import openat(i32, i32, i32, i32) i32
import read(i32, i32, i32) i32
import close(i32) i32
import pipe2(i32, i32) i32
import _exit(i32)
hello, world

Screenshot #2

=== RUN   TestSnapshot
--- PASS: TestSnapshot (0.00s)
    snapshot_test.go:80: print output:
        10
        --- snapshotting ---
        current memory limit: 0x6a96051ca000
        current stack ptr:    0x6a960533ffc0
        globals+memory addr:  0x6a96051ba000
        stack addr:           0x6a960533f000
        globals+memory size:  65536
        memory size:          65536
        stack offset:         4032
        stacktrace:
        #1  func-3
        #2  func-2
        --- shot snapped ---
        20
    snapshot_test.go:88: resuming
    snapshot_test.go💯 print output:
        20
        30
        330
        40
        440
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].