📚 Phase 11 documentation: Everything is Box × MIR15 revolution
Key updates: - Document MIR 26→15 instruction reduction plan (transitioning status) - Add Core-15 target instruction set in INSTRUCTION_SET.md - Save AI conference analyses validating Box Theory and 15-instruction design - Create MIR annotation system proposal for optimization hints - Update SKIP_PHASE_10_DECISION.md with LLVM direct migration rationale Technical insights: - RefNew/RefGet/RefSet can be eliminated through Box unification - GC/sync/async all achievable with 15 core instructions - BoxCall lowering can automatically insert GC barriers - 2-3x performance improvement expected with LLVM - Build time reduction 50%, binary size reduction 40% Status: Design complete, implementation pending
This commit is contained in:
@ -44,11 +44,10 @@ if ! cargo build --release --features cranelift-jit >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[2/4] Emitting object (.o) via JIT (Strict/No-fallback) ..."
|
||||
echo "[2/4] Emitting object (.o) via JIT (Strict/No-fallback, jit-direct) ..."
|
||||
rm -rf target/aot_objects && mkdir -p target/aot_objects
|
||||
NYASH_AOT_OBJECT_OUT=target/aot_objects \
|
||||
NYASH_USE_PLUGIN_BUILTINS=1 \
|
||||
NYASH_JIT_EXEC=1 \
|
||||
NYASH_JIT_ONLY=1 \
|
||||
NYASH_JIT_STRICT=1 \
|
||||
NYASH_JIT_NATIVE_F64=1 \
|
||||
@ -56,13 +55,13 @@ NYASH_JIT_NATIVE_F64=1 \
|
||||
NYASH_JIT_PLUGIN_F64="${NYASH_JIT_PLUGIN_F64:-41:2}" \
|
||||
NYASH_JIT_ARGS_HANDLE_ONLY=1 \
|
||||
NYASH_JIT_THRESHOLD=1 \
|
||||
./target/release/nyash --backend vm "$INPUT" >/dev/null || true
|
||||
./target/release/nyash --jit-direct "$INPUT" >/dev/null || true
|
||||
|
||||
OBJ="target/aot_objects/main.o"
|
||||
if [[ ! -f "$OBJ" ]]; then
|
||||
echo "error: object not generated: $OBJ" >&2
|
||||
echo "hint: Strict mode forbids fallback. Ensure main() is lowerable under current JIT coverage." >&2
|
||||
echo "hint: Try a simpler RO example first, or expand JIT coverage for used ops." >&2
|
||||
echo "hint: Try running jit-direct manually with envs above to see details." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
52
tools/mir15_smoke.sh
Normal file
52
tools/mir15_smoke.sh
Normal file
@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# MIR15 coverage smoke for VM + JIT (direct)
|
||||
# Usage: tools/mir15_smoke.sh [debug|release]
|
||||
|
||||
MODE=${1:-release}
|
||||
BIN=./target/${MODE}/nyash
|
||||
|
||||
echo "[smoke] building nyash (${MODE}, cranelift-jit)..." >&2
|
||||
cargo build --features cranelift-jit -q ${MODE:+--${MODE}}
|
||||
|
||||
run_vm() {
|
||||
local file="$1"
|
||||
echo "[VM] $file" >&2
|
||||
NYASH_VM_STATS=1 "$BIN" --backend vm "$file" >/dev/null || {
|
||||
echo "[VM] FAILED: $file" >&2; exit 1; }
|
||||
}
|
||||
|
||||
run_jit_direct() {
|
||||
local file="$1"
|
||||
echo "[JIT-DIRECT] $file" >&2
|
||||
NYASH_JIT_EVENTS_COMPILE=1 NYASH_JIT_DUMP=1 NYASH_JIT_HOSTCALL=1 NYASH_JIT_THRESHOLD=1 \
|
||||
"$BIN" --jit-direct "$file" >/dev/null || {
|
||||
echo "[JIT] FAILED: $file" >&2; exit 1; }
|
||||
}
|
||||
|
||||
run_jit_direct_optional() {
|
||||
local file="$1"
|
||||
echo "[JIT-DIRECT] $file (optional)" >&2
|
||||
NYASH_JIT_EVENTS_COMPILE=1 NYASH_JIT_DUMP=1 NYASH_JIT_HOSTCALL=1 NYASH_JIT_THRESHOLD=1 \
|
||||
"$BIN" --jit-direct "$file" >/dev/null || {
|
||||
echo "[JIT] expected fallback: $file" >&2; return 0; }
|
||||
}
|
||||
|
||||
echo "[smoke] VM core samples" >&2
|
||||
run_vm examples/include_main.nyash # Const/Return
|
||||
run_vm examples/jit_branch_demo.nyash # Branch/Jump/Phi path (via VM)
|
||||
run_vm examples/console_demo_simple.nyash # ExternCall(env.console.log)
|
||||
|
||||
echo "[smoke] JIT-direct Core-1" >&2
|
||||
run_jit_direct examples/jit_arith.nyash # BinOp
|
||||
run_jit_direct examples/jit_compare_i64_boolret.nyash # Compare/bool ret
|
||||
run_jit_direct examples/jit_direct_local_store_load.nyash # Load/Store (local slots)
|
||||
run_jit_direct examples/jit_branch_demo.nyash # Branch/Jump/PHI(min)
|
||||
|
||||
echo "[smoke] JIT-direct hostcalls (handle-based)" >&2
|
||||
run_jit_direct_optional examples/jit_array_is_empty.nyash # any.isEmpty (optional)
|
||||
run_jit_direct_optional examples/jit_hostcall_array_append.nyash # array.push (optional)
|
||||
run_jit_direct_optional examples/jit_map_get_param_hh.nyash # map.get (optional)
|
||||
|
||||
echo "[smoke] OK" >&2
|
||||
Reference in New Issue
Block a user