@@ -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 )
@@ -903,98 +903,6 @@ def test_array_error_if(self):
903903 """
904904 self .run_cases_test (input , output )
905905
906- def test_cond_effect (self ):
907- input = """
908- inst(OP, (aa, input if ((oparg & 1) == 1), cc -- xx, output if (oparg & 2), zz)) {
909- output = SPAM(oparg, aa, cc, input);
910- INPUTS_DEAD();
911- xx = 0;
912- zz = 0;
913- }
914- """
915- output = """
916- TARGET(OP) {
917- #if Py_TAIL_CALL_INTERP
918- int opcode = OP;
919- (void)(opcode);
920- #endif
921- frame->instr_ptr = next_instr;
922- next_instr += 1;
923- INSTRUCTION_STATS(OP);
924- _PyStackRef aa;
925- _PyStackRef input = PyStackRef_NULL;
926- _PyStackRef cc;
927- _PyStackRef xx;
928- _PyStackRef output = PyStackRef_NULL;
929- _PyStackRef zz;
930- cc = stack_pointer[-1];
931- if ((oparg & 1) == 1) { input = stack_pointer[-1 - (((oparg & 1) == 1) ? 1 : 0)]; }
932- aa = stack_pointer[-2 - (((oparg & 1) == 1) ? 1 : 0)];
933- output = SPAM(oparg, aa, cc, input);
934- xx = 0;
935- zz = 0;
936- stack_pointer[-2 - (((oparg & 1) == 1) ? 1 : 0)] = xx;
937- if (oparg & 2) stack_pointer[-1 - (((oparg & 1) == 1) ? 1 : 0)] = output;
938- stack_pointer[-1 - (((oparg & 1) == 1) ? 1 : 0) + ((oparg & 2) ? 1 : 0)] = zz;
939- stack_pointer += -(((oparg & 1) == 1) ? 1 : 0) + ((oparg & 2) ? 1 : 0);
940- assert(WITHIN_STACK_BOUNDS());
941- DISPATCH();
942- }
943- """
944- self .run_cases_test (input , output )
945-
946- def test_macro_cond_effect (self ):
947- input = """
948- op(A, (left, middle, right --)) {
949- USE(left, middle, right);
950- INPUTS_DEAD();
951- }
952- op(B, (-- deep, extra if (oparg), res)) {
953- deep = -1;
954- res = 0;
955- extra = 1;
956- INPUTS_DEAD();
957- }
958- macro(M) = A + B;
959- """
960- output = """
961- TARGET(M) {
962- #if Py_TAIL_CALL_INTERP
963- int opcode = M;
964- (void)(opcode);
965- #endif
966- frame->instr_ptr = next_instr;
967- next_instr += 1;
968- INSTRUCTION_STATS(M);
969- _PyStackRef left;
970- _PyStackRef middle;
971- _PyStackRef right;
972- _PyStackRef deep;
973- _PyStackRef extra = PyStackRef_NULL;
974- _PyStackRef res;
975- // A
976- {
977- right = stack_pointer[-1];
978- middle = stack_pointer[-2];
979- left = stack_pointer[-3];
980- USE(left, middle, right);
981- }
982- // B
983- {
984- deep = -1;
985- res = 0;
986- extra = 1;
987- }
988- stack_pointer[-3] = deep;
989- if (oparg) stack_pointer[-2] = extra;
990- stack_pointer[-2 + ((oparg) ? 1 : 0)] = res;
991- stack_pointer += -1 + ((oparg) ? 1 : 0);
992- assert(WITHIN_STACK_BOUNDS());
993- DISPATCH();
994- }
995- """
996- self .run_cases_test (input , output )
997-
998906 def test_macro_push_push (self ):
999907 input = """
1000908 op(A, (-- val1)) {
0 commit comments