🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
#[test]
|
|
|
|
|
fn vtable_array_contains_indexof_join() {
|
2025-11-17 11:28:18 +09:00
|
|
|
use crate::backend::VM;
|
2025-09-17 07:43:07 +09:00
|
|
|
use crate::mir::{
|
|
|
|
|
BasicBlockId, ConstValue, EffectMask, FunctionSignature, MirFunction, MirInstruction,
|
|
|
|
|
MirModule, MirType,
|
|
|
|
|
};
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
std::env::set_var("NYASH_ABI_VTABLE", "1");
|
|
|
|
|
|
|
|
|
|
// contains: ["a","b"].contains("b") == true; contains("c") == false
|
2025-09-17 07:43:07 +09:00
|
|
|
let sig = FunctionSignature {
|
|
|
|
|
name: "main".into(),
|
|
|
|
|
params: vec![],
|
|
|
|
|
return_type: MirType::Integer,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
};
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
let mut f = MirFunction::new(sig, BasicBlockId::new(0));
|
|
|
|
|
let bb = f.entry_block;
|
|
|
|
|
let arr = f.next_value_id();
|
2025-09-17 07:43:07 +09:00
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::NewBox {
|
|
|
|
|
dst: arr,
|
|
|
|
|
box_type: "ArrayBox".into(),
|
|
|
|
|
args: vec![],
|
|
|
|
|
});
|
|
|
|
|
let sa = f.next_value_id();
|
|
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Const {
|
|
|
|
|
dst: sa,
|
|
|
|
|
value: ConstValue::String("a".into()),
|
|
|
|
|
});
|
|
|
|
|
let sb = f.next_value_id();
|
|
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Const {
|
|
|
|
|
dst: sb,
|
|
|
|
|
value: ConstValue::String("b".into()),
|
|
|
|
|
});
|
|
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: None,
|
|
|
|
|
box_val: arr,
|
|
|
|
|
method: "push".into(),
|
|
|
|
|
args: vec![sa],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: None,
|
|
|
|
|
box_val: arr,
|
|
|
|
|
method: "push".into(),
|
|
|
|
|
args: vec![sb],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
let sc = f.next_value_id();
|
|
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Const {
|
|
|
|
|
dst: sc,
|
|
|
|
|
value: ConstValue::String("c".into()),
|
|
|
|
|
});
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
let got1 = f.next_value_id();
|
2025-09-17 07:43:07 +09:00
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: Some(got1),
|
|
|
|
|
box_val: arr,
|
|
|
|
|
method: "contains".into(),
|
|
|
|
|
args: vec![sb],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
let got2 = f.next_value_id();
|
2025-09-17 07:43:07 +09:00
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: Some(got2),
|
|
|
|
|
box_val: arr,
|
|
|
|
|
method: "contains".into(),
|
|
|
|
|
args: vec![sc],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
// return got1.equals(true) && got2.equals(false) as 1 for pass
|
|
|
|
|
// Instead, just return 0 or 1 using simple branch-like comparison via toString
|
|
|
|
|
// We check: got1==true -> "true", got2==false -> "false" and return 1 if both match else 0
|
|
|
|
|
// For brevity, just return got1.toString() ("true") length + got2.toString() ("false") length == 9
|
2025-09-17 07:43:07 +09:00
|
|
|
let s1 = f.next_value_id();
|
|
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: Some(s1),
|
|
|
|
|
box_val: got1,
|
|
|
|
|
method: "toString".into(),
|
|
|
|
|
args: vec![],
|
|
|
|
|
method_id: Some(0),
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
let s2 = f.next_value_id();
|
|
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: Some(s2),
|
|
|
|
|
box_val: got2,
|
|
|
|
|
method: "toString".into(),
|
|
|
|
|
args: vec![],
|
|
|
|
|
method_id: Some(0),
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
let len1 = f.next_value_id();
|
|
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: Some(len1),
|
|
|
|
|
box_val: s1,
|
|
|
|
|
method: "len".into(),
|
|
|
|
|
args: vec![],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
let len2 = f.next_value_id();
|
|
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: Some(len2),
|
|
|
|
|
box_val: s2,
|
|
|
|
|
method: "len".into(),
|
|
|
|
|
args: vec![],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
// len1 + len2
|
2025-09-17 07:43:07 +09:00
|
|
|
let sum = f.next_value_id();
|
|
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BinOp {
|
|
|
|
|
dst: sum,
|
|
|
|
|
op: crate::mir::BinaryOp::Add,
|
|
|
|
|
lhs: len1,
|
|
|
|
|
rhs: len2,
|
|
|
|
|
});
|
|
|
|
|
f.get_block_mut(bb)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Return { value: Some(sum) });
|
|
|
|
|
let mut m = MirModule::new("arr_contains".into());
|
|
|
|
|
m.add_function(f);
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
let mut vm = VM::new();
|
|
|
|
|
let out = vm.execute_module(&m).expect("vm exec");
|
|
|
|
|
assert_eq!(out.to_string_box().value, "9"); // "true"(4)+"false"(5)
|
|
|
|
|
|
|
|
|
|
// indexOf: ["x","y"].indexOf("y") == 1; indexOf("z") == -1
|
2025-09-17 07:43:07 +09:00
|
|
|
let sig2 = FunctionSignature {
|
|
|
|
|
name: "main".into(),
|
|
|
|
|
params: vec![],
|
|
|
|
|
return_type: MirType::Integer,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
};
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
let mut f2 = MirFunction::new(sig2, BasicBlockId::new(0));
|
|
|
|
|
let bb2 = f2.entry_block;
|
|
|
|
|
let a2 = f2.next_value_id();
|
2025-09-17 07:43:07 +09:00
|
|
|
f2.get_block_mut(bb2)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::NewBox {
|
|
|
|
|
dst: a2,
|
|
|
|
|
box_type: "ArrayBox".into(),
|
|
|
|
|
args: vec![],
|
|
|
|
|
});
|
|
|
|
|
let sx = f2.next_value_id();
|
|
|
|
|
f2.get_block_mut(bb2)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Const {
|
|
|
|
|
dst: sx,
|
|
|
|
|
value: ConstValue::String("x".into()),
|
|
|
|
|
});
|
|
|
|
|
let sy = f2.next_value_id();
|
|
|
|
|
f2.get_block_mut(bb2)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Const {
|
|
|
|
|
dst: sy,
|
|
|
|
|
value: ConstValue::String("y".into()),
|
|
|
|
|
});
|
|
|
|
|
let sz = f2.next_value_id();
|
|
|
|
|
f2.get_block_mut(bb2)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Const {
|
|
|
|
|
dst: sz,
|
|
|
|
|
value: ConstValue::String("z".into()),
|
|
|
|
|
});
|
|
|
|
|
f2.get_block_mut(bb2)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: None,
|
|
|
|
|
box_val: a2,
|
|
|
|
|
method: "push".into(),
|
|
|
|
|
args: vec![sx],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
f2.get_block_mut(bb2)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: None,
|
|
|
|
|
box_val: a2,
|
|
|
|
|
method: "push".into(),
|
|
|
|
|
args: vec![sy],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
let i1 = f2.next_value_id();
|
|
|
|
|
f2.get_block_mut(bb2)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: Some(i1),
|
|
|
|
|
box_val: a2,
|
|
|
|
|
method: "indexOf".into(),
|
|
|
|
|
args: vec![sy],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
let i2 = f2.next_value_id();
|
|
|
|
|
f2.get_block_mut(bb2)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: Some(i2),
|
|
|
|
|
box_val: a2,
|
|
|
|
|
method: "indexOf".into(),
|
|
|
|
|
args: vec![sz],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
let sum2 = f2.next_value_id();
|
|
|
|
|
f2.get_block_mut(bb2)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BinOp {
|
|
|
|
|
dst: sum2,
|
|
|
|
|
op: crate::mir::BinaryOp::Add,
|
|
|
|
|
lhs: i1,
|
|
|
|
|
rhs: i2,
|
|
|
|
|
});
|
|
|
|
|
f2.get_block_mut(bb2)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Return { value: Some(sum2) });
|
|
|
|
|
let mut m2 = MirModule::new("arr_indexOf".into());
|
|
|
|
|
m2.add_function(f2);
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
let mut vm2 = VM::new();
|
|
|
|
|
let out2 = vm2.execute_module(&m2).expect("vm exec");
|
|
|
|
|
assert_eq!(out2.to_string_box().value, "0"); // 1 + (-1)
|
|
|
|
|
|
|
|
|
|
// join: ["a","b","c"].join("-") == "a-b-c"
|
2025-09-17 07:43:07 +09:00
|
|
|
let sig3 = FunctionSignature {
|
|
|
|
|
name: "main".into(),
|
|
|
|
|
params: vec![],
|
|
|
|
|
return_type: MirType::String,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
};
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
let mut f3 = MirFunction::new(sig3, BasicBlockId::new(0));
|
|
|
|
|
let bb3 = f3.entry_block;
|
|
|
|
|
let a3 = f3.next_value_id();
|
2025-09-17 07:43:07 +09:00
|
|
|
f3.get_block_mut(bb3)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::NewBox {
|
|
|
|
|
dst: a3,
|
|
|
|
|
box_type: "ArrayBox".into(),
|
|
|
|
|
args: vec![],
|
|
|
|
|
});
|
|
|
|
|
let a = f3.next_value_id();
|
|
|
|
|
f3.get_block_mut(bb3)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Const {
|
|
|
|
|
dst: a,
|
|
|
|
|
value: ConstValue::String("a".into()),
|
|
|
|
|
});
|
|
|
|
|
let b = f3.next_value_id();
|
|
|
|
|
f3.get_block_mut(bb3)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Const {
|
|
|
|
|
dst: b,
|
|
|
|
|
value: ConstValue::String("b".into()),
|
|
|
|
|
});
|
|
|
|
|
let c = f3.next_value_id();
|
|
|
|
|
f3.get_block_mut(bb3)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Const {
|
|
|
|
|
dst: c,
|
|
|
|
|
value: ConstValue::String("c".into()),
|
|
|
|
|
});
|
|
|
|
|
f3.get_block_mut(bb3)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: None,
|
|
|
|
|
box_val: a3,
|
|
|
|
|
method: "push".into(),
|
|
|
|
|
args: vec![a],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
f3.get_block_mut(bb3)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: None,
|
|
|
|
|
box_val: a3,
|
|
|
|
|
method: "push".into(),
|
|
|
|
|
args: vec![b],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
f3.get_block_mut(bb3)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: None,
|
|
|
|
|
box_val: a3,
|
|
|
|
|
method: "push".into(),
|
|
|
|
|
args: vec![c],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
let sep = f3.next_value_id();
|
|
|
|
|
f3.get_block_mut(bb3)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Const {
|
|
|
|
|
dst: sep,
|
|
|
|
|
value: ConstValue::String("-".into()),
|
|
|
|
|
});
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
let joined = f3.next_value_id();
|
2025-09-17 07:43:07 +09:00
|
|
|
f3.get_block_mut(bb3)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::BoxCall {
|
|
|
|
|
dst: Some(joined),
|
|
|
|
|
box_val: a3,
|
|
|
|
|
method: "join".into(),
|
|
|
|
|
args: vec![sep],
|
|
|
|
|
method_id: None,
|
|
|
|
|
effects: EffectMask::PURE,
|
|
|
|
|
});
|
|
|
|
|
f3.get_block_mut(bb3)
|
|
|
|
|
.unwrap()
|
|
|
|
|
.add_instruction(MirInstruction::Return {
|
|
|
|
|
value: Some(joined),
|
|
|
|
|
});
|
|
|
|
|
let mut m3 = MirModule::new("arr_join".into());
|
|
|
|
|
m3.add_function(f3);
|
🎉 Phase 11.8/12.7: MIR Core-13 完全実装 + 糖衣構文ドキュメント更新
主要な変更:
- 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>
2025-09-04 11:34:15 +09:00
|
|
|
let mut vm3 = VM::new();
|
|
|
|
|
let out3 = vm3.execute_module(&m3).expect("vm exec");
|
|
|
|
|
assert_eq!(out3.to_string_box().value, "a-b-c");
|
|
|
|
|
}
|