Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions 25 Lib/test/test_generated_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2696,5 +2696,30 @@ def test_replace_opocode_uop_reject_array_effects(self):
"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()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix a bug in the JIT optimizer reading operands for uops with multiple
caches.
6 changes: 3 additions & 3 deletions 6 Python/optimizer_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion 4 Tools/cases_generator/optimizer_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,16 @@ def write_uop(
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:
type = cast = "PyObject *"
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.
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.