W7e: delete the native unit pipeline (.so compile + dlopen execution)
Units now run exclusively on wasm; the native generated-C++ -> clang -> .so -> dlopen path and its request-time fallback are removed. - Dispatch (linux_fastcgi.cpp): the 4 handle_complete branches + the CLI-socket path route every request through wasm (wasm_ready compiles cold/stale on demand); a wasm-unavailable unit now yields a clean error page (fail_wasm_unavailable / render_request_failure) instead of native execution. compiler_invoke / _cli / _websocket / _serve_http deleted. - compiler.cpp (-1274): removed the native .so compile (COMPILE_SCRIPT), load_shared_unit, dlopen/dlsym/dlclose, compiler_load_shared_unit, and the SharedUnit .so function-pointer fields (on_setup/on_render/on_component/ on_websocket/on_cli/on_once/on_init) in types.h/types.cpp. compile_shared_unit now builds only the .wasm side-module; the .uce preprocessor/parser front-end is kept (it emits the C++ the wasm compile consumes). - unit_call()/component()/once/init now resolve across units through the wasm host component resolver (uce_host_component_resolve) instead of native dlsym; configured runtime error pages render through the wasm backend. - Dropped the WASM_BACKEND_ENABLED feature flag and dead COMPILE_SCRIPT / COMPILE_WASM_UNITS config; unit ABI freshness tied to UCE_UNIT_ABI_VERSION; guard against serving a stale .wasm for a deleted source; retired the obsolete W5 native-vs-wasm toggle script. Docs updated. Implemented via the pi agent (with 3 delegated sub-reviews); independently re-verified on the build host: run_cli_tests --include-wasm-kill => 87 passed, 0 failed, 0 skipped. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+12
-4
@@ -9,11 +9,11 @@ GF="uce_fastcgi"
|
||||
mkdir bin > /dev/null 2>&1
|
||||
mkdir bin/tmp > /dev/null 2>&1
|
||||
mkdir bin/assets > /dev/null 2>&1
|
||||
mkdir bin/wasm > /dev/null 2>&1
|
||||
mkdir work > /dev/null 2>&1
|
||||
|
||||
COMPILER="clang++"
|
||||
# -rdynamic is a link-time flag (exports the binary's symbols so dlopen'd .uce
|
||||
# units resolve the runtime against it); the -c compiles below do not need it.
|
||||
# -rdynamic is a link-time flag; the -c compiles below do not need it.
|
||||
FLAGS="-g -w -Wall -$OPT_FLAG -std=c++20 -fpermissive -ffast-math"
|
||||
|
||||
# Wasmtime C++ API — needed only by the wasm backend object (src/wasm).
|
||||
@@ -30,8 +30,8 @@ SRCFLAGS="-D EXEC_NAME=\"$GF\" -D PLATFORM_NAME=\"linux\""
|
||||
# bin/sqlite3.o vendored SQLite amalgamation (depends only on its own source)
|
||||
# bin/wasm.o wasm backend + worker + wasmtime.hh (src/wasm)
|
||||
# bin/main.o linux_fastcgi.cpp + the uce_lib core amalgamation
|
||||
# All link into the single -rdynamic binary, so the dlopen unit model is
|
||||
# unchanged. Delete bin/*.o to force a clean rebuild.
|
||||
# All link into the single -rdynamic binary. Delete bin/*.o to force a clean
|
||||
# rebuild.
|
||||
|
||||
# Rebuild $1 if it is missing or anything under the remaining find-args is newer.
|
||||
needs_rebuild() {
|
||||
@@ -41,6 +41,14 @@ needs_rebuild() {
|
||||
return 1
|
||||
}
|
||||
|
||||
# core.wasm: guest runtime loaded by the native wasm backend.
|
||||
if needs_rebuild bin/wasm/core.wasm src/wasm/core.cpp src/lib src/wasm/core_hostcalls.syms src/wasm/core_libc_exports.syms scripts/build_core_wasm.sh; then
|
||||
echo "Compiling wasm core..."
|
||||
bash scripts/build_core_wasm.sh || exit 1
|
||||
else
|
||||
echo "Reusing bin/wasm/core.wasm"
|
||||
fi
|
||||
|
||||
# SQLite: vendored C, depends only on its own source (not our headers).
|
||||
if needs_rebuild bin/sqlite3.o src/3rdparty/sqlite/sqlite3.c src/3rdparty/sqlite/sqlite3.h; then
|
||||
echo "Compiling SQLite..."
|
||||
|
||||
@@ -50,7 +50,7 @@ build_pch_if_needed() {
|
||||
return 0
|
||||
fi
|
||||
mkdir -p "$PCH_DIR"
|
||||
if [ -s "$PCH_FN" ]; then
|
||||
if [ -s "$PCH_FN" ] && [ -z "$(find src/lib -maxdepth 1 -name '*.h' -type f -newer "$PCH_FN" -print -quit)" ]; then
|
||||
return 0
|
||||
fi
|
||||
"$SDK/bin/clang++" "${COMMON_FLAGS[@]}" \
|
||||
|
||||
+15
-90
@@ -1,94 +1,19 @@
|
||||
#!/bin/bash
|
||||
# W5 parity/performance gate for the config-selectable WASM backend.
|
||||
# Runs on k-uce. Requires root because the live service reads /etc/uce/settings.cfg.
|
||||
# Retired W5 parity/performance gate.
|
||||
#
|
||||
# W7e removed the config-selectable native backend and all native unit
|
||||
# execution. There is no longer a valid WASM_BACKEND_ENABLED=0 baseline to
|
||||
# switch to here; doing so would only create a misleading service state.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
cat >&2 <<'EOF'
|
||||
run_w5.sh is retired: UCE unit execution is wasm-only after W7e.
|
||||
Use the supported regression gate instead:
|
||||
|
||||
if [ "${EUID:-$(id -u)}" -ne 0 ]; then
|
||||
echo "run_w5.sh must run as root so it can switch /etc/uce/settings.cfg and restart uce.service" >&2
|
||||
exit 1
|
||||
fi
|
||||
bash scripts/build_linux.sh && systemctl restart uce.service && sleep 3 \
|
||||
&& bash scripts/run_cli_tests.sh --include-wasm-kill
|
||||
|
||||
OUT=${UCE_W5_OUT:-/tmp/uce/wasm-w5}
|
||||
CONFIG=${UCE_CONFIG:-/etc/uce/settings.cfg}
|
||||
mkdir -p "$OUT"
|
||||
BACKUP="$OUT/settings.cfg.before-w5"
|
||||
cp "$CONFIG" "$BACKUP"
|
||||
|
||||
restore_on_error() {
|
||||
if [ "${UCE_W5_KEEP_BACKEND:-0}" != "1" ]; then
|
||||
cp "$BACKUP" "$CONFIG"
|
||||
systemctl restart uce.service >/dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
||||
trap restore_on_error EXIT
|
||||
|
||||
set_backend() {
|
||||
local enabled="$1"
|
||||
local tmp
|
||||
tmp=$(mktemp)
|
||||
awk -F= -v enabled="$enabled" '
|
||||
BEGIN { found = 0 }
|
||||
/^WASM_BACKEND_ENABLED=/ { print "WASM_BACKEND_ENABLED=" enabled; found = 1; next }
|
||||
{ print }
|
||||
END { if(!found) print "WASM_BACKEND_ENABLED=" enabled }
|
||||
' "$CONFIG" > "$tmp"
|
||||
for kv in \
|
||||
'WASM_BACKEND_VERBOSE=0' \
|
||||
'WASM_CORE_PATH=/Code/uce.openfu.com/uce/bin/wasm/core.wasm' \
|
||||
'WASM_MEMORY_LIMIT_BYTES=536870912' \
|
||||
'WASM_EPOCH_DEADLINE_TICKS=200' \
|
||||
'WASM_EPOCH_PERIOD_MS=50'
|
||||
do
|
||||
key=${kv%%=*}
|
||||
if ! grep -q "^${key}=" "$tmp"; then
|
||||
printf '%s\n' "$kv" >> "$tmp"
|
||||
fi
|
||||
done
|
||||
cat "$tmp" > "$CONFIG"
|
||||
rm -f "$tmp"
|
||||
systemctl restart uce.service >/dev/null
|
||||
sleep 1
|
||||
}
|
||||
|
||||
summary_total() {
|
||||
awk '/^Summary:/ { print $2; found=1 } END { if(!found) print 0 }' "$1"
|
||||
}
|
||||
|
||||
# Native reference baseline.
|
||||
set_backend 0
|
||||
scripts/run_cli_tests.sh > "$OUT/native-warmup.txt" || true
|
||||
scripts/run_cli_tests.sh > "$OUT/native-network.txt"
|
||||
python3 tests/wasm_benchmark.py --out-dir "$OUT/native-benchmark" --samples "${UCE_W5_BENCH_SAMPLES:-20}" --timeout 30 >/dev/null
|
||||
|
||||
# WASM default backend with W5 native fallbacks for host-owned surfaces.
|
||||
set_backend 1
|
||||
scripts/run_cli_tests.sh --include-wasm-kill > "$OUT/wasm-warmup.txt" || true
|
||||
scripts/run_cli_tests.sh --include-wasm-kill > "$OUT/wasm-network.txt"
|
||||
python3 tests/wasm_benchmark.py \
|
||||
--out-dir "$OUT/benchmark" \
|
||||
--backend-label wasm \
|
||||
--compare-native-json "$OUT/native-benchmark/benchmark.json" \
|
||||
--samples "${UCE_W5_BENCH_SAMPLES:-20}" \
|
||||
--timeout 30
|
||||
python3 tests/wasm_site_audit.py --out-dir "$OUT" >/dev/null
|
||||
|
||||
network_cases=$(summary_total "$OUT/wasm-network.txt")
|
||||
if [ "$network_cases" -lt 80 ]; then
|
||||
echo "W5 HARNESS: FAIL"
|
||||
echo "wasm network ran $network_cases cases, expected at least 80"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'W5 HARNESS: PASS'
|
||||
echo "network_cases=$network_cases benchmark_rows=see benchmark.json"
|
||||
echo "reports=$OUT"
|
||||
|
||||
if [ "${UCE_W5_KEEP_BACKEND:-0}" = "1" ]; then
|
||||
trap - EXIT
|
||||
printf 'WASM backend left enabled in %s\n' "$CONFIG"
|
||||
else
|
||||
cp "$BACKUP" "$CONFIG"
|
||||
systemctl restart uce.service >/dev/null
|
||||
trap - EXIT
|
||||
fi
|
||||
For performance comparisons, use tests/wasm_benchmark.py against the current
|
||||
wasm backend; native-baseline artifacts under docs/wasm-baselines are historical
|
||||
only.
|
||||
EOF
|
||||
exit 2
|
||||
|
||||
Reference in New Issue
Block a user