W3
This commit is contained in:
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
# Batch-build W2 wasm side modules for already-known/generated UCE units.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
BIN_DIR=${UCE_BIN_DIRECTORY:-/tmp/uce/work}
|
||||
KNOWN_FILE=${UCE_KNOWN_UNITS_FILE:-$BIN_DIR/known-uce-files.txt}
|
||||
MIN_UNITS=${UCE_W2_MIN_UNITS:-1}
|
||||
|
||||
if [ "$#" -gt 0 ]; then
|
||||
UNITS=("$@")
|
||||
else
|
||||
if [ ! -f "$KNOWN_FILE" ]; then
|
||||
echo "known unit registry not found: $KNOWN_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
mapfile -t UNITS < <(grep -v '^[[:space:]]*$' "$KNOWN_FILE")
|
||||
fi
|
||||
|
||||
count=0
|
||||
checked=0
|
||||
skipped=0
|
||||
# Native-only units that cannot be wasm side modules (yet).
|
||||
# - error-reporting.uce deliberately throws to exercise the native exception
|
||||
# path; the wasm backend replaces that machinery with traps (§11.1).
|
||||
# - tests/zip.uce uses try/catch around the zip library, which is carved out
|
||||
# of the wasm core until it moves behind a hostcall (W4+ membrane work).
|
||||
SKIP_PATTERN=${UCE_W2_SKIP:-(error-reporting|tests/zip)\.uce$}
|
||||
|
||||
for unit in "${UNITS[@]}"; do
|
||||
case "$unit" in
|
||||
*.uce|*.ws.uce) ;;
|
||||
*) continue ;;
|
||||
esac
|
||||
if [[ "$unit" =~ $SKIP_PATTERN ]]; then
|
||||
continue
|
||||
fi
|
||||
src_dir=$(dirname "$unit")
|
||||
base=$(basename "$unit")
|
||||
dest_dir="$BIN_DIR$src_dir"
|
||||
pp_fn="$base.cpp"
|
||||
wasm_fn="$base.wasm"
|
||||
if [ ! -f "$dest_dir/$pp_fn" ]; then
|
||||
echo "missing preprocessed unit: $dest_dir/$pp_fn" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ -s "$dest_dir/$wasm_fn" ] && [ "$dest_dir/$wasm_fn" -nt "$dest_dir/$pp_fn" ] && [ "$dest_dir/$wasm_fn" -nt "$unit" ]; then
|
||||
scripts/wasm/check_unit_wasm.py "$dest_dir/$wasm_fn"
|
||||
skipped=$((skipped + 1))
|
||||
else
|
||||
scripts/compile_wasm_unit "$src_dir" "$dest_dir" "$unit" "$pp_fn" "$wasm_fn"
|
||||
count=$((count + 1))
|
||||
fi
|
||||
checked=$((checked + 1))
|
||||
done
|
||||
|
||||
if [ "$checked" -lt "$MIN_UNITS" ]; then
|
||||
echo "checked only $checked wasm units, expected at least $MIN_UNITS" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "W2 batch wasm units: checked=$checked compiled=$count reused=$skipped"
|
||||
Reference in New Issue
Block a user