GH-122160: Remove BUILD_CONST_KEY_MAP opcode. (GH-122164)

This commit is contained in:
Mark Shannon 2024-07-25 16:24:29 +01:00 committed by GitHub
parent 9bb2e4623f
commit 2e14a52cce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 306 additions and 478 deletions

View file

@ -589,42 +589,6 @@
DISPATCH();
}
TARGET(BUILD_CONST_KEY_MAP) {
frame->instr_ptr = next_instr;
next_instr += 1;
INSTRUCTION_STATS(BUILD_CONST_KEY_MAP);
_PyStackRef *values;
_PyStackRef keys;
_PyStackRef map;
keys = stack_pointer[-1];
values = &stack_pointer[-1 - oparg];
PyObject *keys_o = PyStackRef_AsPyObjectBorrow(keys);
assert(PyTuple_CheckExact(keys_o));
assert(PyTuple_GET_SIZE(keys_o) == (Py_ssize_t)oparg);
STACKREFS_TO_PYOBJECTS(values, oparg, values_o);
if (CONVERSION_FAILED(values_o)) {
for (int _i = oparg; --_i >= 0;) {
PyStackRef_CLOSE(values[_i]);
}
PyStackRef_CLOSE(keys);
if (true) { stack_pointer += -1 - oparg; goto error; }
}
PyObject *map_o = _PyDict_FromItems(
&PyTuple_GET_ITEM(keys_o, 0), 1,
values_o, 1, oparg);
STACKREFS_TO_PYOBJECTS_CLEANUP(values_o);
for (int _i = oparg; --_i >= 0;) {
PyStackRef_CLOSE(values[_i]);
}
PyStackRef_CLOSE(keys);
if (map_o == NULL) { stack_pointer += -1 - oparg; goto error; }
map = PyStackRef_FromPyObjectSteal(map_o);
stack_pointer[-1 - oparg] = map;
stack_pointer += -oparg;
assert(WITHIN_STACK_BOUNDS());
DISPATCH();
}
TARGET(BUILD_LIST) {
frame->instr_ptr = next_instr;
next_instr += 1;