Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
GH-109369: Exit tier 2 if executor is invalid#111657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
8fb3c7d62d5e683dc1695285600c16301271a86439cccba8c65b6e36f04bf61d624231ce36706File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Make sure that tier 2 traces are de-optimized if the code is instrumented |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,6 +5,55 @@ | ||
| import parsing | ||
| from typing import AbstractSet | ||
| WHITELIST = ( | ||
| "Py_INCREF", | ||
| "_PyDictOrValues_IsValues", | ||
| "_PyObject_DictOrValuesPointer", | ||
| "_PyDictOrValues_GetValues", | ||
| "_PyObject_MakeInstanceAttributesFromDict", | ||
| "Py_DECREF", | ||
| "_Py_DECREF_SPECIALIZED", | ||
| "DECREF_INPUTS_AND_REUSE_FLOAT", | ||
| "PyUnicode_Append", | ||
| "_PyLong_IsZero", | ||
| "Py_SIZE", | ||
| "Py_TYPE", | ||
| "PyList_GET_ITEM", | ||
| "PyTuple_GET_ITEM", | ||
| "PyList_GET_SIZE", | ||
| "PyTuple_GET_SIZE", | ||
| "Py_ARRAY_LENGTH", | ||
| "Py_Unicode_GET_LENGTH", | ||
| "PyUnicode_READ_CHAR", | ||
| "_Py_SINGLETON", | ||
| "PyUnicode_GET_LENGTH", | ||
| "_PyLong_IsCompact", | ||
| "_PyLong_IsNonNegativeCompact", | ||
| "_PyLong_CompactValue", | ||
| "_Py_NewRef", | ||
| ) | ||
| def makes_escaping_api_call(instr: parsing.Node) -> bool: | ||
| tkns = iter(instr.tokens) | ||
| for tkn in tkns: | ||
| if tkn.kind != lx.IDENTIFIER: | ||
| continue | ||
| try: | ||
| next_tkn = next(tkns) | ||
| except StopIteration: | ||
| return False | ||
| if next_tkn.kind != lx.LPAREN: | ||
| continue | ||
| if not tkn.text.startswith("Py") and not tkn.text.startswith("_Py"): | ||
| continue | ||
| if tkn.text.endswith("Check"): | ||
| continue | ||
| if tkn.text.endswith("CheckExact"): | ||
| continue | ||
| if tkn.text in WHITELIST: | ||
| continue | ||
| return True | ||
| return False | ||
| @dataclasses.dataclass | ||
| class InstructionFlags: | ||
| @@ -19,6 +68,7 @@ class InstructionFlags: | ||
| HAS_EVAL_BREAK_FLAG: bool = False | ||
| HAS_DEOPT_FLAG: bool = False | ||
| HAS_ERROR_FLAG: bool = False | ||
| HAS_ESCAPES_FLAG: bool = False | ||
| def __post_init__(self) -> None: | ||
| self.bitmask ={name: (1 << i) for i, name in enumerate(self.names())} | ||
| @@ -50,6 +100,10 @@ def fromInstruction(instr: parsing.Node) -> "InstructionFlags": | ||
| or variable_used(instr, "exception_unwind") | ||
| or variable_used(instr, "resume_with_error") | ||
| ), | ||
| HAS_ESCAPES_FLAG=( | ||
| variable_used(instr, "tstate") | ||
| or makes_escaping_api_call(instr) | ||
| ), | ||
markshannon marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading. Please reload this page. | ||
| ) | ||
| @staticmethod | ||
Uh oh!
There was an error while loading. Please reload this page.