feat(phase73): Selfhost Stage-B I/O 簡素化 - HAKO_SRC 環境変数統一化
Unified selfhost Stage-B I/O path from argv to environment variables: - Remove --source "$SRC_CONTENT" from compiler.hako invocation (argv limit) - Export HAKO_SRC="$SRC_CONTENT" instead (env-based I/O) - Update compiler_stageb.hako to check HAKO_SRC fallback Changes: 1. lang/src/compiler/entry/compiler_stageb.hako: - Added HAKO_SRC env check in StageBArgsBox.resolve_src() - Fallback order: --source arg → HAKO_SOURCE_FILE_CONTENT → HAKO_SRC → default 2. tools/selfhost/selfhost_build.sh: - Removed --source "$SRC_CONTENT" from compiler.hako invocation - Export HAKO_SRC="$SRC_CONTENT" before Stage-B execution - Unified with wrapper pathway (HAKO_USE_BUILDBOX=1) Benefits: - Eliminates "Argument list too long" (os error 7) for large .hako files - Single unified I/O pattern (env variables) for all Stage-B paths - Consistent with hako_check.sh and wrapper pattern - Ready for future HAKO_SRC_FILE optimization Verification: ✅ NYASH_FEATURES=stage3 NYASH_USE_NY_COMPILER=1 \ ./tools/selfhost/selfhost_build.sh --in apps/tests/stage1_run_min.hako --run Output: abc (correct) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -65,8 +65,11 @@ static box StageBArgsBox {
|
||||
local inline = env.get("HAKO_SOURCE_FILE_CONTENT")
|
||||
if inline != null { src = "" + inline }
|
||||
}
|
||||
// Skip env.local.get check - Stage-3 keyword conflict
|
||||
// Original: if src == null { src = env.local.get("HAKO_SOURCE") }
|
||||
// Phase 73: Fallback to HAKO_SRC env variable (unified I/O path)
|
||||
// This eliminates the need for large argv strings (solves "Argument list too long")
|
||||
if src == null {
|
||||
src = env.get("HAKO_SRC")
|
||||
}
|
||||
if src == null { src = "return 0" }
|
||||
|
||||
{
|
||||
|
||||
@ -93,10 +93,11 @@ else
|
||||
apply_selfhost_env
|
||||
stageb_cmd_desc="compiler.hako --stage-b --stage3"
|
||||
(
|
||||
export HAKO_SRC="$SRC_CONTENT"
|
||||
cd "$ROOT" && \
|
||||
"$BIN" --backend vm \
|
||||
"$ROOT/lang/src/compiler/entry/compiler.hako" -- \
|
||||
--stage-b --stage3 --source "$SRC_CONTENT"
|
||||
--stage-b --stage3
|
||||
) > "$RAW" 2>&1 || stageb_rc=$?
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user