phase: 20.49 COMPLETE; 20.50 Flow+String minimal reps; 20.51 selfhost v0/v1 minimal (Option A/B); hv1-inline binop/unop/copy; docs + run_all + CURRENT_TASK -> 21.0

This commit is contained in:
nyash-codex
2025-11-06 15:41:52 +09:00
parent 2dc370223d
commit 77d4fd72b3
1658 changed files with 6288 additions and 2612 deletions

View File

@ -104,7 +104,7 @@ MirInstruction::NewBox { dst, box_type, args } // Box生成
## Technical Notes
### 現在の実装基盤2025-08-14時点
- ✅ **WASM CLI**: `./target/release/nyash --compile-wasm program.nyash` で動作
- ✅ **WASM CLI**: `./target/release/nyash --compile-wasm program.hako` で動作
- ✅ **ブラウザテスト**: `wasm_demo/` ディレクトリに実行環境完備
- ✅ **Safepoint対応**: `src/backend/wasm/codegen.rs:line XX` で実装済み
- ✅ **実行ドキュメント**: `docs/reference/architecture/execution-backends.md` で使用方法詳細化

View File

@ -41,7 +41,7 @@
- **PoC3**: Weak/Barrier の下地WeakLoad は当面 Some 相当、Barrier は no-op
- **PoC4**: Future/Await の基本実装(スレッドなしの即座完了)
- **CLI 統合**
- `nyash --backend wasm program.nyash` で生成・実行wasmtime 呼び出し)
- `nyash --backend wasm program.hako` で生成・実行wasmtime 呼び出し)
- `--output program.wasm` でWASMファイル出力のみ
## Implementation Plan
@ -129,8 +129,8 @@
-**Future Operations**: FutureNew/Await が即座完了として動作
### CLI Integration
-**Command Line**: `nyash --backend wasm test.nyash` で実行可能
-**File Output**: `nyash --backend wasm --output test.wasm test.nyash` でファイル出力
-**Command Line**: `nyash --backend wasm test.hako` で実行可能
-**File Output**: `nyash --backend wasm --output test.wasm test.hako` でファイル出力
-**Error Messages**: 未対応機能の明確なエラーメッセージ
## Test Strategy
@ -156,9 +156,9 @@ fn test_ref_operations_codegen() {
```
### Integration Tests
- `tests/wasm_poc1_arithmetic.nyash` → MIR → WASM → wasmtime実行
- `tests/wasm_poc2_objects.nyash` → RefNew/RefGet/RefSet使用 → WASM実行
- `tests/wasm_poc3_features.nyash` → Weak/Future命令含む → WASM実行
- `tests/wasm_poc1_arithmetic.hako` → MIR → WASM → wasmtime実行
- `tests/wasm_poc2_objects.hako` → RefNew/RefGet/RefSet使用 → WASM実行
- `tests/wasm_poc3_features.hako` → Weak/Future命令含む → WASM実行
### Browser Testing
```html

View File

@ -138,7 +138,7 @@ impl MirBuilder {
## 🧪 テストケースCopilot実装必須
### Test 1: 基本Box定義・生成
**ファイル**: `test_user_defined_box.nyash`
**ファイル**: `test_user_defined_box.hako`
```nyash
box DataBox {
init { value }
@ -171,7 +171,7 @@ bb0:
**実行期待結果**: `42`
### Test 2: フィールドアクセス・代入
**ファイル**: `test_field_operations.nyash`
**ファイル**: `test_field_operations.hako`
```nyash
box Counter {
init { count }
@ -197,7 +197,7 @@ static box Main {
**期待結果**: `1`
### Test 3: デリゲーション基本
**ファイル**: `test_delegation_basic.nyash`
**ファイル**: `test_delegation_basic.hako`
```nyash
box Parent {
init { name }
@ -236,7 +236,7 @@ static box Main {
**期待結果**: `"Hello Alice (age 25)"`
### Test 4: WASM Box操作統合テスト
**ファイル**: `test_wasm_box_integration.nyash`
**ファイル**: `test_wasm_box_integration.hako`
```nyash
box SimpleData {
init { x, y }
@ -262,13 +262,13 @@ static box Main {
**テスト方法**:
```bash
# MIR生成テスト
./target/release/nyash --dump-mir test_wasm_box_integration.nyash
./target/release/nyash --dump-mir test_wasm_box_integration.hako
# WASM生成テスト
./target/release/nyash --compile-wasm test_wasm_box_integration.nyash
./target/release/nyash --compile-wasm test_wasm_box_integration.hako
# WASM実行テストwasmtime
./target/release/nyash --compile-wasm test_wasm_box_integration.nyash > test.wat
./target/release/nyash --compile-wasm test_wasm_box_integration.hako > test.wat
sed -n '4,$p' test.wat > clean_test.wat
$HOME/.wasmtime/bin/wasmtime run clean_test.wat --invoke main
```
@ -306,10 +306,10 @@ $HOME/.wasmtime/bin/wasmtime run clean_test.wat --invoke main
### デバッグ支援
```bash
# MIR生成確認
./target/release/nyash --dump-mir --mir-verbose test_file.nyash
./target/release/nyash --dump-mir --mir-verbose test_file.hako
# パーサー確認
./target/release/nyash --debug-fuel unlimited test_file.nyash
./target/release/nyash --debug-fuel unlimited test_file.hako
```
## 📊 期待される効果
@ -335,4 +335,4 @@ $HOME/.wasmtime/bin/wasmtime run clean_test.wat --invoke main
**優先度**: Critical
**担当**: Copilot + Claude協調実装
**最終目標**: test_wasm_box_integration.nyash が完全動作
**最終目標**: test_wasm_box_integration.hako が完全動作

View File

@ -132,13 +132,13 @@ Frontend → New MIR(25命令) →
### デバッグ支援
```bash
# セマンティクス確認
./target/release/nyash --dump-mir-semantic test.nyash
./target/release/nyash --dump-mir-semantic test.hako
# 降格パス確認
./target/release/nyash --dump-mir-lowered test.nyash
./target/release/nyash --dump-mir-lowered test.hako
# 性能比較
./target/release/nyash --benchmark-mir-passes test.nyash
./target/release/nyash --benchmark-mir-passes test.hako
```
## 📊 期待される効果

View File

@ -78,7 +78,7 @@ struct VMProfiler {
#### 📊 ベンチマーク計測拡張
```bash
# 詳細プロファイリングコマンド
./target/release/nyash --benchmark --profile-vm --iterations 1000 program.nyash
./target/release/nyash --benchmark --profile-vm --iterations 1000 program.hako
# 出力例
VM Performance Profile:
@ -189,7 +189,7 @@ struct ZeroCopyVM {
### VM性能測定テスト
各テストをInterpreter/VM/WASMで比較実行し性能プロファイル収集
#### test_vm_performance_basic.nyash
#### test_vm_performance_basic.hako
```nyash
// 基本演算性能テストCPU集約
static box VMPerfTest {
@ -234,7 +234,7 @@ box DataBox {
}
```
#### test_vm_boxcall_return.nyash
#### test_vm_boxcall_return.hako
```nyash
// BoxCall戻り値問題専用テスト
static box BoxCallTest {
@ -282,7 +282,7 @@ box ComplexBox {
}
```
#### test_vm_memory_usage.nyash
#### test_vm_memory_usage.hako
```nyash
// メモリ使用量測定テスト
static box MemoryTest {
@ -338,7 +338,7 @@ box LargeDataBox {
}
```
#### test_vm_instruction_dispatch.nyash
#### test_vm_instruction_dispatch.hako
```nyash
// 命令ディスパッチ性能特化テスト
static box DispatchTest {
@ -397,16 +397,16 @@ TESTS=(
)
for test in "${TESTS[@]}"; do
echo "📊 $test.nyash テスト実行中..."
echo "📊 $test.hako テスト実行中..."
echo " - Interpreter実行..."
time ./target/release/nyash --backend interpreter "tests/vm_performance/$test.nyash"
time ./target/release/nyash --backend interpreter "tests/vm_performance/$test.hako"
echo " - VM実行..."
time ./target/release/nyash --backend vm "tests/vm_performance/$test.nyash"
time ./target/release/nyash --backend vm "tests/vm_performance/$test.hako"
echo " - WASM実行..."
time ./target/release/nyash --backend wasm "tests/vm_performance/$test.nyash"
time ./target/release/nyash --backend wasm "tests/vm_performance/$test.hako"
echo ""
done

View File

@ -113,7 +113,7 @@ static box Main {
#### Test 1: 基本メモリ管理
```nyash
// test_kilo_basic_memory.nyash
// test_kilo_basic_memory.hako
box Editor {
init { rows }
pack() { me.rows = new ArrayBox() }
@ -141,7 +141,7 @@ static box Main {
#### Test 2: 複雑な相互参照
```nyash
// test_kilo_circular_refs.nyash
// test_kilo_circular_refs.hako
box Editor {
init { rows, state }
pack() {
@ -170,7 +170,7 @@ static box Main {
#### Test 3: 大量オブジェクト管理
```nyash
// test_kilo_mass_objects.nyash
// test_kilo_mass_objects.hako
static box Main {
main() {
local editor = new Editor()
@ -253,22 +253,22 @@ box Client {
### デバッグ支援(統合版)
```bash
# メモリ使用量監視
./target/release/nyash --debug-memory test_kilo_basic.nyash
./target/release/nyash --debug-memory test_kilo_basic.hako
# weak参照追跡
./target/release/nyash --trace-weak test_kilo_circular.nyash
./target/release/nyash --trace-weak test_kilo_circular.hako
# fini呼び出し追跡
./target/release/nyash --trace-fini test_kilo_mass.nyash
./target/release/nyash --trace-fini test_kilo_mass.hako
# BoxCall戻り値デバッグ新規
./target/release/nyash --debug-boxcall test_kilo_basic.nyash
./target/release/nyash --debug-boxcall test_kilo_basic.hako
# VM/Interpreter/WASM BoxCall比較新規
./target/release/nyash --compare-boxcall test_kilo_basic.nyash
./target/release/nyash --compare-boxcall test_kilo_basic.hako
# 統合デバッグ(メモリ + BoxCall
./target/release/nyash --debug-all test_kilo_basic.nyash
./target/release/nyash --debug-all test_kilo_basic.hako
```
## 📊 期待される効果(統合版)

View File

@ -56,7 +56,7 @@ fn resolve_builtin_delegation(builtin: &str, args: Vec<_>) -> Result<(), String>
#### **A. ユーザー定義Box基本動作**
```nyash
# test_user_box_basic.nyash
# test_user_box_basic.hako
box Life {
init { name, energy }
@ -73,7 +73,7 @@ assert(alice.energy == 100)
#### **B. ビルトインBox継承**
```nyash
# test_builtin_inheritance.nyash
# test_builtin_inheritance.hako
box EnhancedP2P from P2PBox {
init { features }
@ -89,7 +89,7 @@ assert(node.features != null)
#### **C. 透明化システム動作**
```nyash
# test_transparency.nyash
# test_transparency.hako
box SimpleString from StringBox {
init { prefix }
@ -109,7 +109,7 @@ assert(str.toString() == ">>> Hello")
#### **D. 混在テスト**
```nyash
# test_mixed_inheritance.nyash
# test_mixed_inheritance.hako
box AdvancedCalc from MathBox {
init { history }
@ -135,7 +135,7 @@ assert(calc2.result == 0)
#### **E. エラーケーステスト**
```nyash
# test_error_cases.nyash
# test_error_cases.hako
# 1. 存在しないmethodを呼び出し
box BadBox from StringBox {
@ -154,7 +154,7 @@ box ArgMismatch from P2PBox {
### **パフォーマンステスト**
```nyash
# test_performance.nyash
# test_performance.hako
local startTime = getCurrentTime()
loop(i < 1000) {
@ -187,7 +187,7 @@ assert(elapsed < 1000) # 1秒以内で完了
- [ ] エラーメッセージがユーザーフレンドリー
### **統合テスト**
- [ ] `test_birth_simple.nyash` 継続動作
- [ ] `test_birth_simple.hako` 継続動作
- [ ] Chip-8エミュレーター修正版動作
- [ ] 全ビルトインBox継承パターン動作
- [ ] デリゲーションチェーン正常動作
@ -201,10 +201,10 @@ assert(elapsed < 1000) # 1秒以内で完了
- `src/box_trait.rs` - BUILTIN_BOXES定数
### **テストファイル**
- `test_pack_transparency.nyash` - 統合テスト
- `test_builtin_inheritance.nyash` - ビルトイン継承
- `test_user_box_birth.nyash` - ユーザー定義Box
- `test_error_cases.nyash` - エラーケース
- `test_pack_transparency.hako` - 統合テスト
- `test_builtin_inheritance.hako` - ビルトイン継承
- `test_user_box_birth.hako` - ユーザー定義Box
- `test_error_cases.hako` - エラーケース
## 🎉 完了条件