[pypy-commit] pypy stmgc-c7: import stmgc/e1df81263680 (branch card-marking)

arigo noreply at buildbot.pypy.org
Mon Jun 30 18:47:40 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: stmgc-c7
Changeset: r72293:6060a7db4b02
Date: 2014-06-30 17:58 +0200
http://bitbucket.org/pypy/pypy/changeset/6060a7db4b02/

Log:	import stmgc/e1df81263680 (branch card-marking)

diff --git a/rpython/translator/stm/src_stm/revision b/rpython/translator/stm/src_stm/revision
--- a/rpython/translator/stm/src_stm/revision
+++ b/rpython/translator/stm/src_stm/revision
@@ -1,1 +1,1 @@
-bde7c7634878
+e1df81263680
diff --git a/rpython/translator/stm/src_stm/stm/core.c b/rpython/translator/stm/src_stm/stm/core.c
--- a/rpython/translator/stm/src_stm/stm/core.c
+++ b/rpython/translator/stm/src_stm/stm/core.c
@@ -236,6 +236,23 @@
     return (size >= _STM_MIN_CARD_OBJ_SIZE);
 }
 
+char _stm_write_slowpath_card_extra(object_t *obj)
+{
+    /* the PyPy JIT calls this function directly if it finds that an
+       array doesn't have the GCFLAG_CARDS_SET */
+    bool mark_card = obj_should_use_cards(obj);
+    write_slowpath_common(obj, mark_card);
+    return mark_card;
+}
+
+char *_stm_write_slowpath_card_extra_base(void)
+{
+    /* for the PyPy JIT: _stm_write_slowpath_card_extra_base[obj >> 4]
+       is the byte that must be set to CARD_MARKED.  The logic below
+       does the same, but more explicitly. */
+    return (char *)write_locks - WRITELOCK_START + 1;
+}
+
 void _stm_write_slowpath_card(object_t *obj, uintptr_t index)
 {
     /* If CARDS_SET is not set so far, issue a normal write barrier.
@@ -243,8 +260,7 @@
        card marking instead.
     */
     if (!(obj->stm_flags & GCFLAG_CARDS_SET)) {
-        bool mark_card = obj_should_use_cards(obj);
-        write_slowpath_common(obj, mark_card);
+        char mark_card = _stm_write_slowpath_card_extra(obj);
         if (!mark_card)
             return;
     }
diff --git a/rpython/translator/stm/src_stm/stm/core.h b/rpython/translator/stm/src_stm/stm/core.h
--- a/rpython/translator/stm/src_stm/stm/core.h
+++ b/rpython/translator/stm/src_stm/stm/core.h
@@ -226,10 +226,10 @@
 static uint8_t write_locks[WRITELOCK_END - WRITELOCK_START];
 
 enum /* card values for write_locks */ {
-    CARD_CLEAR = 0,             /* card not used at all */
-    CARD_MARKED = 100,            /* card marked for tracing in the next gc */
-    CARD_MARKED_OLD = 101,        /* card was marked before, but cleared
-                                     in a GC */
+    CARD_CLEAR = 0,                 /* card not used at all */
+    CARD_MARKED = _STM_CARD_MARKED, /* card marked for tracing in the next gc */
+    CARD_MARKED_OLD = 101,          /* card was marked before, but cleared
+                                       in a GC */
 };
 
 
diff --git a/rpython/translator/stm/src_stm/stmgc.h b/rpython/translator/stm/src_stm/stmgc.h
--- a/rpython/translator/stm/src_stm/stmgc.h
+++ b/rpython/translator/stm/src_stm/stmgc.h
@@ -109,6 +109,9 @@
    but it's not exposed to C code so far */
 void _stm_write_slowpath(object_t *);
 void _stm_write_slowpath_card(object_t *, uintptr_t);
+char _stm_write_slowpath_card_extra(object_t *);
+char *_stm_write_slowpath_card_extra_base(void);
+#define _STM_CARD_MARKED 100
 object_t *_stm_allocate_slowpath(ssize_t);
 object_t *_stm_allocate_external(ssize_t);
 void _stm_become_inevitable(const char*);


More information about the pypy-commit mailing list