mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
GH-113710: Add a "globals to constants" pass (GH-114592)
Converts specializations of `LOAD_GLOBAL` into constants during tier 2 optimization.
This commit is contained in:
parent
2091fb2a85
commit
0e71a295e9
16 changed files with 375 additions and 55 deletions
|
@ -4071,13 +4071,37 @@ dummy_func(
|
|||
}
|
||||
|
||||
op(_LOAD_CONST_INLINE, (ptr/4 -- value)) {
|
||||
TIER_TWO_ONLY
|
||||
value = Py_NewRef(ptr);
|
||||
}
|
||||
|
||||
op(_LOAD_CONST_INLINE_BORROW, (ptr/4 -- value)) {
|
||||
TIER_TWO_ONLY
|
||||
value = ptr;
|
||||
}
|
||||
|
||||
op(_LOAD_CONST_INLINE_WITH_NULL, (ptr/4 -- value, null)) {
|
||||
TIER_TWO_ONLY
|
||||
value = Py_NewRef(ptr);
|
||||
null = NULL;
|
||||
}
|
||||
|
||||
op(_LOAD_CONST_INLINE_BORROW_WITH_NULL, (ptr/4 -- value, null)) {
|
||||
TIER_TWO_ONLY
|
||||
value = ptr;
|
||||
null = NULL;
|
||||
}
|
||||
|
||||
op(_CHECK_GLOBALS, (dict/4 -- )) {
|
||||
TIER_TWO_ONLY
|
||||
DEOPT_IF(GLOBALS() != dict);
|
||||
}
|
||||
|
||||
op(_CHECK_BUILTINS, (dict/4 -- )) {
|
||||
TIER_TWO_ONLY
|
||||
DEOPT_IF(BUILTINS() != dict);
|
||||
}
|
||||
|
||||
/* Internal -- for testing executors */
|
||||
op(_INTERNAL_INCREMENT_OPT_COUNTER, (opt --)) {
|
||||
_PyCounterOptimizerObject *exe = (_PyCounterOptimizerObject *)opt;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue