libghostty: simplify Wasm allocation API

Replace a bunch of type-specific Wasm allocation functions with a generic
byte allocator and reusable opaque out-parameters for pointers. This
makes it a lot more ergonomic (relatively) to use the Wasm interface
and removes a dozen or so exports.

This also updates the `ghostty_type_json` `abi` field with a maximum
alignment value that host sides can use to keep every allocation aligned
properly, easily, without hardcoding numbers.

This adds a test to verify this all works as intended and runs in CI.
This commit is contained in:
Mitchell Hashimoto
2026-08-16 12:37:16 -07:00
parent 0ba6250388
commit a8e9b413f1
17 changed files with 481 additions and 243 deletions

View File

@@ -733,6 +733,11 @@ jobs:
echo "Verified ${artifact} requires simd128"
done
- name: Test WASM allocator
run: |
nix develop -c node test/wasm-alloc.mjs ghostty-vt.wasm
nix develop -c node test/wasm-alloc.mjs ghostty-vt-small.wasm
# Compile-only checks for the -Dvt-features flags so that future changes
# don't regress any feature combination.
build-libghostty-vt-features: