Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
a2b11ecb
Kaydet (Commit)
a2b11ecb
authored
May 21, 2002
tarafından
Neil Schemenauer
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add IS_TRACKED and IS_MOVED macros. This makes the logic a little more clear.
üst
0ebac970
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
gcmodule.c
Modules/gcmodule.c
+10
-7
No files found.
Modules/gcmodule.c
Dosyayı görüntüle @
a2b11ecb
...
@@ -28,6 +28,8 @@
...
@@ -28,6 +28,8 @@
/* Get the object given the GC head */
/* Get the object given the GC head */
#define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g)+1))
#define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g)+1))
/* True if an object is tracked by the GC */
#define IS_TRACKED(o) ((AS_GC(o))->gc.gc_next != NULL)
/*** Global GC state ***/
/*** Global GC state ***/
...
@@ -73,6 +75,9 @@ static int debug;
...
@@ -73,6 +75,9 @@ static int debug;
/* Special gc_refs value */
/* Special gc_refs value */
#define GC_MOVED -123
#define GC_MOVED -123
/* True if an object has been moved to the older generation */
#define IS_MOVED(o) ((AS_GC(o))->gc.gc_refs == GC_MOVED)
/* list of uncollectable objects */
/* list of uncollectable objects */
static
PyObject
*
garbage
;
static
PyObject
*
garbage
;
...
@@ -170,8 +175,7 @@ static int
...
@@ -170,8 +175,7 @@ static int
visit_decref
(
PyObject
*
op
,
void
*
data
)
visit_decref
(
PyObject
*
op
,
void
*
data
)
{
{
if
(
op
&&
PyObject_IS_GC
(
op
))
{
if
(
op
&&
PyObject_IS_GC
(
op
))
{
PyGC_Head
*
gc
=
AS_GC
(
op
);
if
(
IS_TRACKED
(
op
))
if
(
gc
->
gc
.
gc_next
!=
NULL
)
AS_GC
(
op
)
->
gc
.
gc_refs
--
;
AS_GC
(
op
)
->
gc
.
gc_refs
--
;
}
}
return
0
;
return
0
;
...
@@ -212,8 +216,8 @@ static int
...
@@ -212,8 +216,8 @@ static int
visit_move
(
PyObject
*
op
,
PyGC_Head
*
tolist
)
visit_move
(
PyObject
*
op
,
PyGC_Head
*
tolist
)
{
{
if
(
PyObject_IS_GC
(
op
))
{
if
(
PyObject_IS_GC
(
op
))
{
PyGC_Head
*
gc
=
AS_GC
(
op
);
if
(
IS_TRACKED
(
op
)
&&
!
IS_MOVED
(
op
))
{
if
(
gc
->
gc
.
gc_next
!=
NULL
&&
gc
->
gc
.
gc_refs
!=
GC_MOVED
)
{
PyGC_Head
*
gc
=
AS_GC
(
op
);
gc_list_remove
(
gc
);
gc_list_remove
(
gc
);
gc_list_append
(
gc
,
tolist
);
gc_list_append
(
gc
,
tolist
);
gc
->
gc
.
gc_refs
=
GC_MOVED
;
gc
->
gc
.
gc_refs
=
GC_MOVED
;
...
@@ -856,8 +860,7 @@ void
...
@@ -856,8 +860,7 @@ void
PyObject_GC_UnTrack
(
void
*
op
)
PyObject_GC_UnTrack
(
void
*
op
)
{
{
#ifdef WITH_CYCLE_GC
#ifdef WITH_CYCLE_GC
PyGC_Head
*
gc
=
AS_GC
(
op
);
if
(
IS_TRACKED
(
op
))
if
(
gc
->
gc
.
gc_next
!=
NULL
)
_PyObject_GC_UNTRACK
(
op
);
_PyObject_GC_UNTRACK
(
op
);
#endif
#endif
}
}
...
@@ -941,7 +944,7 @@ PyObject_GC_Del(void *op)
...
@@ -941,7 +944,7 @@ PyObject_GC_Del(void *op)
{
{
#ifdef WITH_CYCLE_GC
#ifdef WITH_CYCLE_GC
PyGC_Head
*
g
=
AS_GC
(
op
);
PyGC_Head
*
g
=
AS_GC
(
op
);
if
(
g
->
gc
.
gc_next
!=
NULL
)
if
(
IS_TRACKED
(
op
)
)
gc_list_remove
(
g
);
gc_list_remove
(
g
);
if
(
generations
[
0
].
count
>
0
)
{
if
(
generations
[
0
].
count
>
0
)
{
generations
[
0
].
count
--
;
generations
[
0
].
count
--
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment