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:
@ -1,4 +1,3 @@
|
||||
use super::library;
|
||||
use super::PluginLoaderV2;
|
||||
use crate::bid::{BidError, BidResult};
|
||||
|
||||
|
||||
@ -6,8 +6,8 @@ mod specs;
|
||||
mod util;
|
||||
|
||||
use super::host_bridge::BoxInvokeFn;
|
||||
use super::types::{LoadedPluginV2, PluginBoxMetadata, PluginBoxV2, PluginHandleInner};
|
||||
use crate::bid::{BidError, BidResult};
|
||||
use super::types::{LoadedPluginV2, PluginBoxMetadata, PluginHandleInner};
|
||||
use crate::bid::BidResult;
|
||||
use crate::box_trait::NyashBox;
|
||||
use crate::config::nyash_toml_v2::{LibraryDefinition, NyashConfigV2};
|
||||
use specs::LoadedBoxSpec;
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
use super::specs;
|
||||
use super::PluginLoaderV2;
|
||||
use crate::bid::{BidError, BidResult};
|
||||
use crate::runtime::plugin_loader_v2::enabled::{errors, host_bridge, types};
|
||||
|
||||
@ -18,6 +18,7 @@ pub(crate) struct LoadedBoxSpec {
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub(crate) struct MethodSpec {
|
||||
pub(crate) method_id: u32,
|
||||
#[allow(dead_code)]
|
||||
pub(crate) returns_result: bool,
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
|
||||
use crate::bid::{BidError, BidResult};
|
||||
use crate::runtime::plugin_loader_v2::enabled::PluginLoaderV2;
|
||||
use std::collections::HashMap;
|
||||
|
||||
impl PluginLoaderV2 {
|
||||
/// Resolve a method ID for a given box type and method name
|
||||
@ -37,7 +36,7 @@ impl PluginLoaderV2 {
|
||||
// Fallback to TypeBox FFI spec
|
||||
if let Ok(map) = self.box_specs.read() {
|
||||
// Try direct lookup first
|
||||
for ((lib, bt), spec) in map.iter() {
|
||||
for ((_lib, bt), spec) in map.iter() {
|
||||
if bt == box_type {
|
||||
// Check methods map
|
||||
if let Some(ms) = spec.methods.get(method_name) {
|
||||
@ -47,7 +46,7 @@ impl PluginLoaderV2 {
|
||||
// Try resolve function
|
||||
if let Some(res_fn) = spec.resolve_fn {
|
||||
if let Ok(cstr) = std::ffi::CString::new(method_name) {
|
||||
let mid = unsafe { res_fn(cstr.as_ptr()) };
|
||||
let mid = res_fn(cstr.as_ptr());
|
||||
if mid != 0 {
|
||||
return Ok(mid);
|
||||
}
|
||||
@ -130,11 +129,13 @@ impl PluginLoaderV2 {
|
||||
}
|
||||
|
||||
/// Helper functions for method resolution
|
||||
#[allow(dead_code)]
|
||||
pub(super) fn is_special_method(method_name: &str) -> bool {
|
||||
matches!(method_name, "birth" | "fini" | "toString")
|
||||
}
|
||||
|
||||
/// Get default method IDs for special methods
|
||||
#[allow(dead_code)]
|
||||
pub(super) fn get_special_method_id(method_name: &str) -> Option<u32> {
|
||||
match method_name {
|
||||
"birth" => Some(1),
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
use crate::box_factory::builtin::BuiltinBoxFactory;
|
||||
#[cfg(feature = "plugins")]
|
||||
use crate::box_factory::plugin::PluginBoxFactory;
|
||||
use crate::box_factory::{UnifiedBoxRegistry, FactoryPolicy};
|
||||
use crate::box_factory::UnifiedBoxRegistry;
|
||||
use std::sync::{Arc, Mutex, OnceLock};
|
||||
|
||||
/// Global registry instance
|
||||
|
||||
Reference in New Issue
Block a user