Skip to content

Commit 93d4119

Browse files
committed
Drop unused custom incref/decref
1 parent 6aa92c1 commit 93d4119

File tree

1 file changed

+0
-46
lines changed

1 file changed

+0
-46
lines changed

src/runtime/Runtime.cs

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -598,23 +598,8 @@ internal static void CheckExceptionOccurred()
598598
[Obsolete("Use NewReference or PyObject constructor instead")]
599599
internal static unsafe void XIncref(BorrowedReference op)
600600
{
601-
#if !CUSTOM_INCDEC_REF
602601
Py_IncRef(op);
603602
return;
604-
#else
605-
var p = (void*)op;
606-
if ((void*)0 != p)
607-
{
608-
if (Is32Bit)
609-
{
610-
(*(int*)p)++;
611-
}
612-
else
613-
{
614-
(*(long*)p)++;
615-
}
616-
}
617-
#endif
618603
}
619604

620605
internal static unsafe void XDecref(StolenReference op)
@@ -623,40 +608,9 @@ internal static unsafe void XDecref(StolenReference op)
623608
Debug.Assert(op == null || Refcount(new BorrowedReference(op.Pointer)) > 0);
624609
Debug.Assert(_isInitialized || Py_IsInitialized() != 0 || _Py_IsFinalizing() != false);
625610
#endif
626-
#if !CUSTOM_INCDEC_REF
627611
if (op == null) return;
628612
Py_DecRef(op.AnalyzerWorkaround());
629613
return;
630-
#else
631-
var p = (void*)op;
632-
if ((void*)0 != p)
633-
{
634-
if (Is32Bit)
635-
{
636-
--(*(int*)p);
637-
}
638-
else
639-
{
640-
--(*(long*)p);
641-
}
642-
if ((*(int*)p) == 0)
643-
{
644-
// PyObject_HEAD: struct _typeobject *ob_type
645-
void* t = Is32Bit
646-
? (void*)(*((uint*)p + 1))
647-
: (void*)(*((ulong*)p + 1));
648-
// PyTypeObject: destructor tp_dealloc
649-
void* f = Is32Bit
650-
? (void*)(*((uint*)t + 6))
651-
: (void*)(*((ulong*)t + 6));
652-
if ((void*)0 == f)
653-
{
654-
return;
655-
}
656-
NativeCall.Void_Call_1(new IntPtr(f), op);
657-
}
658-
}
659-
#endif
660614
}
661615

662616
[Pure]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy