Skip to content

Commit 5a8ea9c

Browse files
committed
Phase 5.B c22b-api amend: API-6 operand cleanup with actual operands.
Per gatekeeper 14:42:25Z BLOCK on c22b-api ab60a4d PASS-(b) {6}: test_operand_cleanup was passing kCall with no operands so the variadic pack was empty + addOperands was never called with operand content; the cleanup cascade through lir_operand_free was not exercised. Amended: each cycle now allocates with two Imm{} inputs (k64bit + k32bit) which actually invoke allocateImmediateInput per operand. delete then cascades cleanup through Instruction dtor -> lir_instruction_destroy -> per-input lir_operand_free. getNumInputs()==2 assertion confirms operands were attached pre-delete (proves the operand-cleanup path is the one being exercised). Counter-instrumentation alternative deferred per pythia 14:05:34Z + supervisor 14:05:55Z heads-up (would modify production lir_operand_free, borderline-violates Option A zero-compile-flag- change attestation per supervisor 13:31:11Z 2-class ARM64 rule). Standalone test passing without crash + getNumInputs assertion substitutes for compile-time counter; valgrind/ASAN external if needed. Files: 1 modified, ~12 LOC delta.
1 parent ab60a4d commit 5a8ea9c

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

‎Python/jit/lir/test_unlinked_instr.cpp‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,27 @@ static void test_alloc_delete(void) {
5050
P();
5151
}
5252

53-
/* API-6: operand cleanup cascade. Two unlinked instrs in sequence;
54-
* if dtor leaks operands or unlinked allocation leaks state, second
55-
* alloc + delete cycle would observe corruption. Compile-time
56-
* assertion supplements valgrind/ASAN if available. */
53+
/* API-6: operand cleanup cascade. Each cycle allocates an unlinked
54+
* instr WITH actual operands (Imm immediate inputs) so addOperands
55+
* is invoked with a non-empty pack. Then delete cascades cleanup via
56+
* Instruction dtor -> lir_instruction_destroy -> lir_operand_free
57+
* per input. Without operand cleanup cascade, repeated cycles would
58+
* leak monotonically; standalone-run inspection (or valgrind/ASAN
59+
* external) detects. Counter-instrumentation deferred per Option A
60+
* zero-compile-flag-change discipline. */
61+
#include "cinderx/Jit/lir/operand.h"
62+
using jit::lir::Imm;
63+
using jit::lir::OperandBase;
5764
static void test_operand_cleanup(void) {
5865
Function func;
5966
BasicBlock* bb = func.allocateBasicBlock();
6067
for (int i = 0; i < 10; i++) {
6168
Instruction* shadow = bb->allocateInstrUnlinked(
62-
Instruction::kCall, nullptr);
69+
Instruction::kMove, nullptr,
70+
Imm{(uint64_t)(i + 1), OperandBase::k64bit},
71+
Imm{(uint64_t)(i + 100), OperandBase::k32bit});
6372
A(shadow != nullptr, "alloc null in cycle");
73+
A(shadow->getNumInputs() == 2, "operand count != 2");
6474
delete shadow;
6575
}
6676
A(bb->getNumInstrs() == 0, "BB polluted after 10 cycles");

0 commit comments

Comments
 (0)
Sponsor
SponsoredKunjungi sekarang
Promo