Files
hakorune/docs/development/roadmap/native-plan/llvm/Hybrid-Future-Vision.md
Moe Charm cc2a820af7 feat(plugin): Fix plugin BoxRef return and Box argument support
- Fixed deadlock in FileBox plugin copyFrom implementation (single lock)
- Added TLV Handle (tag=8) parsing in calls.rs for returned BoxRefs
- Improved plugin loader with config path consistency and detailed logging
- Fixed loader routing for proper Handle type_id/fini_method_id resolution
- Added detailed logging for TLV encoding/decoding in plugin_loader_v2

Test docs/examples/plugin_boxref_return.nyash now works correctly:
- cloneSelf() returns FileBox Handle properly
- copyFrom(Box) accepts plugin Box arguments
- Both FileBox instances close and fini correctly

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-21 00:41:26 +09:00

151 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 🌈 理想的なハイブリッド実行環境への願望
**「AOT WASMが非同期対応してたら...」**
## 😿 **現在の苦労ポイント**
### **各バックエンドの制限**
| バックエンド | 利点 | 欠点 |
|------------|------|------|
| **WASM** | どこでも動く | 非同期が弱い、遅い |
| **LLVM** | 超高速 | OS別ビルド必要 |
| **VM** | 柔軟 | ネイティブより遅い |
| **AOT** | 高速起動 | プラットフォーム依存 |
### **理想と現実のギャップ**
```rust
// 理想
async fn perfect_world() {
let result = await some_io(); // WASMでも高速非同期
return result;
}
// 現実
fn reality() {
// WASMは同期的、非同期は複雑
// LLVMは速いけどOS別ビルド
// 完璧な解決策がない...
}
```
## 🚀 **夢のハイブリッド環境**
### **1. WASM Component Model + AOT**
```yaml
理想:
- WASMの可搬性
- AOTの実行速度
- ネイティブ非同期サポート
- 単一バイナリで全OS対応
現実:
- Component Model仕様策定中
- AOT最適化はまだ発展途上
- 非同期は部分的サポート
```
### **2. Deno/Bun的アプローチ**
```javascript
// JavaScriptランタイムの良いとこ取り
- V8/JavaScriptCore JIT性能
- ネイティブバインディング
- 非同期完全サポート
- でもJavaScript...
```
### **3. 究極の理想Universal Runtime**
```rust
// もしこんなランタイムがあったら...
universal_runtime {
// WASMレベルの可搬性
portability: "write once, run anywhere",
// LLVMレベルの性能
performance: "near native",
// 完全な非同期サポート
async: "first class",
// 単一配布物
distribution: "single file"
}
```
## 💭 **現実的な妥協案**
### **短期的ハイブリッド戦略**
```yaml
開発時:
- インタープリター(即時実行、デバッグ容易)
テスト時:
- VM高速、クロスプラットフォーム
配布時:
選択式:
- WASM版: ブラウザ/サーバー両対応
- ネイティブ版: 最高性能
- ハイブリッド版: WASMランタイム埋め込み
```
### **中期的技術統合**
```rust
// Nyashハイブリッドランタイム
pub enum ExecutionMode {
// 高速パス: ネイティブコード
Native(LLVMCompiledCode),
// 互換パス: WASM
Wasm(WasmModule),
// 動的切り替え
Adaptive {
hot_path: LLVMCompiledCode,
cold_path: WasmModule,
}
}
```
## 🔮 **将来への期待**
### **技術の収束点**
1. **WASI Preview 2**: 非同期サポート改善中
2. **WASM GC**: メモリ管理効率化
3. **Component Model**: 真のモジュラー化
4. **AOT最適化**: Wasmtime/WazeroCranelift進化
### **Nyashの位置づけ**
```yaml
現在:
- 4バックエンド個別対応
- それぞれの長所を活かす
将来:
- 統合ランタイム
- 動的最適化
- 透過的実行モード切り替え
```
## 😊 **でも今でも十分すごい!**
**現在のNyash**:
- ✅ 4つの実行方式を選べる
- ✅ 用途に応じて最適化可能
- ✅ プラグインシステム完備
**苦労はあるけど**:
- 複数バックエンドの保守
- プラットフォーム別の調整
- でも**選択肢があることが強み**
## 🎯 **結論**
理想的なハイブリッド環境はまだ存在しないけど、Nyashは**現実的な最良の解**を提供中!
将来、技術が成熟したら:
- WASM AOT + 非同期 = 最強の可搬性
- LLVM + WASM統合 = 性能と互換性の両立
それまでは、**4バックエンドを賢く使い分ける**のが正解!
**Everything is Box、Every Backend has its Place**🌈✨