主要な変更: - MIR Core-13命令セット確定(Load/Store削除の革命的設計) - Const, BinOp, Compare(値・計算) - Jump, Branch, Return, Phi(制御) - Call, BoxCall, ExternCall(呼び出し) - TypeOp, Safepoint, Barrier(メタ) - Phase 12.7糖衣構文ドキュメント整理(超圧縮重視、可逆変換保証) - MIRビルダーのモジュール分割完了 - vtableテストスイート拡充 - AI協調開発ツール追加(並列リファクタリング支援) 詳細: - src/mir/instruction_introspection.rs: core13_instruction_names()追加 - MIRビルダー分割: decls.rs, exprs_*.rs, fields.rs - plugin_loader_v2: errors.rs, host_bridge.rs分離 - 論文用データ: mir13-final.md作成 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
23 lines
1.6 KiB
Rust
23 lines
1.6 KiB
Rust
#[test]
|
|
fn vtable_console_log_clear_smoke() {
|
|
use crate::backend::vm::VM;
|
|
use crate::mir::{MirModule, MirFunction, FunctionSignature, MirInstruction, EffectMask, BasicBlockId, ConstValue, MirType};
|
|
std::env::set_var("NYASH_ABI_VTABLE", "1");
|
|
|
|
let sig = FunctionSignature { name: "main".into(), params: vec![], return_type: MirType::Integer, effects: EffectMask::PURE };
|
|
let mut f = MirFunction::new(sig, BasicBlockId::new(0));
|
|
let bb = f.entry_block;
|
|
let con = f.next_value_id();
|
|
f.get_block_mut(bb).unwrap().add_instruction(MirInstruction::NewBox { dst: con, box_type: "ConsoleBox".into(), args: vec![] });
|
|
let msg = f.next_value_id(); f.get_block_mut(bb).unwrap().add_instruction(MirInstruction::Const { dst: msg, value: ConstValue::String("hi".into()) });
|
|
f.get_block_mut(bb).unwrap().add_instruction(MirInstruction::BoxCall { dst: None, box_val: con, method: "log".into(), args: vec![msg], method_id: None, effects: EffectMask::PURE });
|
|
f.get_block_mut(bb).unwrap().add_instruction(MirInstruction::BoxCall { dst: None, box_val: con, method: "clear".into(), args: vec![], method_id: None, effects: EffectMask::PURE });
|
|
let zero = f.next_value_id(); f.get_block_mut(bb).unwrap().add_instruction(MirInstruction::Const { dst: zero, value: ConstValue::Integer(0) });
|
|
f.get_block_mut(bb).unwrap().add_instruction(MirInstruction::Return { value: Some(zero) });
|
|
let mut m = MirModule::new("console_smoke".into()); m.add_function(f);
|
|
let mut vm = VM::new();
|
|
let out = vm.execute_module(&m).expect("vm exec");
|
|
assert_eq!(out.to_string_box().value, "0");
|
|
}
|
|
|