Skip to content

Commit 3b02478

Browse files
fix thing
1 parent 5c57743 commit 3b02478

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Python/partial_evaluator_cases.c.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
case _STORE_FAST: {
8080
_Py_UopsPESlot value;
8181
value = stack_pointer[-1];
82+
value = stack_pointer[-1];
8283
_PyUOpInstruction *origin = sym_get_origin(&value);
8384
// Gets rid of things like x = x.
8485
if (sym_is_virtual(&value) &&
@@ -104,6 +105,7 @@
104105
case _POP_TOP: {
105106
_Py_UopsPESlot value;
106107
value = stack_pointer[-1];
108+
value = stack_pointer[-1];
107109
if (!sym_is_virtual(&value)) {
108110
MATERIALIZE_INST();
109111
}
@@ -584,6 +586,8 @@
584586
_Py_UopsPESlot sub;
585587
_Py_UopsPESlot container;
586588
_Py_UopsPESlot new_frame;
589+
sub = stack_pointer[-2];
590+
container = stack_pointer[-1];
587591
MATERIALIZE_INST();
588592
materialize(&container);
589593
materialize(&sub);
@@ -731,6 +735,7 @@
731735
_Py_UopsPESlot retval;
732736
_Py_UopsPESlot res;
733737
retval = stack_pointer[-1];
738+
retval = stack_pointer[-1];
734739
MATERIALIZE_INST();
735740
materialize(&retval);
736741
stack_pointer += -1;
@@ -801,6 +806,8 @@
801806
_Py_UopsPESlot v;
802807
_Py_UopsPESlot receiver;
803808
_Py_UopsPESlot gen_frame;
809+
v = stack_pointer[0];
810+
receiver = stack_pointer[1];
804811
MATERIALIZE_INST();
805812
// We are about to hit the end of the trace:
806813
ctx->done = true;
@@ -810,6 +817,7 @@
810817
case _YIELD_VALUE: {
811818
_Py_UopsPESlot retval;
812819
_Py_UopsPESlot value;
820+
retval = stack_pointer[-1];
813821
MATERIALIZE_INST();
814822
materialize(&retval);
815823
value = sym_new_unknown(ctx);
@@ -870,6 +878,7 @@
870878
_Py_UopsPESlot seq;
871879
_Py_UopsPESlot *output;
872880
output = &stack_pointer[-1];
881+
seq = stack_pointer[-1];
873882
/* This has to be done manually */
874883
MATERIALIZE_INST();
875884
materialize(&seq);
@@ -934,6 +943,7 @@
934943
_Py_UopsPESlot *right;
935944
left = &stack_pointer[-1];
936945
right = &stack_pointer[(oparg & 0xFF)];
946+
seq = stack_pointer[-1];
937947
/* This has to be done manually */
938948
MATERIALIZE_INST();
939949
materialize(&seq);
@@ -1057,6 +1067,7 @@
10571067
_Py_UopsPESlot res;
10581068
_Py_UopsPESlot null = (_Py_UopsPESlot){NULL, 0};
10591069
uint16_t index = (uint16_t)this_instr->operand;
1070+
globals_keys = stack_pointer[-1];
10601071
(void)index;
10611072
MATERIALIZE_INST();
10621073
materialize(&globals_keys);
@@ -1074,6 +1085,7 @@
10741085
_Py_UopsPESlot res;
10751086
_Py_UopsPESlot null = (_Py_UopsPESlot){NULL, 0};
10761087
uint16_t index = (uint16_t)this_instr->operand;
1088+
builtins_keys = stack_pointer[-1];
10771089
(void)index;
10781090
MATERIALIZE_INST();
10791091
materialize(&builtins_keys);
@@ -1526,6 +1538,7 @@
15261538
_Py_UopsPESlot owner;
15271539
_Py_UopsPESlot new_frame;
15281540
PyObject *fget = (PyObject *)this_instr->operand;
1541+
owner = stack_pointer[-1];
15291542
MATERIALIZE_INST();
15301543
materialize(&owner);
15311544
new_frame = (_Py_UopsPESlot){NULL, NULL};
@@ -2010,6 +2023,7 @@
20102023
case _FOR_ITER_GEN_FRAME: {
20112024
_Py_UopsPESlot iter;
20122025
_Py_UopsPESlot gen_frame;
2026+
iter = stack_pointer[0];
20132027
MATERIALIZE_INST();
20142028
/* We are about to hit the end of the trace */
20152029
ctx->done = true;
@@ -2496,6 +2510,7 @@
24962510
case _PUSH_FRAME: {
24972511
_Py_UopsPESlot new_frame;
24982512
new_frame = stack_pointer[-1];
2513+
new_frame = stack_pointer[-1];
24992514
MATERIALIZE_INST();
25002515
stack_pointer += -1;
25012516
assert(WITHIN_STACK_BOUNDS());
@@ -2971,6 +2986,7 @@
29712986
_Py_UopsPESlot *self_or_null;
29722987
_Py_UopsPESlot *callable;
29732988
_Py_UopsPESlot new_frame;
2989+
kwnames = stack_pointer[-3 - oparg];
29742990
args = &stack_pointer[-2 - oparg];
29752991
self_or_null = &stack_pointer[-2];
29762992
callable = &stack_pointer[-1];

Tools/cases_generator/partial_evaluator_generator.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,11 @@ def write_uop(
196196
var.defined = False
197197
base_offset = stack.base_offset.copy()
198198
for input in reversed(uop.stack.inputs):
199+
c_offset = base_offset.to_c()
199200
if input.is_array():
200-
c_offset = base_offset.to_c()
201201
out.emit(f"{input.name} = &stack_pointer[{c_offset}];\n")
202+
else:
203+
out.emit(f"{input.name} = stack_pointer[{c_offset}];\n")
202204
base_offset.push(input)
203205
storage = emitter.emit_tokens(override, storage, None)
204206
out.start_line()

0 commit comments

Comments
 (0)