2025-08-17 22:44:16 +09:00
|
|
|
|
//! Nyashランタイムモジュール
|
2025-09-17 07:43:07 +09:00
|
|
|
|
//!
|
2025-08-17 22:44:16 +09:00
|
|
|
|
//! プラグインシステムとBox管理の中核
|
|
|
|
|
|
|
|
|
|
|
|
pub mod box_registry;
|
feat(runtime): Phase 87 CoreBoxId/CoreMethodId 箱化完了
ハードコード文字列から型安全な enum への箱化により、
Box名・メソッド名管理を完全にコンパイル時検証可能に。
主な実装:
- CoreBoxId enum 定義(19個)
- core_required: 6個(String, Integer, Bool, Array, Map, Console)
- core_optional: 9個(Float, Null, File, Path, Regex, Math, Time, Json, Toml)
- 特殊型: 4個(Function, Result, Method, Missing)
- CoreMethodId enum 定義(30個)
- 各 Box のメソッドを型安全に管理
- 引数数、戻り値型情報を統合
- is_reserved_type() を CoreBoxId ベースにリファクタリング
- infer_boxcall_return_type() を CoreMethodId ベースに改良(75行 → 25行、67%削減)
検証結果:
- テスト: ✅ 11/11 passed(新規追加)
- ビルド: ✅ 成功(0エラー)
- 型安全性: ✅ タイポ不可能
効果:
- SSOT 確立(src/runtime/core_box_ids.rs に一元化)
- コンパイル時検証(実行時エラー → コンパイルエラー)
- 保守性向上(変更箇所の一元化)
- IDE 支援(enum 補完可能)
ドキュメント:
- core_boxes_design.md 作成(Phase 87 完全仕様)
- Phase 85 README 更新(Phase 87 セクション追加)
Phase 15.5「Everything is Plugin」アーキテクチャ基盤完成
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 22:22:32 +09:00
|
|
|
|
pub mod core_box_ids; // Phase 87: CoreBoxId/CoreMethodId 型安全enum
|
2025-11-21 06:25:17 +09:00
|
|
|
|
pub mod deprecations;
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub mod gc;
|
feat(phase88): Ring0Context Skeleton implementation
Phase 88: OS API abstraction layer implementation
**Implementation**:
- Ring0Context module added (4 files)
- mod.rs: Public API, global initialization (OnceLock)
- traits.rs: MemApi, IoApi, TimeApi, LogApi trait definitions
- std_impls.rs: std-based default implementations
- errors.rs: IoError, TimeError type definitions
**Design Principles**:
- Ring0 knows nothing about Box
- Ring0 knows nothing about Nyash
- Pure OS API abstraction
**Global Initialization**:
- NyashRunner::new() initializes Ring0Context globally
- OnceLock ensures safe initialization (idempotent)
**Migration (2 paths)**:
- src/runner/selfhost.rs:27: eprintln! → ring0.log.error() (OOB strict)
- src/runner/selfhost.rs:177: eprintln! → ring0.log.error() (PyVM error)
**Tests**:
- 4 unit tests added (ring0 module)
- All tests passed
- Build successful (0 errors)
**Migration Status**:
- Migrated: 2/3,955 (0.05%)
- Remaining: 3,953 paths (Phase 89+)
**Files Changed**:
- src/runtime/ring0/mod.rs (new, 100 lines)
- src/runtime/ring0/traits.rs (new, 93 lines)
- src/runtime/ring0/std_impls.rs (new, 77 lines)
- src/runtime/ring0/errors.rs (new, 26 lines)
- src/runtime/mod.rs (Ring0Context export)
- src/runner/mod.rs (global initialization)
- src/runner/selfhost.rs (2 paths migrated)
- docs/development/current/main/ring0-inventory.md (Phase 88 status)
Phase 88 complete. Ready for Phase 89 (gradual migration).
🐱✨
2025-12-02 22:38:27 +09:00
|
|
|
|
pub mod ring0; // Phase 88: Ring0Context - OS API 抽象化レイヤー
|
2025-09-17 20:33:19 +09:00
|
|
|
|
pub mod gc_controller;
|
|
|
|
|
|
pub mod gc_mode;
|
|
|
|
|
|
pub mod gc_trace;
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub mod global_hooks;
|
2025-08-22 05:01:11 +09:00
|
|
|
|
pub mod leak_tracker;
|
2025-08-20 18:57:10 +09:00
|
|
|
|
pub mod nyash_runtime;
|
2025-11-21 06:25:17 +09:00
|
|
|
|
pub mod observe; // Lightweight observability flags (OOB etc.)
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub mod plugin_config;
|
|
|
|
|
|
pub mod plugin_ffi_common;
|
|
|
|
|
|
pub mod plugin_loader_unified;
|
|
|
|
|
|
pub mod plugin_loader_v2;
|
2025-09-26 00:27:02 +09:00
|
|
|
|
pub mod provider_lock;
|
|
|
|
|
|
pub mod provider_verify;
|
2025-11-21 06:25:17 +09:00
|
|
|
|
pub mod scheduler;
|
|
|
|
|
|
pub mod semantics;
|
|
|
|
|
|
pub mod unified_registry; // Deprecation warnings with warn-once guards
|
|
|
|
|
|
// pub mod plugin_box; // legacy - 古いPluginBox
|
|
|
|
|
|
// pub mod plugin_loader; // legacy - Host VTable使用
|
2025-09-03 05:56:57 +09:00
|
|
|
|
pub mod extern_registry; // ExternCall (env.*) 登録・診断用レジストリ
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub mod host_api; // C ABI: plugins -> host 逆呼び出しAPI(TLSでVMに橋渡し)
|
|
|
|
|
|
pub mod host_handles; // C ABI(TLV) 向け HostHandle レジストリ(ユーザー/内蔵Box受け渡し)
|
|
|
|
|
|
pub mod modules_registry;
|
|
|
|
|
|
pub mod type_box_abi; // Phase 12: Nyash ABI (vtable) 雛形
|
|
|
|
|
|
pub mod type_meta;
|
|
|
|
|
|
pub mod type_registry; // Phase 12: TypeId→TypeBox 解決(雛形) // env.modules minimal registry
|
2025-08-17 22:52:17 +09:00
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
|
mod tests;
|
2025-08-17 22:44:16 +09:00
|
|
|
|
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub use box_registry::{get_global_registry, BoxFactoryRegistry, BoxProvider};
|
feat(runtime): Phase 87 CoreBoxId/CoreMethodId 箱化完了
ハードコード文字列から型安全な enum への箱化により、
Box名・メソッド名管理を完全にコンパイル時検証可能に。
主な実装:
- CoreBoxId enum 定義(19個)
- core_required: 6個(String, Integer, Bool, Array, Map, Console)
- core_optional: 9個(Float, Null, File, Path, Regex, Math, Time, Json, Toml)
- 特殊型: 4個(Function, Result, Method, Missing)
- CoreMethodId enum 定義(30個)
- 各 Box のメソッドを型安全に管理
- 引数数、戻り値型情報を統合
- is_reserved_type() を CoreBoxId ベースにリファクタリング
- infer_boxcall_return_type() を CoreMethodId ベースに改良(75行 → 25行、67%削減)
検証結果:
- テスト: ✅ 11/11 passed(新規追加)
- ビルド: ✅ 成功(0エラー)
- 型安全性: ✅ タイポ不可能
効果:
- SSOT 確立(src/runtime/core_box_ids.rs に一元化)
- コンパイル時検証(実行時エラー → コンパイルエラー)
- 保守性向上(変更箇所の一元化)
- IDE 支援(enum 補完可能)
ドキュメント:
- core_boxes_design.md 作成(Phase 87 完全仕様)
- Phase 85 README 更新(Phase 87 セクション追加)
Phase 15.5「Everything is Plugin」アーキテクチャ基盤完成
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 22:22:32 +09:00
|
|
|
|
pub use core_box_ids::{CoreBoxCategory, CoreBoxId, CoreMethodId}; // Phase 87: 型安全enum
|
2025-08-17 22:44:16 +09:00
|
|
|
|
pub use plugin_config::PluginConfig;
|
feat(phase88): Ring0Context Skeleton implementation
Phase 88: OS API abstraction layer implementation
**Implementation**:
- Ring0Context module added (4 files)
- mod.rs: Public API, global initialization (OnceLock)
- traits.rs: MemApi, IoApi, TimeApi, LogApi trait definitions
- std_impls.rs: std-based default implementations
- errors.rs: IoError, TimeError type definitions
**Design Principles**:
- Ring0 knows nothing about Box
- Ring0 knows nothing about Nyash
- Pure OS API abstraction
**Global Initialization**:
- NyashRunner::new() initializes Ring0Context globally
- OnceLock ensures safe initialization (idempotent)
**Migration (2 paths)**:
- src/runner/selfhost.rs:27: eprintln! → ring0.log.error() (OOB strict)
- src/runner/selfhost.rs:177: eprintln! → ring0.log.error() (PyVM error)
**Tests**:
- 4 unit tests added (ring0 module)
- All tests passed
- Build successful (0 errors)
**Migration Status**:
- Migrated: 2/3,955 (0.05%)
- Remaining: 3,953 paths (Phase 89+)
**Files Changed**:
- src/runtime/ring0/mod.rs (new, 100 lines)
- src/runtime/ring0/traits.rs (new, 93 lines)
- src/runtime/ring0/std_impls.rs (new, 77 lines)
- src/runtime/ring0/errors.rs (new, 26 lines)
- src/runtime/mod.rs (Ring0Context export)
- src/runner/mod.rs (global initialization)
- src/runner/selfhost.rs (2 paths migrated)
- docs/development/current/main/ring0-inventory.md (Phase 88 status)
Phase 88 complete. Ready for Phase 89 (gradual migration).
🐱✨
2025-12-02 22:38:27 +09:00
|
|
|
|
pub use ring0::{get_global_ring0, init_global_ring0, Ring0Context}; // Phase 88: Ring0 公開 API
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub use plugin_loader_unified::{
|
|
|
|
|
|
get_global_plugin_host, init_global_plugin_host, MethodHandle, PluginBoxType, PluginHost,
|
|
|
|
|
|
PluginLibraryHandle,
|
|
|
|
|
|
};
|
|
|
|
|
|
pub use plugin_loader_v2::{get_global_loader_v2, init_global_loader_v2, PluginLoaderV2};
|
2025-08-27 00:03:48 +09:00
|
|
|
|
pub mod cache_versions;
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub use gc::{BarrierKind, GcHooks};
|
2025-08-20 18:57:10 +09:00
|
|
|
|
pub use nyash_runtime::{NyashRuntime, NyashRuntimeBuilder};
|
2025-08-27 17:06:46 +09:00
|
|
|
|
pub use scheduler::{Scheduler, SingleThreadScheduler};
|
2025-09-17 07:43:07 +09:00
|
|
|
|
pub use unified_registry::{
|
|
|
|
|
|
get_global_unified_registry, init_global_unified_registry, register_user_defined_factory,
|
|
|
|
|
|
};
|
2025-08-19 05:05:21 +09:00
|
|
|
|
// pub use plugin_box::PluginBox; // legacy
|
2025-08-19 03:48:44 +09:00
|
|
|
|
// Use unified plugin loader (formerly v2)
|
2025-08-20 18:57:10 +09:00
|
|
|
|
// pub use plugin_loader::{PluginLoaderV2 as PluginLoader, get_global_loader_v2 as get_global_loader}; // legacy
|