ahoward / ahoward/spin

vendor or upstream the spinel __wasm__ runtime patch

Open
#2 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

deploy spinel
Dominant language
Ruby
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

context

the WASM/edge path is proven (handler → wasm32-wasi → runs under wasmtime,
identical CGI contract). but it required ~38 lines of patches to spinel's
lib/sp_runtime.h, and that patch currently lives ONLY in the scratch dir
(/tmp/webframe-spike/lib-wasm/), not in this repo. so the wasm build is
not reproducible from a clean checkout.

the patch (all platform-shim, zero handler/compiler changes)

  1. __wasm__ branch in the platform include block (no ucontext/mman/wait;
    mmapmalloc shim) — mirrors the existing _WIN32 branch
  2. WASI libc gaps: stub malloc_trim (no-op), getppid (→0),
    popen/pclose (→null) — all dead code on a handler path
  3. fiber stubs: sp_Fiber_*sp_raise if ever called (WASM has no
    native stack-switching; CGI handlers never create a Fiber)
  4. compile flag: -mllvm -wasm-enable-sjlj (spinel uses setjmp/longjmp;
    wasmtime supports the exception-handling proposal)

decision needed

  • upstream a clean __wasm__ branch to matz/spinel (best — ~40
    lines, benefits everyone, spinel may want WASI anyway), OR
  • vendor the patch in spin (a wasm/ dir + a spin build --wasm
    that applies it to a pinned spinel), OR
  • both (carry a patch now, PR upstream later)

deliverable

spin build --wasm handler.rb produces a runnable .wasm from a clean
checkout, with the runtime patch sourced reproducibly. see
docs/spike-hosting.md for the full port writeup.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read docs/spike-hosting.md first, then inspect the referenced spinel lib/sp_runtime.h patch in /tmp/webframe-spike/lib-wasm/. Decide whether to upstream, vendor, or do both, and verify that spin build --wasm handler.rb produces a runnable .wasm from a clean checkout with the runtime patch sourced reproducibly.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby, wasm
Domain
backend, build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.