@@ -59,14 +59,14 @@ class TestEffects(unittest.TestCase):
5959 def test_effect_sizes (self ):
6060 stack = Stack ()
6161 inputs = [
62- x := StackItem ("x" , None , "" , " 1" ),
63- y := StackItem ("y" , None , "" , " oparg" ),
64- z := StackItem ("z" , None , "" , " oparg*2" ),
62+ x := StackItem ("x" , None , "1" ),
63+ y := StackItem ("y" , None , "oparg" ),
64+ z := StackItem ("z" , None , "oparg*2" ),
6565 ]
6666 outputs = [
67- StackItem ("x" , None , "" , " 1" ),
68- StackItem ("b" , None , "" , " oparg*4" ),
69- StackItem ("c" , None , "" , " 1" ),
67+ StackItem ("x" , None , "1" ),
68+ StackItem ("b" , None , "oparg*4" ),
69+ StackItem ("c" , None , "1" ),
7070 ]
7171 stack .pop (z )
7272 stack .pop (y )
@@ -104,20 +104,6 @@ def test_push_one(self):
104104 """
105105 self .check (input , output )
106106
107- def test_cond_push (self ):
108- input = """
109- inst(OP, (a -- b, c if (oparg))) {
110- SPAM();
111- }
112- """
113- output = """
114- case OP: {
115- *effect = ((oparg) ? 1 : 0);
116- return 0;
117- }
118- """
119- self .check (input , output )
120-
121107 def test_ops_pass_two (self ):
122108 input = """
123109 op(A, (-- val1)) {
@@ -138,25 +124,6 @@ def test_ops_pass_two(self):
138124 """
139125 self .check (input , output )
140126
141- def test_ops_pass_two_cond_push (self ):
142- input = """
143- op(A, (-- val1, val2)) {
144- val1 = 0;
145- val2 = 1;
146- }
147- op(B, (val1, val2 -- val1, val2, val3 if (oparg))) {
148- val3 = SPAM();
149- }
150- macro(OP) = A + B;
151- """
152- output = """
153- case OP: {
154- *effect = Py_MAX(2, 2 + ((oparg) ? 1 : 0));
155- return 0;
156- }
157- """
158- self .check (input , output )
159-
160127 def test_pop_push_array (self ):
161128 input = """
162129 inst(OP, (values[oparg] -- values[oparg], above)) {
@@ -1074,98 +1041,6 @@ def test_array_error_if(self):
10741041 """
10751042 self .run_cases_test (input , output )
10761043
1077- def test_cond_effect (self ):
1078- input = """
1079- inst(OP, (aa, input if ((oparg & 1) == 1), cc -- xx, output if (oparg & 2), zz)) {
1080- output = SPAM(oparg, aa, cc, input);
1081- INPUTS_DEAD();
1082- xx = 0;
1083- zz = 0;
1084- }
1085- """
1086- output = """
1087- TARGET(OP) {
1088- #if Py_TAIL_CALL_INTERP
1089- int opcode = OP;
1090- (void)(opcode);
1091- #endif
1092- frame->instr_ptr = next_instr;
1093- next_instr += 1;
1094- INSTRUCTION_STATS(OP);
1095- _PyStackRef aa;
1096- _PyStackRef input = PyStackRef_NULL;
1097- _PyStackRef cc;
1098- _PyStackRef xx;
1099- _PyStackRef output = PyStackRef_NULL;
1100- _PyStackRef zz;
1101- cc = stack_pointer[-1];
1102- if ((oparg & 1) == 1) { input = stack_pointer[-1 - (((oparg & 1) == 1) ? 1 : 0)]; }
1103- aa = stack_pointer[-2 - (((oparg & 1) == 1) ? 1 : 0)];
1104- output = SPAM(oparg, aa, cc, input);
1105- xx = 0;
1106- zz = 0;
1107- stack_pointer[-2 - (((oparg & 1) == 1) ? 1 : 0)] = xx;
1108- if (oparg & 2) stack_pointer[-1 - (((oparg & 1) == 1) ? 1 : 0)] = output;
1109- stack_pointer[-1 - (((oparg & 1) == 1) ? 1 : 0) + ((oparg & 2) ? 1 : 0)] = zz;
1110- stack_pointer += -(((oparg & 1) == 1) ? 1 : 0) + ((oparg & 2) ? 1 : 0);
1111- assert(WITHIN_STACK_BOUNDS());
1112- DISPATCH();
1113- }
1114- """
1115- self .run_cases_test (input , output )
1116-
1117- def test_macro_cond_effect (self ):
1118- input = """
1119- op(A, (left, middle, right --)) {
1120- USE(left, middle, right);
1121- INPUTS_DEAD();
1122- }
1123- op(B, (-- deep, extra if (oparg), res)) {
1124- deep = -1;
1125- res = 0;
1126- extra = 1;
1127- INPUTS_DEAD();
1128- }
1129- macro(M) = A + B;
1130- """
1131- output = """
1132- TARGET(M) {
1133- #if Py_TAIL_CALL_INTERP
1134- int opcode = M;
1135- (void)(opcode);
1136- #endif
1137- frame->instr_ptr = next_instr;
1138- next_instr += 1;
1139- INSTRUCTION_STATS(M);
1140- _PyStackRef left;
1141- _PyStackRef middle;
1142- _PyStackRef right;
1143- _PyStackRef deep;
1144- _PyStackRef extra = PyStackRef_NULL;
1145- _PyStackRef res;
1146- // A
1147- {
1148- right = stack_pointer[-1];
1149- middle = stack_pointer[-2];
1150- left = stack_pointer[-3];
1151- USE(left, middle, right);
1152- }
1153- // B
1154- {
1155- deep = -1;
1156- res = 0;
1157- extra = 1;
1158- }
1159- stack_pointer[-3] = deep;
1160- if (oparg) stack_pointer[-2] = extra;
1161- stack_pointer[-2 + ((oparg) ? 1 : 0)] = res;
1162- stack_pointer += -1 + ((oparg) ? 1 : 0);
1163- assert(WITHIN_STACK_BOUNDS());
1164- DISPATCH();
1165- }
1166- """
1167- self .run_cases_test (input , output )
1168-
11691044 def test_macro_push_push (self ):
11701045 input = """
11711046 op(A, (-- val1)) {
0 commit comments