Keep precompile PCH generation-local

This commit is contained in:
udo 2026-07-18 14:31:53 +00:00
parent 1952c7d762
commit 39636acf2e
5 changed files with 12 additions and 4 deletions

View File

@ -39,6 +39,12 @@ UCE expects these executables on each deployment host:
source map before debug sections are stripped from the runtime artifact. The
map is consulted only on a wasm trap.
The native compiler passes the ABI-generation root to
`scripts/compile_wasm_unit`. Unless `UCE_WASM_PCH_DIR` is explicitly set, the
unit PCH lives beneath that writable generation rather than a
process-user-dependent `/tmp` path. Managed precompile therefore behaves the
same inside and outside the service unit.
## Upgrade policy
Treat WASI SDK upgrades like runtime dependency upgrades:

View File

@ -233,7 +233,7 @@ whose compilation outlasted the guest CPU budget would immediately trap in the
following allocator/relocation call even though no guest loop consumed it.
Unit artifacts live beneath an ABI-generation directory such as
`BIN_DIRECTORY/units-c12-w7`: `c12` is the compiler/unit-metadata ABI and `w7`
`BIN_DIRECTORY/units-c13-w7`: `c13` is the compiler/unit-metadata ABI and `w7`
is the runtime core ABI. Old and new service binaries therefore never publish
or read the same unit path during an ABI transition. The managed restart builds
and serializes the complete next generation before stopping the old service;

View File

@ -9,6 +9,7 @@ DEST_DIR="$2"
SRC_FN="$3"
PP_FN="$4"
WASM_FN="$5"
UNIT_CACHE_DIR="${6:-$DEST_DIR}"
SDK=${WASI_SDK:-/opt/wasi-sdk}
ABI_VERSION=${UCE_UNIT_ABI_VERSION:-$(awk '/^#define UCE_WASM_CORE_ABI_VERSION / {print $3; exit}' src/wasm/abi.h)}
@ -19,7 +20,7 @@ MODULE_TMP="$DEST_DIR/$PP_FN.uce-module.txt"
WASM_TMP="$DEST_DIR/$WASM_FN.tmp.$$"
MAP_TMP="$DEST_DIR/$WASM_FN.source-map.tmp.$$"
PCH_ENABLED=${UCE_WASM_UNIT_PCH:-1}
PCH_DIR=${UCE_WASM_PCH_DIR:-/tmp/uce/wasm-w2/pch}
PCH_DIR=${UCE_WASM_PCH_DIR:-$UNIT_CACHE_DIR/.pch}
COMMON_FLAGS=(
--target=wasm32-wasip1
-fPIC -fvisibility=hidden -fvisibility-inlines-hidden

View File

@ -992,7 +992,8 @@ void compile_shared_unit(Request* context, SharedUnit* su)
shell_escape(su->bin_path)+" "+
shell_escape(su->file_name)+" "+
shell_escape(su->pre_file_name)+" "+
shell_escape(su->wasm_file_name)
shell_escape(su->wasm_file_name)+" "+
shell_escape(compiler_unit_bin_directory(context))
));
if(su->compiler_messages.length() == 0 && !file_exists(su->wasm_name))

View File

@ -1,4 +1,4 @@
#pragma once
#define UCE_WASM_CORE_ABI_VERSION 7
#define UCE_COMPILER_UNIT_ABI_VERSION 12
#define UCE_COMPILER_UNIT_ABI_VERSION 13