Phase 10.10: GC Switchable Runtime & Unified Debug System 実装完了
Phase 10.10の主要実装: - GcConfigBox: GC設定の実行時制御(counting/trace/barrier_strict) - DebugConfigBox: デバッグ設定の統一管理(JIT events/stats/dump/dot) - メソッドディスパッチ: system_methods.rsで両Boxのメソッド実装 - CountingGC動作確認: write_barriers正常カウント(VM実行時) 技術的詳細: - BoxCore/BoxBase統一アーキテクチャを活用 - setFlag/getFlag/apply/summaryメソッドで統一API提供 - 環境変数経由でVM/JITランタイムと連携 - GcConfigBox.apply()は次回実行から有効(ランタイム作成前に環境変数参照) テスト済み: - examples/gc_counting_demo.nyash: CountingGCの動作確認 - write_barriers=3でArray.push/set, Map.setを正しくカウント - NYASH_GC_TRACE=1でGC統計出力確認 Box-First哲学の体現: 設定も制御も観測もすべてBox! 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
30
examples/jit_map_get_param_hh.nyash
Normal file
30
examples/jit_map_get_param_hh.nyash
Normal file
@ -0,0 +1,30 @@
|
||||
// Map.get with both receiver and key as function parameters
|
||||
// Expect: JIT hostcall allow for nyash.map.get_hh (Handle,Handle)
|
||||
// Run:
|
||||
// NYASH_JIT_EXEC=1 NYASH_JIT_THRESHOLD=1 NYASH_JIT_HOSTCALL=1 NYASH_JIT_EVENTS=1 \
|
||||
// ./target/release/nyash --backend vm examples/jit_map_get_param_hh.nyash
|
||||
|
||||
box Helper {
|
||||
birth() {
|
||||
// no-op constructor
|
||||
}
|
||||
getv(m, k) {
|
||||
return m.get(k)
|
||||
}
|
||||
}
|
||||
|
||||
static box Main {
|
||||
main() {
|
||||
local m, k, v
|
||||
m = new MapBox()
|
||||
k = "key1"
|
||||
v = "value1"
|
||||
// Mutating ops fall back to VM by policy (read-only JIT)
|
||||
m.set(k, v)
|
||||
// Use user-defined box Helper so that getv is lowered into a MIR function
|
||||
local h
|
||||
h = new Helper()
|
||||
// Both m and k are parameters of Helper.getv/2 → JIT can use HH path
|
||||
return h.getv(m, k)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user