Phase 11-12: LLVM backend initial, semantics layer, plugin unification

Major changes:
- LLVM backend initial implementation (compiler.rs, llvm mode)
- Semantics layer integration in interpreter (operators.rs)
- Phase 12 plugin architecture revision (3-layer system)
- Builtin box removal preparation
- MIR instruction set documentation (26→Core-15 migration)
- Cross-backend testing infrastructure
- Await/nowait syntax support

New features:
- LLVM AOT compilation support (--backend llvm)
- Semantics layer for interpreter→VM flow
- Tri-backend smoke tests
- Plugin-only registry mode

Bug fixes:
- Interpreter plugin box arithmetic operations
- Branch test returns incorrect values

Documentation:
- Phase 12 README.md updated with new plugin architecture
- Removed obsolete NYIR proposals
- Added LLVM test programs documentation

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-09-01 23:44:34 +09:00
parent fff9749f47
commit 11506cee3b
196 changed files with 10955 additions and 380 deletions

View File

@ -44,19 +44,31 @@ if ! command -v llvm-config-18 >/dev/null 2>&1; then
fi
echo "[1/4] Building nyash (feature=llvm) ..."
LLVM_SYS_180_PREFIX=$(llvm-config-18 --prefix) cargo build --release --features llvm >/dev/null
_LLVMPREFIX=$(llvm-config-18 --prefix)
LLVM_SYS_181_PREFIX="${_LLVMPREFIX}" LLVM_SYS_180_PREFIX="${_LLVMPREFIX}" cargo build --release --features llvm >/dev/null
echo "[2/4] Emitting object (.o) via LLVM backend ..."
OBJ="nyash_llvm_temp.o"
rm -f "$OBJ"
LLVM_SYS_180_PREFIX=$(llvm-config-18 --prefix) ./target/release/nyash --backend llvm "$INPUT" >/dev/null || true
# Default object output path under target/aot_objects
mkdir -p "$PWD/target/aot_objects"
stem=$(basename "$INPUT")
stem=${stem%.nyash}
OBJ="${NYASH_LLVM_OBJ_OUT:-$PWD/target/aot_objects/${stem}.o}"
if [[ "${NYASH_LLVM_SKIP_EMIT:-0}" != "1" ]]; then
rm -f "$OBJ"
NYASH_LLVM_OBJ_OUT="$OBJ" LLVM_SYS_181_PREFIX="${_LLVMPREFIX}" LLVM_SYS_180_PREFIX="${_LLVMPREFIX}" ./target/release/nyash --backend llvm "$INPUT" >/dev/null || true
fi
if [[ ! -f "$OBJ" ]]; then
echo "error: object not generated: $OBJ" >&2
echo "hint: you can pre-generate it (e.g. via --run-task smoke_obj_*) and set NYASH_LLVM_SKIP_EMIT=1" >&2
exit 3
fi
echo "[3/4] Building NyRT static runtime ..."
( cd crates/nyrt && cargo build --release >/dev/null )
if [[ "${NYASH_LLVM_SKIP_NYRT_BUILD:-0}" == "1" ]]; then
echo " Skipping NyRT build (NYASH_LLVM_SKIP_NYRT_BUILD=1)"
else
( cd crates/nyrt && cargo build --release >/dev/null )
fi
echo "[4/4] Linking $OUT ..."
cc "$OBJ" \
@ -66,4 +78,3 @@ cc "$OBJ" \
echo "✅ Done: $OUT"
echo " (runtime requires nyash.toml and plugin .so per config)"