mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
gh-132732: Automatically constant evaluate pure operations (GH-132733)
This adds a "macro" to the optimizer DSL called "REPLACE_OPCODE_IF_EVALUATES_PURE", which allows automatically constant evaluating a bytecode body if certain inputs have no side effects upon evaluations (such as ints, strings, and floats). Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
This commit is contained in:
parent
c45f4f3ebe
commit
695ab61351
10 changed files with 706 additions and 122 deletions
|
@ -850,7 +850,7 @@ dummy_func(
|
|||
DEOPT_IF(!res);
|
||||
}
|
||||
|
||||
pure op(_BINARY_OP_EXTEND, (descr/4, left, right -- res)) {
|
||||
op(_BINARY_OP_EXTEND, (descr/4, left, right -- res)) {
|
||||
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
|
||||
PyObject *right_o = PyStackRef_AsPyObjectBorrow(right);
|
||||
assert(INLINE_CACHE_ENTRIES_BINARY_OP == 5);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue