summaryrefslogtreecommitdiffstats
path: root/Python/generated_cases.c.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2022-11-16 03:59:19 (GMT)
committerGitHub <noreply@github.com>2022-11-16 03:59:19 (GMT)
commite37744f289af00c6f6eba83f7abfb932b63de9e0 (patch)
tree442f19bd21cf3c6f5abcf733282baa710625ee7c /Python/generated_cases.c.h
parent4636df9febc6b8ae977ee8515749f189dfff7aab (diff)
downloadcpython-e37744f289af00c6f6eba83f7abfb932b63de9e0.zip
cpython-e37744f289af00c6f6eba83f7abfb932b63de9e0.tar.gz
cpython-e37744f289af00c6f6eba83f7abfb932b63de9e0.tar.bz2
GH-98831: Implement basic cache effects (#99313)
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r--Python/generated_cases.c.h35
1 files changed, 18 insertions, 17 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 552d0e6..b8bc66b 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -145,9 +145,9 @@
_Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free);
_Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free);
if (prod == NULL) goto pop_2_error;
- JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP);
STACK_SHRINK(1);
POKE(1, prod);
+ next_instr += 1;
DISPATCH();
}
@@ -165,9 +165,9 @@
_Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc);
_Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc);
if (prod == NULL) goto pop_2_error;
- JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP);
STACK_SHRINK(1);
POKE(1, prod);
+ next_instr += 1;
DISPATCH();
}
@@ -183,9 +183,9 @@
_Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free);
_Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free);
if (sub == NULL) goto pop_2_error;
- JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP);
STACK_SHRINK(1);
POKE(1, sub);
+ next_instr += 1;
DISPATCH();
}
@@ -202,9 +202,9 @@
_Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc);
_Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc);
if (sub == NULL) goto pop_2_error;
- JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP);
STACK_SHRINK(1);
POKE(1, sub);
+ next_instr += 1;
DISPATCH();
}
@@ -220,9 +220,9 @@
_Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc);
_Py_DECREF_SPECIALIZED(right, _PyUnicode_ExactDealloc);
if (res == NULL) goto pop_2_error;
- JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP);
STACK_SHRINK(1);
POKE(1, res);
+ next_instr += 1;
DISPATCH();
}
@@ -274,9 +274,9 @@
_Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc);
_Py_DECREF_SPECIALIZED(left, _PyFloat_ExactDealloc);
if (sum == NULL) goto pop_2_error;
- JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP);
STACK_SHRINK(1);
POKE(1, sum);
+ next_instr += 1;
DISPATCH();
}
@@ -292,9 +292,9 @@
_Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free);
_Py_DECREF_SPECIALIZED(left, (destructor)PyObject_Free);
if (sum == NULL) goto pop_2_error;
- JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP);
STACK_SHRINK(1);
POKE(1, sum);
+ next_instr += 1;
DISPATCH();
}
@@ -3703,29 +3703,30 @@
TARGET(BINARY_OP_GENERIC) {
PREDICTED(BINARY_OP_GENERIC);
- PyObject *rhs = POP();
- PyObject *lhs = TOP();
+ PyObject *rhs = PEEK(1);
+ PyObject *lhs = PEEK(2);
+ PyObject *res;
assert(0 <= oparg);
assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops));
assert(binary_ops[oparg]);
- PyObject *res = binary_ops[oparg](lhs, rhs);
+ res = binary_ops[oparg](lhs, rhs);
Py_DECREF(lhs);
Py_DECREF(rhs);
- SET_TOP(res);
- if (res == NULL) {
- goto error;
- }
- JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP);
+ if (res == NULL) goto pop_2_error;
+ STACK_SHRINK(1);
+ POKE(1, res);
+ next_instr += 1;
DISPATCH();
}
TARGET(BINARY_OP) {
PREDICTED(BINARY_OP);
+ assert(INLINE_CACHE_ENTRIES_BINARY_OP == 1);
+ PyObject *rhs = PEEK(1);
+ PyObject *lhs = PEEK(2);
_PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
assert(cframe.use_tracing == 0);
- PyObject *lhs = SECOND();
- PyObject *rhs = TOP();
next_instr--;
_Py_Specialize_BinaryOp(lhs, rhs, next_instr, oparg, &GETLOCAL(0));
DISPATCH_SAME_OPARG();