"Pure evaluation cannot take array-like inputs"):
self.run_cases_test(input, input2, output)
+ def test_overridden_abstract_with_multiple_caches(self):
+ input = """
+ op(OP, (version/1, unused/1, index/1, value -- res)) {
+ res = SPAM(version, index, value);
+ }
+ """
+ input2 = """
+ op(OP, (value -- res)) {
+ res = eggs(version, index, value);
+ }
+ """
+ output = """
+ case OP: {
+ JitOptRef value;
+ JitOptRef res;
+ value = stack_pointer[-1];
+ uint16_t version = (uint16_t)this_instr->operand0;
+ uint16_t index = (uint16_t)this_instr->operand1;
+ res = eggs(version, index, value);
+ stack_pointer[-1] = res;
+ break;
+ }
+ """
+ self.run_cases_test(input, input2, output)
+
if __name__ == "__main__":
unittest.main()
--- /dev/null
+Fix a bug in the JIT optimizer reading operands for uops with multiple
+caches.
case _LOAD_GLOBAL_MODULE: {
JitOptRef res;
uint16_t version = (uint16_t)this_instr->operand0;
- uint16_t index = (uint16_t)this_instr->operand0;
+ uint16_t index = (uint16_t)this_instr->operand1;
(void)index;
PyObject *cnst = NULL;
if (ctx->frame->func != NULL) {
case _LOAD_GLOBAL_BUILTINS: {
JitOptRef res;
uint16_t version = (uint16_t)this_instr->operand0;
- uint16_t index = (uint16_t)this_instr->operand0;
+ uint16_t index = (uint16_t)this_instr->operand1;
(void)version;
(void)index;
PyObject *cnst = NULL;
JitOptRef o;
owner = stack_pointer[-1];
uint32_t dict_version = (uint32_t)this_instr->operand0;
- uint16_t index = (uint16_t)this_instr->operand0;
+ uint16_t index = (uint16_t)this_instr->operand1;
(void)dict_version;
(void)index;
attr = PyJitRef_NULL;
args.append(input.name)
out.emit(f'DEBUG_PRINTF({", ".join(args)});\n')
if override:
+ idx = 0
for cache in uop.caches:
if cache.name != "unused":
if cache.size == 4:
else:
type = f"uint{cache.size*16}_t "
cast = f"uint{cache.size*16}_t"
- out.emit(f"{type}{cache.name} = ({cast})this_instr->operand0;\n")
+ out.emit(f"{type}{cache.name} = ({cast})this_instr->operand{idx};\n")
+ idx += 1
if override:
emitter = OptimizerEmitter(out, {}, uop, stack.copy())
# No reference management of inputs needed.