Skip to content

Commit f8c0d17

Browse files
committed
Log incref/decref (basic)
1 parent 2295ecc commit f8c0d17

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mypyc/transform/log_trace.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
Call,
1616
CallC,
1717
CString,
18+
DecRef,
1819
GetAttr,
20+
IncRef,
1921
LoadLiteral,
2022
LoadStatic,
2123
Op,
@@ -96,6 +98,12 @@ def visit_box(self, op: Box) -> Value | None:
9698
def visit_unbox(self, op: Unbox) -> Value | None:
9799
return self.log(op, "unbox", str(op.type))
98100

101+
def visit_inc_ref(self, op: IncRef) -> Value | None:
102+
return self.log(op, "inc_ref", str(op.src.type))
103+
104+
def visit_dec_ref(self, op: DecRef) -> Value | None:
105+
return self.log(op, "dec_ref", str(op.src.type))
106+
99107
def log(self, op: Op, name: str, details: str) -> Value:
100108
if op.line >= 0:
101109
line_str = str(op.line)

0 commit comments

Comments
 (0)