sqlite fuzzler

simple web frontend stuff cssbed htmx


https://medium.com/swlh/a-suduko-solving-serverless-endpoint-using-webassembly-and-or-tools-df9f7bb10044 https://github.com/google/or-tools/pull/2404

walrus webassembly transformation library in rust

awesome wasm tools

program analysis for web assembly


wasmtime - run we assembly outside the cranelift - optimized code generator for jit and aot. experimental backend to rust. wamr - webassembly micro runtime. interpeter for embedded and resource constrained enarx - trusted xecutin environment


Webassembly system interface


(likely wascally wabbit) Web assembly binary toolkit sudo apt install wabt

wasm2c - decompiled version wasm2wat - binary totextual wat2wasm - textual to binary wasm-interp - interpet wasm wasm-objdump - look at disassembly alongside bits


wasmer vs wasmtime? https://wasmtime.dev/ https://github.com/wasm3/wasm3 another competitor? An interpeter?

wasmer? Wait wasmer is a startup? https://news.ycombinator.com/item?id=27537541 zig as a wasm compiler for wasm C? wasmer hello.wasm -i helloWorld wasmtime

Simple javascript opening - instantiate streaming with fetch api. You can directly compile WAT in browser.

wat2wasm hello.wat wasmer hello.wasm -i mysquare 4 default wasmer is run. -i is invoke

https://github.com/AssemblyScript/wabt.js a port of wabt to assemblyscript

Wasm modules

interesting fields in module state memory data element adds stuff to table tables funcs

https://wapm.io/ package manager - runs examples in browser?

Writing Wasm directly

Named parameters vs anonymous. Stack style vs “lispy” style


 (; block comment ;)
 ;; line comment
    ;; (memory 1) ;; generally things seems to take names $foo or can be referred to by index.
    ;; 1 means 1 page big. 
  ;;(global $g (import "js" "global") (mut i32))
  (func (result i32)
    (i32.const 42)
  (func $mysquare (param $x i32) (result i32) 
    (i32.mul (local.get $x) (local.get $x))
  (func (result i32)
     (call $mysquare (i32.const 42))
  (func $fact (param $x i32) (result i32)
    (local $acc i32)
    (local.set $acc (i32.const 1))
    (block $done ;; out breaking block
        (loop ;; "loop" block
            (local.set $acc (i32.mul (local.get $x) (local.get $acc)))
            (local.set $x (i32.sub (local.get $x) (i32.const 1)))
            (i32.eqz (local.get $x))
            (br_if $done)
            (br 0)
        (return (local.get $acc))
  (func $mymain)
  (export "helloWorld" (func 0))
  (export "mysquare" (func $mysquare))
  (export "fact" (func $fact))
  (start $mymain)


manual linking of webassembly by passing instantiated modules to other modules. That’s cool.

import external functions export internal definitions

https://github.com/WebAssembly/wasi-sdk wasi-sdk vs emscripten vs binaryen WASI I guess is kind of like POSIX system calls or libc in some respects?

Ok you can directly execute .wat files wat2wasm –debug-names puts debug names into Custom section of wasm file

https://wasdk.github.io/wasmcodeexplorer/ explore web assembly binary. highlights different pieces https://webassembly.studio/

assemblyscript - an annotated version of typescript that compiles directly-ish to wasm

binaryen - an optmizing compiler that accepts some kind of cfg or wasm. Has C api. wasm-opt will optimize wasm for me wasm2js


Finicky process. There are sections in the above books about this C++ exceptions and threads are something to look for.


  • emccmake cmake yada yada

You may need to puts flags into cmake projects. You may need to shield things in your code undo macros



More often than not it is linking flags.

Some things are easier or harder on node vs web. You should try both.

Often you need to play with the filesystem FS to make sure stuff exists.

Command line Utility Conversion

By default, emscripten refers to a global object called Module. You can create one with various flags and arguments.

var Module = {
   "print" : function(text){console.log(text)},
   "printErr" : function(text){console.error(text)},


<script src="myemscrtipt.js"></script>

You can add arguments, add to the file system, etc.

You may not want to thing to run as soon as the script tag is run. There is

-sMODULARIZE is a linking option





Needed to go into src/CMakeLists.txt and remove -Werror from

Is it actually using my flag?

cd /home/philip/Documents/prolog/souffle/build_wasm/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/souffle.dir/link.txt –verbose=1 /home/philip/Documents/prolog/emsdk/upstream/emscripten/em++ -sMAIN_MODULE=2 -stdlib=libc++ -O3 -fuse-ld=lld -lc++abi @CMakeFiles/souffle.dir/objects1.rsp -o souffle.js @CMakeFiles/souffle.dir/linklibs.rsp

Todo: Support dlopen. MAIN_MODULE=2 somehow should work but maybe need -fpic on entire build?

Modularize=1 was important to get multiple runs independent –no-proprocessor -D - Exposing the filesystem

It turns out link flags is where you put this stuff in cmake file. makes sense.

I believe you can renamed the module https://stackoverflow.com/questions/33623682/how-to-use-fs-when-modularize-and-export-name-are-used-in-emscripten -s EXPORT_NAME=”‘SOUFFLE’”


It just worked. Incredible Runnnig the file didn’t do anything. I needed to do

const lib = require("./minizinc.js");
//var MINIZINC = {arguments: ["--help"]};

on node

It seems like it was grabbing my node parameters.

In the browser, I was able to load in and pass in a Module object MINIZINC({arguments : [”–help”]})

Trying to build gecode emcconfigure ../configure emmake make -j8

gecode build suggestions for emscripten https://github.com/Gecode/gecode/issues/67 Hmm. They build a minizinc for wasm somewhere https://gitlab.com/minizinc/minizinc-js https://www.npmjs.com/package/minizinc/v/1.0.4-alpha.77

Ah I need release/6.3.0 branch which has the const fix.


MSWasm: Soundly Enforcing Memory-Safe Execution of Unsafe Code

https://github.com/AlexAltea/capstone.js https://github.com/bordplate/js86 https://github.com/AlexAltea/unicorn.js https://github.com/AlexAltea/libelf.js

Wasm baby

https://www.minizinc.org/doc-2.5.5/en/installation_detailed_wasm.html minizinc graphviz or-tools https://github.com/google/or-tools/pull/2404/files

The wasm reference interpeter is in ocaml https://github.com/WebAssembly/spec/tree/master/interpreter

What could be cool? SAT solver

Analysis on wasm https://github.com/synacktiv/toy-wasm-symbexp toy symbolic executor in haskell

https://github.com/WebAssembly/wabt binary toolkit

How do you just run a command line tool in the browser?


compiling miniznic source yadayada./emsdk_env.sh https://www.minizinc.org/doc-2.5.5/en/installation_detailed_wasm.html

mkdir build cd build emcmake cmake -DCMAKE_BUILD_TYPE=MinSizeRel .. emmake cmake –build .

Hmm runnign with node does nothing. I need to make a wrapper to call MINIZINC() It needs to be in an mjs file

Lots of important stuff is in the api reference Module, FS







https://github.com/jcubic/jquery.terminal - for making web based terminals. Alternaitve for some pruposes to xterm.js

https://news.ycombinator.com/item?id=29376105 compiling stock python to wasm pyiodide

cheerp - an alternative to emscripten?

webvm JIT compilation of stock x86 in the brwoser. Apparently higher perfomance than bessard’s jslinux hacker news discussion

virtual x86 a similar open source project but slower?

sqlite fiddle