Skip to content

Commit ddcb309

Browse files
committed
Break down TO_BOOL_STR into guard and to-bool
1 parent d16f455 commit ddcb309

File tree

8 files changed

+172
-123
lines changed

8 files changed

+172
-123
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_ids.h

Lines changed: 97 additions & 96 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: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,14 @@ dummy_func(
512512
res = PyStackRef_False;
513513
}
514514

515-
inst(TO_BOOL_STR, (unused/1, unused/2, value -- res)) {
515+
op(_GUARD_TOS_UNICODE, (value-- value)) {
516516
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
517517
EXIT_IF(!PyUnicode_CheckExact(value_o));
518+
}
519+
520+
op(_TO_BOOL_STR, (value-- res)) {
518521
STAT_INC(TO_BOOL, hit);
522+
PyObject* value_o = PyStackRef_AsPyObjectBorrow(value);
519523
if (value_o == &_Py_STR(empty)) {
520524
assert(_Py_IsImmortal(value_o));
521525
DEAD(value);
@@ -528,6 +532,9 @@ dummy_func(
528532
}
529533
}
530534

535+
macro(TO_BOOL_STR) =
536+
_GUARD_TOS_UNICODE + unused / 1 + unused / 2 + _TO_BOOL_STR;
537+
531538
op(_REPLACE_WITH_TRUE, (value -- res)) {
532539
PyStackRef_CLOSE(value);
533540
res = PyStackRef_True;

Python/executor_cases.c.h

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

0 commit comments

Comments
 (0)