@@ -783,6 +783,7 @@ _Py_uop_sym_get_type(JitOptRef ref)
783783 case JIT_SYM_NON_NULL_TAG :
784784 case JIT_SYM_UNKNOWN_TAG :
785785 case JIT_SYM_RECORDED_TYPE_TAG :
786+ case JIT_SYM_RECORDED_GEN_FUNC_TAG :
786787 return NULL ;
787788 case JIT_SYM_RECORDED_VALUE_TAG :
788789 if (sym -> recorded_value .known_type ) {
@@ -804,8 +805,6 @@ _Py_uop_sym_get_type(JitOptRef ref)
804805 return & PyBool_Type ;
805806 case JIT_SYM_COMPACT_INT :
806807 return & PyLong_Type ;
807- case JIT_SYM_RECORDED_GEN_FUNC_TAG :
808- return & PyGen_Type ;
809808 }
810809 Py_UNREACHABLE ();
811810}
@@ -830,7 +829,7 @@ _Py_uop_sym_get_probable_type(JitOptRef ref)
830829 case JIT_SYM_KNOWN_VALUE_TAG :
831830 return _Py_uop_sym_get_type (ref );
832831 case JIT_SYM_RECORDED_GEN_FUNC_TAG :
833- return NULL ;
832+ return & PyGen_Type ;
834833 case JIT_SYM_RECORDED_VALUE_TAG :
835834 return Py_TYPE (sym -> recorded_value .value );
836835 case JIT_SYM_RECORDED_TYPE_TAG :
@@ -2211,21 +2210,24 @@ _Py_uop_symbols_test(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(ignored))
22112210 /* Test that recorded type aren't treated as known values*/
22122211 JitOptRef rg1 = _Py_uop_sym_new_unknown (ctx );
22132212 _Py_uop_sym_set_recorded_gen_func (ctx , rg1 , func );
2214- TEST_PREDICATE (_Py_uop_sym_matches_type (rg1 , & PyGen_Type ), "recorded gen func not treated as generator" );
2213+ TEST_PREDICATE (!_Py_uop_sym_matches_type (rg1 , & PyGen_Type ), "recorded gen func treated as generator" );
2214+ TEST_PREDICATE (_Py_uop_sym_get_probable_type (rg1 ) == & PyGen_Type , "recorded gen func not treated as generator" );
22152215 TEST_PREDICATE (_Py_uop_sym_get_const (ctx , rg1 ) == NULL , "recorded gen func is treated as known value" );
22162216
22172217 /* Test that setting type narrows correctly */
22182218
22192219 JitOptRef rg2 = _Py_uop_sym_new_unknown (ctx );
22202220 _Py_uop_sym_set_recorded_gen_func (ctx , rg2 , func );
22212221 _Py_uop_sym_set_type (ctx , rg2 , & PyGen_Type );
2222- TEST_PREDICATE (_Py_uop_sym_matches_type (rg1 , & PyGen_Type ), "recorded gen func not treated as generator" );
2222+ TEST_PREDICATE (!_Py_uop_sym_matches_type (rg2 , & PyGen_Type ), "recorded gen func treated as generator" );
2223+ TEST_PREDICATE (_Py_uop_sym_get_probable_type (rg2 ) == & PyGen_Type , "recorded gen func not treated as generator" );
22232224 TEST_PREDICATE (_Py_uop_sym_get_const (ctx , rg2 ) == NULL , "known type is treated as known value" );
22242225
22252226 JitOptRef rg3 = _Py_uop_sym_new_unknown (ctx );
22262227 _Py_uop_sym_set_recorded_gen_func (ctx , rg3 , func );
22272228 _Py_uop_sym_set_type_version (ctx , rg3 , PyGen_Type .tp_version_tag );
2228- TEST_PREDICATE (_Py_uop_sym_matches_type (rg1 , & PyGen_Type ), "recorded gen func not treated as generator" );
2229+ TEST_PREDICATE (!_Py_uop_sym_matches_type (rg3 , & PyGen_Type ), "recorded gen func treated as generator" );
2230+ TEST_PREDICATE (_Py_uop_sym_get_probable_type (rg3 ) == & PyGen_Type , "recorded gen func not treated as generator" );
22292231 TEST_PREDICATE (_Py_uop_sym_get_const (ctx , rg3 ) == NULL , "recorded value with type is treated as known" );
22302232
22312233 /* Test contradictions */
0 commit comments