Skip to content

Commit 5a9af9c

Browse files
committed
Split BINARY_OP_ADD_FLOAT. WIP.
1 parent fee7a99 commit 5a9af9c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Python/bytecodes.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ static size_t jump;
6262
static uint16_t invert, counter, index, hint;
6363
static uint32_t type_version;
6464

65+
// These shouldn't be enecessary, but we can tolerate them in the short term.
66+
#define _BINARY_OP_ADD_FLOAT_CHECK 1003
67+
#define _BINARY_OP_ADD_FLOAT_ACTION 1004
68+
6569
static PyObject *
6670
dummy_func(
6771
PyThreadState *tstate,
@@ -271,7 +275,14 @@ dummy_func(
271275
JUMPBY(INLINE_CACHE_ENTRIES_BINARY_OP + 1);
272276
}
273277

274-
inst(BINARY_OP_ADD_FLOAT, (unused/1, left, right -- sum)) {
278+
op(_BINARY_OP_ADD_FLOAT_CHECK, (left, right -- left, right)) {
279+
assert(cframe.use_tracing == 0);
280+
DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP);
281+
DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP);
282+
STAT_INC(BINARY_OP, hit);
283+
}
284+
285+
op(_BINARY_OP_ADD_FLOAT_ACTION, (unused/1, left, right -- sum)) {
275286
assert(cframe.use_tracing == 0);
276287
DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP);
277288
DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP);
@@ -284,6 +295,8 @@ dummy_func(
284295
ERROR_IF(sum == NULL, error);
285296
}
286297

298+
inst(BINARY_OP_ADD_FLOAT) = _BINARY_OP_ADD_FLOAT_CHECK + _BINARY_OP_ADD_FLOAT_ACTION;
299+
287300
inst(BINARY_OP_ADD_INT, (unused/1, left, right -- sum)) {
288301
assert(cframe.use_tracing == 0);
289302
DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP);

0 commit comments

Comments
 (0)