smokes: 追加カバレッジ — ループ比較のネスト版、Stage‑B OOB(opt‑in)、const/binop 自己受検\n\n- loops/compare_loop_nested_vm.sh(SMOKES_ENABLE_LOOP_COMPARE=1)\n- selfhost_stageb_oob_vm.sh(SMOKES_ENABLE_STAGEB_OOB=1)\n- const/binop self_param_*(インスタンス経由の lower_* を確認)

This commit is contained in:
nyash-codex
2025-11-01 17:04:06 +09:00
parent e86151e20f
commit e9bb4422a5
6 changed files with 217 additions and 7 deletions

View File

@ -4,7 +4,7 @@
static box LLVMBinOpInstructionBox {
// メインエントリーポイント - Pythonのlower_binop()に相当
lower_binop(op, lhs, rhs, dst) {
lower_binop(self, op, lhs, rhs, dst) {
// 比較演算子はcompare命令に委譲
if op == "==" || op == "!=" || op == "<" || op == ">" || op == "<=" || op == ">=" {
return me._delegate_to_compare(op, lhs, rhs, dst)
@ -57,7 +57,7 @@ static box LLVMBinOpInstructionBox {
}
// 比較演算子の委譲
_delegate_to_compare(op, lhs, rhs, dst) {
_delegate_to_compare(self, op, lhs, rhs, dst) {
// JSON: {"op":"compare","dst":3,"operation":">","lhs":1,"rhs":2}
return "{\"op\":\"compare\",\"dst\":" + dst + ",\"operation\":\"" + op + "\",\"lhs\":" + lhs + ",\"rhs\":" + rhs + "}"
}
@ -105,8 +105,8 @@ static box LLVMBinOpInstructionBox {
}
// デバッグ用 - 生成された命令の確認
debug_binop(op, lhs, rhs, dst) {
local json = me.lower_binop(op, lhs, rhs, dst)
debug_binop(self, op, lhs, rhs, dst) {
local json = me.lower_binop(self, op, lhs, rhs, dst)
print("Generated binop instruction: " + json)
return json
}

View File

@ -4,7 +4,7 @@
static box LLVMConstInstructionBox {
// メインエントリーポイント - Pythonのlower_const()に相当
lower_const(dst, value_dict) {
lower_const(self, dst, value_dict) {
local const_type = value_dict.type
local const_val = value_dict.value
@ -72,8 +72,8 @@ static box LLVMConstInstructionBox {
}
// デバッグ用 - 生成された命令の確認
debug_const(dst, value_dict) {
local json = me.lower_const(dst, value_dict)
debug_const(self, dst, value_dict) {
local json = me.lower_const(self, dst, value_dict)
print("Generated const instruction: " + json)
return json
}