archive: Move JIT/Cranelift to archive during Phase 15 focus

Phase 15 requires concentrated development on PyVM and LLVM backends only.
JIT/Cranelift was causing build confusion and distracting AI developers.

## Archived Components
- src/jit/ → archive/jit-cranelift/src/jit/
- src/backend/cranelift/ → archive/jit-cranelift/src/backend/cranelift/
- JIT Box modules → archive/jit-cranelift/src/boxes/
- JIT scripts → archive/jit-cranelift/scripts/, tools/
- clif_adapter.rs → archive/jit-cranelift/src/semantics/

## Build Changes
- Cargo.toml: Comment out cranelift-jit feature and dependencies
- src/lib.rs: Disable JIT module declaration
- src/boxes/mod.rs: Disable JIT Box module declarations
- src/semantics/mod.rs: Disable clif_adapter module
- debug_box.rs: Replace JIT calls with archive stubs

## Documentation
- archive/jit-cranelift/ARCHIVE_NOTES.md: Complete restoration guide
- Reason: Phase 15 selfhosting focus (80k→20k line reduction)
- Restoration: Full procedure documented for future revival

This eliminates build errors and AI developer confusion, enabling
focused Phase 15 development on PyVM/LLVM backends only.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Selfhosting Dev
2025-09-23 02:15:27 +09:00
parent 0d443dd6fa
commit a60d840b47
59 changed files with 145 additions and 27 deletions

View File

@ -42,14 +42,14 @@ llvm-harness = []
llvm-inkwell-legacy = ["dep:inkwell"] llvm-inkwell-legacy = ["dep:inkwell"]
llvm = ["llvm-harness"] llvm = ["llvm-harness"]
# (removed) Optional modular MIR builder feature # (removed) Optional modular MIR builder feature
cranelift-jit = [ # cranelift-jit = [ # ARCHIVED: Moved to archive/jit-cranelift/ during Phase 15
"dep:cranelift-codegen", # "dep:cranelift-codegen",
"dep:cranelift-frontend", # "dep:cranelift-frontend",
"dep:cranelift-module", # "dep:cranelift-module",
"dep:cranelift-jit", # "dep:cranelift-jit",
"dep:cranelift-object", # "dep:cranelift-object",
"dep:cranelift-native" # "dep:cranelift-native"
] # ]
aot-plan-import = [] aot-plan-import = []
[lib] [lib]
@ -157,13 +157,13 @@ wasm-bindgen = "0.2"
console_error_panic_hook = "0.1" console_error_panic_hook = "0.1"
js-sys = "0.3" js-sys = "0.3"
# Cranelift JIT (optional; enabled via feature "cranelift-jit") # Cranelift JIT (ARCHIVED: moved to archive/jit-cranelift/ during Phase 15)
cranelift-codegen = { version = "0.103", optional = true } # cranelift-codegen = { version = "0.103", optional = true }
cranelift-frontend = { version = "0.103", optional = true } # cranelift-frontend = { version = "0.103", optional = true }
cranelift-module = { version = "0.103", optional = true } # cranelift-module = { version = "0.103", optional = true }
cranelift-jit = { version = "0.103", optional = true } # cranelift-jit = { version = "0.103", optional = true }
cranelift-object = { version = "0.103", optional = true } # cranelift-object = { version = "0.103", optional = true }
cranelift-native = { version = "0.103", optional = true } # cranelift-native = { version = "0.103", optional = true }
# WASM backend dependencies (Phase 8) - optional for faster builds # WASM backend dependencies (Phase 8) - optional for faster builds
wabt = { version = "0.10", optional = true } wabt = { version = "0.10", optional = true }

View File

@ -0,0 +1,96 @@
# JIT/Cranelift アーカイブ - Phase 15
## 📅 アーカイブ日時
2025-09-23 - Phase 15 セルフホスティング集中開発期間中
## 🎯 アーカイブ理由
### 現在の開発焦点
- **Phase 15**: Nyashセルフホスティング80k→20k行革命
- **開発対象**: PyVMとLLVMバックエンドのみ
- **JIT/Cranelift**: 現在未使用、ビルドエラーや混乱の原因
### 具体的な問題
1. **ビルドエラー**: `cranelift-jit` フィーチャーでのビルド失敗
2. **AI開発者の混乱**: JSON開発Claude Codeが誤ってJITルートを参照
3. **リソース分散**: メンテナンスコストが高い
4. **Phase 15集中**: PyVM/LLVM開発に集中したい
## 📂 アーカイブ内容
### 移動されたディレクトリ・ファイル
```
archive/jit-cranelift/
├── src/
│ ├── jit/ # JIT実装コアABI、エンジン、ローワリング等
│ └── backend/cranelift/ # Craneliftバックエンド実装
├── scripts/
│ └── build_jit.sh # JITビルドスクリプト
└── tools/
├── jit_compare_smoke.sh # JIT比較スモークテスト
└── smokes/
├── jit_smoke.sh # JITスモークテスト
└── smoke_vm_jit.sh # VM-JIT比較テスト
```
### Cargo.toml変更
- `cranelift-jit` フィーチャーをコメントアウト
- JIT関連の依存関係を無効化
## 🔄 復活手順(将来用)
### 1. ファイル復元
```bash
# アーカイブから復元
mv archive/jit-cranelift/src/jit src/
mv archive/jit-cranelift/src/backend/cranelift src/backend/
mv archive/jit-cranelift/scripts/build_jit.sh .
mv archive/jit-cranelift/tools/* tools/
```
### 2. Cargo.toml復元
```toml
[features]
cranelift-jit = ["dep:cranelift", "dep:cranelift-jit", "dep:cranelift-module"]
[dependencies]
cranelift = { version = "0.103", optional = true }
cranelift-jit = { version = "0.103", optional = true }
cranelift-module = { version = "0.103", optional = true }
```
### 3. ビルド確認
```bash
# JITビルドテスト
cargo build --release --features cranelift-jit
# スモークテスト実行
./tools/jit_smoke.sh
```
### 4. 統合テスト
- PyVM vs JIT性能比較
- LLVM vs JIT出力比較
- 全バックエンド統合テスト
## 💡 設計ノート
### JIT実装の特徴
- **Cranelift統合**: Wasmtime/Craneliftエコシステム活用
- **ホストコール最適化**: Rustネイティブ関数との高速ブリッジ
- **メモリ管理**: GCとJITの協調動作
- **デバッグ支援**: JIT統計・トレース機能
### 将来的な価値
- **高速実行**: 本格運用時の性能向上
- **AOTコンパイル**: ネイティブバイナリ生成
- **WebAssembly統合**: WASM実行環境との統一
## 📋 関連Issue・PR
- JIT/Craneliftビルドエラー修正が必要
- AIエージェント向けドキュメント整備
- Phase 15完了後の復活検討
---
**Note**: このアーカイブは一時的な措置です。Phase 15完了後、JIT/Craneliftの復活と最新化を検討します。

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Archived: JIT smoke (not maintained in current phase). Kept for reference.
set -euo pipefail
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
ROOT_DIR=$(CDPATH= cd -- "$SCRIPT_DIR/../../" && pwd)
BIN="$ROOT_DIR/target/release/nyash"
if [ ! -x "$BIN" ]; then
echo "Building nyash (release, JIT)..." >&2
cargo build --release --features cranelift-jit >/dev/null
fi
echo "[JIT Smoke] Core VM/JIT (plugins disabled)" >&2
NYASH_DISABLE_PLUGINS=1 NYASH_CLI_VERBOSE=1 "$ROOT_DIR/tools/smokes/archive/smoke_vm_jit.sh" >/tmp/nyash-jit-core.out
grep -q '^✅ smoke done' /tmp/nyash-jit-core.out || { echo "FAIL: core VM/JIT smoke" >&2; cat /tmp/nyash-jit-core.out; exit 1; }
echo "PASS: core VM/JIT smoke" >&2
echo "All PASS (archived JIT smoke)" >&2

View File

@ -328,17 +328,18 @@ impl DebugBox {
// --- Phase 1: JIT/Plugin shim tracing --- // --- Phase 1: JIT/Plugin shim tracing ---
pub fn trace_plugin_calls(&self, on: bool) -> Result<Box<dyn NyashBox>, RuntimeError> { pub fn trace_plugin_calls(&self, on: bool) -> Result<Box<dyn NyashBox>, RuntimeError> {
crate::jit::shim_trace::set_enabled(on); // ARCHIVED: JIT functionality moved to archive/jit-cranelift/
println!( println!(
"[DEBUG] JIT shim trace: {}", "[DEBUG] JIT shim trace: {} (JIT ARCHIVED - no-op)",
if on { "ENABLED" } else { "DISABLED" } if on { "ENABLED" } else { "DISABLED" }
); );
Ok(Box::new(VoidBox::new())) Ok(Box::new(VoidBox::new()))
} }
pub fn get_jit_events(&self) -> Result<Box<dyn NyashBox>, RuntimeError> { pub fn get_jit_events(&self) -> Result<Box<dyn NyashBox>, RuntimeError> {
let s = crate::jit::shim_trace::snapshot_joined(); // ARCHIVED: JIT functionality moved to archive/jit-cranelift/
Ok(Box::new(StringBox::new(s))) let s = "[JIT ARCHIVED] No JIT events available - JIT moved to archive/jit-cranelift/";
Ok(Box::new(StringBox::new(s.to_string())))
} }
} }

View File

@ -73,12 +73,13 @@ pub mod console_box;
pub mod debug_config_box; pub mod debug_config_box;
pub mod function_box; pub mod function_box;
pub mod gc_config_box; pub mod gc_config_box;
pub mod jit_config_box; // ARCHIVED: JIT Box modules moved to archive/jit-cranelift/ during Phase 15
pub mod jit_events_box; // pub mod jit_config_box;
pub mod jit_hostcall_registry_box; // pub mod jit_events_box;
pub mod jit_policy_box; // pub mod jit_hostcall_registry_box;
pub mod jit_stats_box; // pub mod jit_policy_box;
pub mod jit_strict_box; // pub mod jit_stats_box;
// pub mod jit_strict_box;
pub mod map_box; pub mod map_box;
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
pub mod qr_box; pub mod qr_box;

View File

@ -48,7 +48,7 @@ pub mod mir_aot_plan_import {
// Backends // Backends
pub mod backend; pub mod backend;
pub mod jit; // Cranelift JIT subsystem (skeleton) // pub mod jit; // ARCHIVED: Cranelift JIT subsystem moved to archive/jit-cranelift/
pub mod semantics; // Unified semantics trait for MIR evaluation/lowering pub mod semantics; // Unified semantics trait for MIR evaluation/lowering
pub mod benchmarks; pub mod benchmarks;

View File

@ -84,5 +84,5 @@ pub trait SemanticsExt: Semantics {
impl<T: Semantics> SemanticsExt for T {} impl<T: Semantics> SemanticsExt for T {}
pub mod clif_adapter; // pub mod clif_adapter; // ARCHIVED: moved to archive/jit-cranelift/
pub mod vm_impl; pub mod vm_impl;