chore: Phase 25.1 完了 - LoopForm v2/Stage1 CLI/環境変数削減 + Phase 26-D からの変更
Phase 25.1 完了成果: - ✅ LoopForm v2 テスト・ドキュメント・コメント完備 - 4ケース(A/B/C/D)完全テストカバレッジ - 最小再現ケース作成(SSAバグ調査用) - SSOT文書作成(loopform_ssot.md) - 全ソースに [LoopForm] コメントタグ追加 - ✅ Stage-1 CLI デバッグ環境構築 - stage1_cli.hako 実装 - stage1_bridge.rs ブリッジ実装 - デバッグツール作成(stage1_debug.sh/stage1_minimal.sh) - アーキテクチャ改善提案文書 - ✅ 環境変数削減計画策定 - 25変数の完全調査・分類 - 6段階削減ロードマップ(25→5、80%削減) - 即時削除可能変数特定(NYASH_CONFIG/NYASH_DEBUG) Phase 26-D からの累積変更: - PHI実装改善(ExitPhiBuilder/HeaderPhiBuilder等) - MIRビルダーリファクタリング - 型伝播・最適化パス改善 - その他約300ファイルの累積変更 🎯 技術的成果: - SSAバグ根本原因特定(条件分岐内loop変数変更) - Region+next_iパターン適用完了(UsingCollectorBox等) - LoopFormパターン文書化・テスト化完了 - セルフホスティング基盤強化 Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: ChatGPT <noreply@openai.com> Co-Authored-By: Task Assistant <task@anthropic.com>
This commit is contained in:
@ -45,9 +45,14 @@ impl NyashRunner {
|
||||
std::process::exit(1);
|
||||
}
|
||||
if use_ast && !paths.is_empty() {
|
||||
match crate::runner::modes::common_util::resolve::parse_preludes_to_asts(self, &paths) {
|
||||
match crate::runner::modes::common_util::resolve::parse_preludes_to_asts(
|
||||
self, &paths,
|
||||
) {
|
||||
Ok(v) => prelude_asts = v,
|
||||
Err(e) => { eprintln!("❌ {}", e); std::process::exit(1); }
|
||||
Err(e) => {
|
||||
eprintln!("❌ {}", e);
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -58,16 +63,22 @@ impl NyashRunner {
|
||||
}
|
||||
}
|
||||
// Pre-expand '@name[:T] = expr' sugar at line-head (same as common path)
|
||||
let preexpanded_owned = crate::runner::modes::common_util::resolve::preexpand_at_local(code_ref);
|
||||
let preexpanded_owned =
|
||||
crate::runner::modes::common_util::resolve::preexpand_at_local(code_ref);
|
||||
code_ref = &preexpanded_owned;
|
||||
|
||||
// Parse to AST (main)
|
||||
let main_ast = match NyashParser::parse_from_string(code_ref) {
|
||||
Ok(ast) => ast,
|
||||
Err(e) => {
|
||||
eprintln!("❌ Parse error in {}: {}", filename, e);
|
||||
crate::runner::modes::common_util::diag::print_parse_error_with_context(
|
||||
filename,
|
||||
code_ref,
|
||||
&e,
|
||||
);
|
||||
// Enhanced context: list merged prelude files if any (from text-merge path)
|
||||
let preludes = crate::runner::modes::common_util::resolve::clone_last_merged_preludes();
|
||||
let preludes =
|
||||
crate::runner::modes::common_util::resolve::clone_last_merged_preludes();
|
||||
if !preludes.is_empty() {
|
||||
eprintln!("[parse/context] merged prelude files ({}):", preludes.len());
|
||||
let show = std::cmp::min(16, preludes.len());
|
||||
@ -83,8 +94,13 @@ impl NyashRunner {
|
||||
};
|
||||
// Merge preludes + main when enabled
|
||||
let ast = if use_ast && !prelude_asts.is_empty() {
|
||||
crate::runner::modes::common_util::resolve::merge_prelude_asts_with_main(prelude_asts, &main_ast)
|
||||
} else { main_ast };
|
||||
crate::runner::modes::common_util::resolve::merge_prelude_asts_with_main(
|
||||
prelude_asts,
|
||||
&main_ast,
|
||||
)
|
||||
} else {
|
||||
main_ast
|
||||
};
|
||||
// Macro expansion (env-gated) after merge
|
||||
let ast = crate::r#macro::maybe_expand_and_dump(&ast, false);
|
||||
let ast = crate::runner::modes::macro_child::normalize_core_pass(&ast);
|
||||
@ -106,13 +122,20 @@ impl NyashRunner {
|
||||
#[allow(unused_mut)]
|
||||
let mut module = compile_result.module.clone();
|
||||
let injected = inject_method_ids(&mut module);
|
||||
if injected > 0 { crate::cli_v!("[LLVM] method_id injected: {} places", injected); }
|
||||
if injected > 0 {
|
||||
crate::cli_v!("[LLVM] method_id injected: {} places", injected);
|
||||
}
|
||||
|
||||
// Dev/Test helper: allow executing via PyVM harness when requested
|
||||
if std::env::var("SMOKES_USE_PYVM").ok().as_deref() == Some("1") {
|
||||
match super::common_util::pyvm::run_pyvm_harness_lib(&module, "llvm-ast") {
|
||||
Ok(code) => { std::process::exit(code); }
|
||||
Err(e) => { eprintln!("❌ PyVM harness error: {}", e); std::process::exit(1); }
|
||||
Ok(code) => {
|
||||
std::process::exit(code);
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("❌ PyVM harness error: {}", e);
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,7 +145,9 @@ impl NyashRunner {
|
||||
{
|
||||
// Harness path (optional): if NYASH_LLVM_USE_HARNESS=1, try Python/llvmlite first.
|
||||
if crate::config::env::llvm_use_harness() {
|
||||
if let Err(e) = crate::runner::modes::common_util::exec::llvmlite_emit_object(&module, &_out_path, 20_000) {
|
||||
if let Err(e) = crate::runner::modes::common_util::exec::llvmlite_emit_object(
|
||||
&module, &_out_path, 20_000,
|
||||
) {
|
||||
eprintln!("❌ {}", e);
|
||||
process::exit(1);
|
||||
}
|
||||
@ -207,10 +232,16 @@ impl NyashRunner {
|
||||
libs.as_deref(),
|
||||
) {
|
||||
Ok(()) => {
|
||||
match crate::runner::modes::common_util::exec::run_executable(exe_out, &[], 20_000) {
|
||||
match crate::runner::modes::common_util::exec::run_executable(
|
||||
exe_out,
|
||||
&[],
|
||||
20_000,
|
||||
) {
|
||||
Ok((code, _timed_out, stdout_text)) => {
|
||||
// Forward program stdout so parity tests can compare outputs
|
||||
if !stdout_text.is_empty() { print!("{}", stdout_text); }
|
||||
if !stdout_text.is_empty() {
|
||||
print!("{}", stdout_text);
|
||||
}
|
||||
println!("✅ LLVM (harness) execution completed (exit={})", code);
|
||||
std::process::exit(code);
|
||||
}
|
||||
@ -222,7 +253,9 @@ impl NyashRunner {
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("❌ ny-llvmc emit-exe error: {}", e);
|
||||
eprintln!(" Hint: build ny-llvmc: cargo build -p nyash-llvm-compiler --release");
|
||||
eprintln!(
|
||||
" Hint: build ny-llvmc: cargo build -p nyash-llvm-compiler --release"
|
||||
);
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user