Files
hakorune/docs/papers/archive/unified-lifecycle/evaluation-plan.md
Moe Charm e2e25f6615 論文フォルダ整理: ChatGPT5提案による2本立て構造に再編成
- 論文A: MIR13命令とIR設計 (コンパイラ・PL実装者向け)
  - ArrayGet/Set → BoxCall統合による50%削減
  - IC/AOT/TypedArray最適化
  - Everything is Box哲学のMIR実装

- 論文B: Nyash言語と実行モデル (言語理論・分散システム向け)
  - init/fini対称性メモリ管理
  - P2P Intentモデル
  - 多層実行アーキテクチャ(Interpreter→VM→JIT→AOT→WASM)

既存のmir15-fullstack/unified-lifecycleはarchiveに移動
2025-09-03 03:06:24 +09:00

3.9 KiB
Raw Blame History

Evaluation Plan

E1: 意味論等価性検証

目的

全実行バックエンドInterpreter/VM/JIT/AOT/WASMで完全に同じ動作を保証

テストケース

// test_equivalence.nyash
box Counter @must_drop {
    init { value }
    
    increment() {
        me.value = me.value + 1
        print("Count: " + me.value)
    }
}

static box Main {
    main() {
        local c = new Counter(0)
        loop(i < 3) {
            c.increment()
        }
        // 自動的にfiniが呼ばれる
    }
}

検証項目

  • 出力が完全一致
  • fini呼び出し順序が一致
  • エラーハンドリングが一致
  • メモリ使用パターンが同等

実行コマンド

# 各バックエンドで実行
./nyash --backend interpreter test.nyash > interp.log
./nyash --backend vm test.nyash > vm.log
./nyash --backend vm --jit-threshold 1 test.nyash > jit.log
./nyashc --aot test.nyash -o test && ./test > aot.log
./nyashc --wasm test.nyash -o test.wasm && wasmtime test.wasm > wasm.log

# 比較
diff interp.log vm.log
diff vm.log jit.log
diff jit.log aot.log
diff aot.log wasm.log

E2: GCオン/オフ等価性

目的

GCの有無でプログラムの意味論が変わらないことを証明

テストケース

box DataHolder @gcable {
    init { data }
    
    process() {
        // 大量のメモリ割り当て
        local temp = new ArrayBox()
        loop(i < 1000000) {
            temp.push(i)
        }
        return temp.length()
    }
}

測定項目

  • I/Oトレース差分: 0
  • 最終結果: 同一
  • レイテンシ分布: p95/p99で比較

E3: プラグインオーバーヘッド測定

目的

プラグインシステムのオーバーヘッドを定量化

ベンチマーク

// bench_plugin_overhead.nyash
static box Benchmark {
    measure_array_access() {
        local arr = new ArrayBox()
        local sum = 0
        
        // 初期化
        loop(i < 1000000) {
            arr.push(i)
        }
        
        // アクセス性能測定
        local start = new TimeBox().now()
        loop(i < 1000000) {
            sum = sum + arr.get(i)
        }
        local end = new TimeBox().now()
        
        return end - start
    }
}

比較対象

  • ビルトイン実装(現在)
  • プラグイン実装(動的リンク)
  • プラグイン実装(静的リンク)
  • インライン展開後

E4: スケーラビリティ評価

大規模プログラムでの性能

ベンチマーク 行数 Interp VM JIT AOT
json_parser 500 1.0x ? ? ?
http_server 1000 1.0x ? ? ?
game_engine 5000 1.0x ? ? ?

メモリ使用量

# メモリプロファイリング
valgrind --tool=massif ./nyash --backend vm large_app.nyash
ms_print massif.out.*

E5: プラットフォーム移植性

テスト環境

  • Linux (x86_64, aarch64)
  • macOS (x86_64, M1)
  • Windows (x86_64)
  • WebAssembly (ブラウザ, Wasmtime)

ビルドスクリプト

#!/bin/bash
# cross_platform_test.sh

platforms=(
    "x86_64-unknown-linux-gnu"
    "aarch64-unknown-linux-gnu"
    "x86_64-apple-darwin"
    "aarch64-apple-darwin"
    "x86_64-pc-windows-msvc"
    "wasm32-wasi"
)

for platform in "${platforms[@]}"; do
    echo "Building for $platform..."
    cargo build --target $platform --release
    
    # プラグインもビルド
    (cd plugins/nyash-array-plugin && cargo build --target $platform --release)
done

実験スケジュール

Phase 1: 基礎評価1週間

  • E1: 意味論等価性
  • E2: GCオン/オフ等価性

Phase 2: 性能評価1週間

  • E3: プラグインオーバーヘッド
  • E4: スケーラビリティ

Phase 3: 移植性評価3日

  • E5: クロスプラットフォーム

Phase 4: 論文執筆1週間

  • 結果分析
  • グラフ作成
  • 考察執筆