@@ -514,18 +514,7 @@ def emit_inc_ref(self, dest: str, rtype: RType, *, rare: bool = False) -> None:
514514 elif not rtype .is_unboxed :
515515 # Always inline, since this is a simple but very hot op
516516 if rtype .may_be_immortal or not HAVE_IMMORTAL :
517- if (
518- HAVE_IMMORTAL
519- and (opt := optional_value_type (rtype ))
520- and not opt .may_be_immortal
521- ):
522- # Optimized incref of optional type avoids reading reference count
523- # if value is None (None is immortal)
524- self .emit_line (f"if ({ dest } != Py_None) {{" )
525- self .emit_line (f"CPy_INCREF_NO_IMM({ dest } );" )
526- self .emit_line ("}" )
527- else :
528- self .emit_line ("CPy_INCREF(%s);" % dest )
517+ self .emit_line ("CPy_INCREF(%s);" % dest )
529518 else :
530519 self .emit_line ("CPy_INCREF_NO_IMM(%s);" % dest )
531520 # Otherwise assume it's an unboxed, pointerless value and do nothing.
@@ -556,18 +545,7 @@ def emit_dec_ref(
556545 else :
557546 # Inlined
558547 if rtype .may_be_immortal or not HAVE_IMMORTAL :
559- if (
560- HAVE_IMMORTAL
561- and (opt := optional_value_type (rtype ))
562- and not opt .may_be_immortal
563- ):
564- # Optimized decref of optional type avoids reading reference count
565- # if value is None (None is immortal)
566- self .emit_line (f"if ({ dest } != Py_None) {{" )
567- self .emit_line (f"CPy_{ x } DECREF_NO_IMM({ dest } );" )
568- self .emit_line ("}" )
569- else :
570- self .emit_line (f"CPy_{ x } DECREF({ dest } );" )
548+ self .emit_line (f"CPy_{ x } DECREF({ dest } );" )
571549 else :
572550 self .emit_line (f"CPy_{ x } DECREF_NO_IMM({ dest } );" )
573551 # Otherwise assume it's an unboxed, pointerless value and do nothing.
0 commit comments