feat(mir): Phase 25.1f完了 - Conservative PHI + ControlForm観測レイヤー
🎉 Conservative PHI Box理論による完全SSA構築 **Phase 7-B: Conservative PHI実装** - 片方branchのみ定義変数に対応(emit_void使用) - 全変数にPHI生成(Conservative Box理論) - Stage-1 resolver全テスト緑化(3/3 PASS) **Phase 25.1f: ControlForm観測レイヤー** - LoopShape/IfShape/ControlForm構造定義 - Loop/If統一インターフェース実装 - debug_dump/debug_validate機能追加 - NYASH_CONTROL_FORM_TRACE環境変数対応 **主な変更**: - src/mir/builder/phi.rs: Conservative PHI実装 - src/mir/control_form.rs: ControlForm構造(NEW) - src/mir/loop_builder.rs: LoopForm v2デフォルト化 **テスト結果**: ✅ mir_stage1_using_resolver_min_fragment_verifies ✅ mir_stage1_using_resolver_full_collect_entries_verifies ✅ mir_parserbox_parse_program2_harness_parses_minimal_source 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: ChatGPT <chatgpt@openai.com>
This commit is contained in:
@ -22,7 +22,7 @@ pub fn gather_required_providers() -> Vec<String> {
|
||||
return v;
|
||||
}
|
||||
// Default conservative set
|
||||
let mut v = vec![
|
||||
let v = vec![
|
||||
"FileBox".to_string(),
|
||||
"ConsoleBox".to_string(),
|
||||
"ArrayBox".to_string(),
|
||||
@ -86,4 +86,3 @@ pub fn check_and_report(strict: bool, quiet_pipe: bool, label: &str) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ impl<'a> PreludeManagerBox<'a> {
|
||||
fn build_text_merged(
|
||||
&self,
|
||||
source: &str,
|
||||
filename: &str,
|
||||
_filename: &str,
|
||||
prelude_paths: &[String],
|
||||
trace: bool,
|
||||
) -> Result<String, String> {
|
||||
@ -123,7 +123,7 @@ impl<'a> PreludeManagerBox<'a> {
|
||||
.map_err(|e| format!("using: failed to read '{}': {}", path, e))?;
|
||||
|
||||
// using行を除去して正規化
|
||||
let using_resolver = UsingResolutionBox::new(&self.runner, path)?;
|
||||
let _using_resolver = UsingResolutionBox::new(&self.runner, path)?;
|
||||
let (cleaned_raw, _nested) = self.collect_using_and_strip_internal(&content, path)?;
|
||||
let cleaned = self.normalize_text_for_inline(&cleaned_raw);
|
||||
|
||||
|
||||
@ -129,7 +129,7 @@ impl<'a> SelfhostPipelineBox<'a> {
|
||||
&self,
|
||||
error: &str,
|
||||
original_code: &str,
|
||||
filename: &str,
|
||||
_filename: &str,
|
||||
) -> CompilationResult {
|
||||
eprintln!("[selfhost-pipeline] ⚠️ Error: {}", error);
|
||||
eprintln!("[selfhost-pipeline] 🔄 Falling back to original code");
|
||||
@ -179,8 +179,8 @@ impl<'a> SelfhostPipelineBox<'a> {
|
||||
/// 📊 パフォーマンスプロファイリングするにゃ!
|
||||
pub fn profile_pipeline(
|
||||
&mut self,
|
||||
code: &str,
|
||||
filename: &str,
|
||||
_code: &str,
|
||||
_filename: &str,
|
||||
) -> Result<String, String> {
|
||||
// プロファイル機能を実装(別途)
|
||||
// TODO: プロファイル機能を追加
|
||||
|
||||
@ -448,7 +448,7 @@ pub fn resolve_prelude_paths_profiled(
|
||||
// must be discovered so that their definitions are present at runtime
|
||||
// (e.g., runner_min -> lower_* boxes). Previously this only ran when
|
||||
// NYASH_USING_AST=1, which caused unresolved calls in inline flows.
|
||||
let ast_on = crate::config::env::env_bool("NYASH_USING_AST");
|
||||
let _ast_on = crate::config::env::env_bool("NYASH_USING_AST");
|
||||
let mut out: Vec<String> = Vec::new();
|
||||
let mut seen: std::collections::HashSet<String> = std::collections::HashSet::new();
|
||||
fn normalize_path(path: &str) -> (String, String) {
|
||||
|
||||
@ -14,6 +14,7 @@ pub struct UsingResolutionBox<'a> {
|
||||
runner: &'a NyashRunner,
|
||||
config: UsingConfig,
|
||||
ctx_dir: Option<PathBuf>,
|
||||
#[allow(dead_code)]
|
||||
filename_canon: Option<PathBuf>,
|
||||
inside_pkg: bool,
|
||||
seen_paths: HashMap<String, (String, usize)>, // canon_path -> (alias/label, first_line)
|
||||
|
||||
@ -476,7 +476,7 @@ impl NyashRunner {
|
||||
|
||||
match vm.execute_module(&module_vm) {
|
||||
Ok(ret) => {
|
||||
use crate::box_trait::{NyashBox, IntegerBox, BoolBox};
|
||||
use crate::box_trait::{IntegerBox, BoolBox};
|
||||
|
||||
// Extract exit code from return value
|
||||
let exit_code = if let Some(ib) = ret.as_any().downcast_ref::<IntegerBox>() {
|
||||
|
||||
@ -321,7 +321,7 @@ impl NyashRunner {
|
||||
}
|
||||
match vm.execute_module(&module_vm) {
|
||||
Ok(ret) => {
|
||||
use crate::box_trait::{NyashBox, IntegerBox, BoolBox};
|
||||
use crate::box_trait::{IntegerBox, BoolBox};
|
||||
|
||||
// Extract exit code from return value
|
||||
let exit_code = if let Some(ib) = ret.as_any().downcast_ref::<IntegerBox>() {
|
||||
@ -346,7 +346,8 @@ impl NyashRunner {
|
||||
|
||||
impl NyashRunner {
|
||||
/// Small helper to continue fallback execution once AST is prepared
|
||||
fn execute_vm_fallback_from_ast(&self, filename: &str, ast: nyash_rust::ast::ASTNode) {
|
||||
#[allow(dead_code)]
|
||||
fn execute_vm_fallback_from_ast(&self, _filename: &str, ast: nyash_rust::ast::ASTNode) {
|
||||
use crate::{
|
||||
backend::MirInterpreter,
|
||||
box_factory::{BoxFactory, RuntimeError},
|
||||
|
||||
Reference in New Issue
Block a user