summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2023-07-31 15:55:33 (GMT)
committerGitHub <noreply@github.com>2023-07-31 15:55:33 (GMT)
commit5eb80a61f582802c3f1caa3bf4dc754847bf1e75 (patch)
treeffc01c0fff264f749a1c7666d367df1ae7822080 /Python/bytecodes.c
parenta22ff8e11c114e0c4c54c57b9e7f7520db9d5163 (diff)
downloadcpython-5eb80a61f582802c3f1caa3bf4dc754847bf1e75.zip
cpython-5eb80a61f582802c3f1caa3bf4dc754847bf1e75.tar.gz
cpython-5eb80a61f582802c3f1caa3bf4dc754847bf1e75.tar.bz2
GH-104909: Move unused cache entries from uops to macros (#107444)
There's no need to use a dummy uop to skip unused cache entries. The macro syntax lets you write `unused/1` instead. Similarly, move `unused/5` from op `_LOAD_ATTR_INSTANCE_VALUE` to macro `LOAD_ATTR_INSTANCE_VALUE`.
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 2b871e8..7320c30 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -1348,9 +1348,6 @@ dummy_func(
null = NULL;
}
- op(_SKIP_CACHE, (unused/1 -- )) {
- }
-
op(_GUARD_GLOBALS_VERSION, (version/1 --)) {
PyDictObject *dict = (PyDictObject *)GLOBALS();
DEOPT_IF(!PyDict_CheckExact(dict), LOAD_GLOBAL);
@@ -1386,13 +1383,13 @@ dummy_func(
}
macro(LOAD_GLOBAL_MODULE) =
- _SKIP_CACHE + // Skip over the counter
+ unused/1 + // Skip over the counter
_GUARD_GLOBALS_VERSION +
- _SKIP_CACHE + // Skip over the builtins version
+ unused/1 + // Skip over the builtins version
_LOAD_GLOBAL_MODULE;
macro(LOAD_GLOBAL_BUILTIN) =
- _SKIP_CACHE + // Skip over the counter
+ unused/1 + // Skip over the counter
_GUARD_GLOBALS_VERSION +
_GUARD_BUILTINS_VERSION +
_LOAD_GLOBAL_BUILTINS;
@@ -1824,7 +1821,7 @@ dummy_func(
DEOPT_IF(!_PyDictOrValues_IsValues(dorv), LOAD_ATTR);
}
- op(_LOAD_ATTR_INSTANCE_VALUE, (index/1, unused/5, owner -- res2 if (oparg & 1), res)) {
+ op(_LOAD_ATTR_INSTANCE_VALUE, (index/1, owner -- res2 if (oparg & 1), res)) {
PyDictOrValues dorv = *_PyObject_DictOrValuesPointer(owner);
res = _PyDictOrValues_GetValues(dorv)->values[index];
DEOPT_IF(res == NULL, LOAD_ATTR);
@@ -1835,10 +1832,11 @@ dummy_func(
}
macro(LOAD_ATTR_INSTANCE_VALUE) =
- _SKIP_CACHE + // Skip over the counter
+ unused/1 + // Skip over the counter
_GUARD_TYPE_VERSION +
_CHECK_MANAGED_OBJECT_HAS_VALUES +
- _LOAD_ATTR_INSTANCE_VALUE;
+ _LOAD_ATTR_INSTANCE_VALUE +
+ unused/5; // Skip over rest of cache
inst(LOAD_ATTR_MODULE, (unused/1, type_version/2, index/1, unused/5, owner -- res2 if (oparg & 1), res)) {
DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR);