@@ -104,18 +104,16 @@ dummy_func(void) {
104104 res = sym_new_null (ctx );
105105 }
106106
107- op (_GUARD_TOS_INT , (tos -- tos )) {
107+ op (_GUARD_TOS_INT , (tos -- type ( & PyLong_Type ) tos )) {
108108 if (sym_matches_type (tos , & PyLong_Type )) {
109109 REPLACE_OP (this_instr , _NOP , 0 , 0 );
110110 }
111- sym_set_type (tos , & PyLong_Type );
112111 }
113112
114- op (_GUARD_NOS_INT , (nos , unused -- nos , unused )) {
113+ op (_GUARD_NOS_INT , (nos , unused -- type ( & PyLong_Type ) nos , unused )) {
115114 if (sym_matches_type (nos , & PyLong_Type )) {
116115 REPLACE_OP (this_instr , _NOP , 0 , 0 );
117116 }
118- sym_set_type (nos , & PyLong_Type );
119117 }
120118
121119 op (_GUARD_TYPE_VERSION , (type_version /2 , owner -- owner )) {
@@ -141,18 +139,16 @@ dummy_func(void) {
141139 }
142140 }
143141
144- op (_GUARD_TOS_FLOAT , (tos -- tos )) {
142+ op (_GUARD_TOS_FLOAT , (tos -- type ( & PyFloat_Type ) tos )) {
145143 if (sym_matches_type (tos , & PyFloat_Type )) {
146144 REPLACE_OP (this_instr , _NOP , 0 , 0 );
147145 }
148- sym_set_type (tos , & PyFloat_Type );
149146 }
150147
151- op (_GUARD_NOS_FLOAT , (nos , unused -- nos , unused )) {
148+ op (_GUARD_NOS_FLOAT , (nos , unused -- type ( & PyFloat_Type ) nos , unused )) {
152149 if (sym_matches_type (nos , & PyFloat_Type )) {
153150 REPLACE_OP (this_instr , _NOP , 0 , 0 );
154151 }
155- sym_set_type (nos , & PyFloat_Type );
156152 }
157153
158154 op (_BINARY_OP , (left , right -- res )) {
@@ -408,18 +404,16 @@ dummy_func(void) {
408404 }
409405 }
410406
411- op (_GUARD_NOS_UNICODE , (nos , unused -- nos , unused )) {
407+ op (_GUARD_NOS_UNICODE , (nos , unused -- type ( & PyUnicode_Type ) nos , unused )) {
412408 if (sym_matches_type (nos , & PyUnicode_Type )) {
413409 REPLACE_OP (this_instr , _NOP , 0 , 0 );
414410 }
415- sym_set_type (nos , & PyUnicode_Type );
416411 }
417412
418- op (_GUARD_TOS_UNICODE , (value -- value )) {
413+ op (_GUARD_TOS_UNICODE , (value -- type ( & PyUnicode_Type ) value )) {
419414 if (sym_matches_type (value , & PyUnicode_Type )) {
420415 REPLACE_OP (this_instr , _NOP , 0 , 0 );
421416 }
422- sym_set_type (value , & PyUnicode_Type );
423417 }
424418
425419 op (_TO_BOOL_STR , (value -- res )) {
@@ -429,8 +423,7 @@ dummy_func(void) {
429423 }
430424 }
431425
432- op (_UNARY_NOT , (value -- res )) {
433- sym_set_type (value , & PyBool_Type );
426+ op (_UNARY_NOT , (type (& PyBool_Type ) value -- res )) {
434427 res = sym_new_truthiness (ctx , value , false);
435428 }
436429
@@ -631,13 +624,12 @@ dummy_func(void) {
631624 self_or_null = sym_new_not_null (ctx );
632625 }
633626
634- op (_CHECK_FUNCTION_VERSION , (func_version /2 , callable , self_or_null , unused [oparg ] -- callable , self_or_null , unused [oparg ])) {
627+ op (_CHECK_FUNCTION_VERSION , (func_version /2 , callable , self_or_null , unused [oparg ] -- type ( & PyFunction_Type ) callable , self_or_null , unused [oparg ])) {
635628 if (sym_is_const (ctx , callable ) && sym_matches_type (callable , & PyFunction_Type )) {
636629 assert (PyFunction_Check (sym_get_const (ctx , callable )));
637630 REPLACE_OP (this_instr , _CHECK_FUNCTION_VERSION_INLINE , 0 , func_version );
638631 this_instr -> operand1 = (uintptr_t )sym_get_const (ctx , callable );
639632 }
640- sym_set_type (callable , & PyFunction_Type );
641633 }
642634
643635 op (_CHECK_FUNCTION_EXACT_ARGS , (callable , self_or_null , unused [oparg ] -- callable , self_or_null , unused [oparg ])) {
@@ -653,9 +645,9 @@ dummy_func(void) {
653645 }
654646 }
655647
656- op (_CHECK_CALL_BOUND_METHOD_EXACT_ARGS , (callable , null , unused [oparg ] -- callable , null , unused [oparg ])) {
648+ op (_CHECK_CALL_BOUND_METHOD_EXACT_ARGS , (callable , null , unused [oparg ] -- type ( & PyMethod_Type ) callable , null , unused [oparg ])) {
657649 sym_set_null (null );
658- sym_set_type ( callable , & PyMethod_Type ) ;
650+ ( void ) callable ;
659651 }
660652
661653 op (_INIT_CALL_PY_EXACT_ARGS , (callable , self_or_null , args [oparg ] -- new_frame : _Py_UOpsAbstractFrame * )) {
@@ -977,46 +969,40 @@ dummy_func(void) {
977969 }
978970 }
979971
980- op (_GUARD_TOS_LIST , (tos -- tos )) {
972+ op (_GUARD_TOS_LIST , (tos -- type ( & PyList_Type ) tos )) {
981973 if (sym_matches_type (tos , & PyList_Type )) {
982974 REPLACE_OP (this_instr , _NOP , 0 , 0 );
983975 }
984- sym_set_type (tos , & PyList_Type );
985976 }
986977
987- op (_GUARD_NOS_LIST , (nos , unused -- nos , unused )) {
978+ op (_GUARD_NOS_LIST , (nos , unused -- type ( & PyList_Type ) nos , unused )) {
988979 if (sym_matches_type (nos , & PyList_Type )) {
989980 REPLACE_OP (this_instr , _NOP , 0 , 0 );
990981 }
991- sym_set_type (nos , & PyList_Type );
992982 }
993983
994- op (_GUARD_TOS_TUPLE , (tos -- tos )) {
984+ op (_GUARD_TOS_TUPLE , (tos -- type ( & PyTuple_Type ) tos )) {
995985 if (sym_matches_type (tos , & PyTuple_Type )) {
996986 REPLACE_OP (this_instr , _NOP , 0 , 0 );
997987 }
998- sym_set_type (tos , & PyTuple_Type );
999988 }
1000989
1001- op (_GUARD_NOS_TUPLE , (nos , unused -- nos , unused )) {
990+ op (_GUARD_NOS_TUPLE , (nos , unused -- type ( & PyTuple_Type ) nos , unused )) {
1002991 if (sym_matches_type (nos , & PyTuple_Type )) {
1003992 REPLACE_OP (this_instr , _NOP , 0 , 0 );
1004993 }
1005- sym_set_type (nos , & PyTuple_Type );
1006994 }
1007995
1008- op (_GUARD_TOS_DICT , (tos -- tos )) {
996+ op (_GUARD_TOS_DICT , (tos -- type ( & PyDict_Type ) tos )) {
1009997 if (sym_matches_type (tos , & PyDict_Type )) {
1010998 REPLACE_OP (this_instr , _NOP , 0 , 0 );
1011999 }
1012- sym_set_type (tos , & PyDict_Type );
10131000 }
10141001
1015- op (_GUARD_NOS_DICT , (nos , unused -- nos , unused )) {
1002+ op (_GUARD_NOS_DICT , (nos , unused -- type ( & PyDict_Type ) nos , unused )) {
10161003 if (sym_matches_type (nos , & PyDict_Type )) {
10171004 REPLACE_OP (this_instr , _NOP , 0 , 0 );
10181005 }
1019- sym_set_type (nos , & PyDict_Type );
10201006 }
10211007
10221008 op (_GUARD_TOS_ANY_SET , (tos -- tos )) {
@@ -1055,7 +1041,7 @@ dummy_func(void) {
10551041 sym_set_const (callable , (PyObject * )& PyUnicode_Type );
10561042 }
10571043
1058- op (_CALL_LEN , (callable [1 ], self_or_null [1 ], args [oparg ] -- res )) {
1044+ op (_CALL_LEN , (callable [1 ], self_or_null [1 ], args [oparg ] -- type ( res )) {
10591045 res = sym_new_type (ctx , & PyLong_Type );
10601046 }
10611047
0 commit comments