GH-116596: Better determination of escaping uops. (GH-116597)

This commit is contained in:
Mark Shannon 2024-03-11 13:37:48 +00:00 committed by GitHub
parent 6c4fc209e1
commit b6ae6da1bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 47 additions and 30 deletions

View file

@ -335,6 +335,7 @@ def is_infallible(op: parser.InstDef) -> bool:
"_PyDictOrValues_IsValues",
"_PyObject_DictOrValuesPointer",
"_PyDictOrValues_GetValues",
"_PyDictValues_AddToInsertionOrder",
"_PyObject_MakeInstanceAttributesFromDict",
"Py_DECREF",
"_Py_DECREF_SPECIALIZED",
@ -355,8 +356,10 @@ def is_infallible(op: parser.InstDef) -> bool:
"_PyLong_IsCompact",
"_PyLong_IsNonNegativeCompact",
"_PyLong_CompactValue",
"_PyLong_DigitCount",
"_Py_NewRef",
"_Py_IsImmortal",
"PyLong_FromLong",
"_Py_STR",
"_PyLong_Add",
"_PyLong_Multiply",
@ -368,6 +371,17 @@ def is_infallible(op: parser.InstDef) -> bool:
"_Py_atomic_load_uintptr_relaxed",
"_PyFrame_GetCode",
"_PyThreadState_HasStackSpace",
"_PyUnicode_Equal",
"_PyFrame_SetStackPointer",
"_PyType_HasFeature",
"PyUnicode_Concat",
"_PyList_FromArraySteal",
"_PyTuple_FromArraySteal",
"PySlice_New",
"_Py_LeaveRecursiveCallPy",
"CALL_STAT_INC",
"maybe_lltrace_resume_frame",
"_PyUnicode_JoinArray",
)
ESCAPING_FUNCTIONS = (
@ -379,6 +393,8 @@ def is_infallible(op: parser.InstDef) -> bool:
def makes_escaping_api_call(instr: parser.InstDef) -> bool:
if "CALL_INTRINSIC" in instr.name:
return True
if instr.name == "_BINARY_OP":
return True
tkns = iter(instr.tokens)
for tkn in tkns:
if tkn.kind != lexer.IDENTIFIER: