Skip to content

Instantly share code, notes, and snippets.

@tlively
tlively / behaviors.js
Created November 5, 2026 21:37
Wasm object behaviors
// (module
// (type (struct (field (mut i32))))
// (func (export "make") (result structref)
// (struct.new 0 (i32.const 42)))
// (func (export "take_eqref") (param eqref)))
const wasmBytes = new Uint8Array([
0x00, 0x61, 0x73, 0x6d, // magic ("\0asm")
0x01, 0x00, 0x00, 0x00, // version 1
// Type section: 3 types
0x01, 0x0d, 0x03,
commit ed16881d3377840f47046ae551a334613a125b7e
Merge: c7be39053 aa4dcf44b
Author: Thomas Lively <tlively@google.com>
Date: Fri Oct 23 16:33:02 2026 -0700
Merge remote-tracking branch 'upstream/main' into merge-upstream-2026-10-23
# Conflicts:
# .github/workflows/ci-interpreter.yml
# README.md
diff --git a/README.md b/README.md
index 4dfd708d8..63b894c4c 100644
--- a/README.md
+++ b/README.md
@@ -1,9 +1,12 @@
-![Spectec Status](https://github.com/WebAssembly/spec/actions/workflows/ci-spectec.yml/badge.svg)
-![Interpreter Status](https://github.com/WebAssembly/spec/actions/workflows/ci-interpreter.yml/badge.svg)
-![Spec doc Status](https://github.com/WebAssembly/spec/actions/workflows/ci-spec.yml/badge.svg)
+[![CI for specs](https://github.com/WebAssembly/stack-switching/actions/workflows/ci-spec.yml/badge.svg)](https://github.com/WebAssembly/stack-switching/actions/workflows/ci-spec.yml)
+[![CI for interpreter & tests](https://github.com/WebAssembly/stack-switching/actions/workflows/ci-interpreter.yml/badge.svg)](https://github.com/WebAssembly/stack-switching/actions/workflows/ci-interpreter.yml)
@tlively
tlively / add128-benchmark.cc
Created August 2, 2026 01:02
add128-benchmark.cc
// Small standalone C++ benchmark for 128-bit addition.
// Supports native __uint128_t, 2x64-bit limb addition with carry,
// compiler builtins (__builtin_add_overflow), and x86 ADC intrinsics.
#include <chrono>
#include <cstdint>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <memory>
@tlively
tlively / id.py
Created February 6, 2024 02:02
Update identifiers in wat tests
#! /usr/bin/python3
"""Ensure all identifiers match the supported format.
"""
import argparse
import glob
import os
import subprocess
import sys
@tlively
tlively / if.py
Created January 4, 2024 19:49
Automatically translate Binaryen's if expressions to standard format
#! /usr/bin/python3
"""Translate from the legacy if-else text syntax to the standard syntax
"""
import argparse
import glob
import os
import subprocess
import sys
@tlively
tlively / channels.html
Created February 1, 2023 19:44
Repro showing that relaying messages via a worker does not work in FireFox
<script>
console.log('Starting up');
var receiverCode = '(' + (() => {
console.log('Hello from receiver');
self.onmessage = (msg) => {
if (typeof msg.data === 'string') {
console.log('received from main:', msg.data);
} else {
@tlively
tlively / fs_bench.c
Last active February 27, 2023 23:22
#include <assert.h>
#include <fcntl.h>
#include <pthread.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
@tlively
tlively / j2wasm_application.wat
Created April 20, 2021 19:42
j2wasm_application.wat
This file has been truncated, but you can view the full file.
;;; Code generated by J2WASM
(module
(global $java.lang.Object.rtt (rtt 0 $java.lang.Object) (rtt.canon $java.lang.Object))
(global $TestRunner.rtt (rtt 1 $TestRunner) (rtt.sub $TestRunner (global.get $java.lang.Object.rtt)))
(global $java.beans.Beans.rtt (rtt 1 $java.beans.Beans) (rtt.sub $java.beans.Beans (global.get $java.lang.Object.rtt)))
(global $java.io.Writer.rtt (rtt 1 $java.io.Writer) (rtt.sub $java.io.Writer (global.get $java.lang.Object.rtt)))
(global $java.io.BufferedWriter.rtt (rtt 2 $java.io.BufferedWriter) (rtt.sub $java.io.BufferedWriter (global.get $java.io.Writer.rtt)))
(global $java.io.InputStream.rtt (rtt 1 $java.io.InputStream) (rtt.sub $java.io.InputStream (global.get $java.lang.Object.rtt)))
(global $java.io.ByteArrayInputStream.rtt (rtt 2 $java.io.ByteArrayInputStream) (rtt.sub $java.io.ByteArrayInputStream (global.get $java.io.InputStream.rtt)))
(global $java.io.OutputStream.rtt (rtt 1 $java.io.OutputStream) (rtt.sub $java.io.OutputStream (global.get $java.lang.Object.rtt)))
This file has been truncated, but you can view the full file.
;;; Code generated by J2WASM
(module
(global $java.lang.Object.rtt (rtt 0 $java.lang.Object) (rtt.canon $java.lang.Object))
(global $TestRunner.rtt (rtt 1 $TestRunner) (rtt.sub $TestRunner (global.get $java.lang.Object.rtt)))
(global $java.beans.Beans.rtt (rtt 1 $java.beans.Beans) (rtt.sub $java.beans.Beans (global.get $java.lang.Object.rtt)))
(global $java.io.Writer.rtt (rtt 1 $java.io.Writer) (rtt.sub $java.io.Writer (global.get $java.lang.Object.rtt)))
(global $java.io.BufferedWriter.rtt (rtt 2 $java.io.BufferedWriter) (rtt.sub $java.io.BufferedWriter (global.get $java.io.Writer.rtt)))
(global $java.io.InputStream.rtt (rtt 1 $java.io.InputStream) (rtt.sub $java.io.InputStream (global.get $java.lang.Object.rtt)))
(global $java.io.ByteArrayInputStream.rtt (rtt 2 $java.io.ByteArrayInputStream) (rtt.sub $java.io.ByteArrayInputStream (global.get $java.io.InputStream.rtt)))
(global $java.io.OutputStream.rtt (rtt 1 $java.io.OutputStream) (rtt.sub $java.io.OutputStream (global.get $java.lang.Object.rtt)))