8000 gh-134584: Elimiate redundant refcounting from _BINARY_OP_X_UNICODE · python/cpython@d5afe15 · GitHub
[go: up one dir, main page]

Skip to content

Commit d5afe15

Browse files
committed
gh-134584: Elimiate redundant refcounting from _BINARY_OP_X_UNICODE
1 parent ac9d37c commit d5afe15

File tree

5 files changed

+151
-43
lines changed

5 files changed

+151
-43
lines changed

Include/internal/pycore_uop_ids.h

Lines changed: 47 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,28 @@ dummy_func(
344344
PyStackRef_XCLOSE(value);
345345
}
346346

347+
348+
op(_POP_TOP_NOP, (value --)) {
349+
assert(PyStackRef_IsNull(value) || (!PyStackRef_RefcountOnObject(value)) ||
350+
_Py_IsImmortal((PyStackRef_AsPyObjectBorrow(value))));
< 8000 /code>
351+
DEAD(value);
352+
}
353+
354+
op(_POP_TOP_INT, (value --)) {
355+
assert(PyLong_CheckExact(PyStackRef_AsPyObjectBorrow(value)));
356+
PyStackRef_CLOSE_SPECIALIZED(value, _PyLong_ExactDealloc);
357+
}
358+
359+
op(_POP_TOP_FLOAT, (value --)) {
360+
assert(PyFloat_CheckExact(PyStackRef_AsPyObjectBorrow(value)));
361+
PyStackRef_CLOSE_SPECIALIZED(value, _PyFloat_ExactDealloc);
362+
}
363+
364+
op(_POP_TOP_UNICODE, (value --)) {
365+
assert(PyUnicode_CheckExact(PyStackRef_AsPyObjectBorrow(value)));
366+
PyStackRef_CLOSE_SPECIALIZED(value, _PyUnicode_ExactDealloc);
367+
}
368+
347369
tier2 op(_POP_TWO, (nos, tos --)) {
348370
PyStackRef_CLOSE(tos);
349371
PyStackRef_CLOSE(nos);

Python/executor_cases.c.h

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_cases.c.h

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
0