Author: Remi Meier
Branch: c7
Changeset: r690:4b722d20b830
Date: 2014-01-30 11:13 +0100
http://bitbucket.org/pypy/stmgc/changeset/4b722d20b830/

Log:    add a mode to duhton that removes read-barriers and makes write-
        barriers like normal GC write-barriers. Meaning there is no conflict
        detection going on and all pages will be SHARED at all times. There
        are still the start/stop_transaction calls left but their influence
        can be reduced by the program.

diff --git a/c7/stmsync.c b/c7/stmsync.c
--- a/c7/stmsync.c
+++ b/c7/stmsync.c
@@ -33,6 +33,12 @@
 {
     /* we must have the exclusive lock here and
        not the colletion lock!! */
+    /* XXX: for more than 2 threads, need a way
+       to signal other threads with need_major_collect
+       so that they don't leave COLLECT-safe-points
+       when this flag is set. Otherwise we simply
+       wait arbitrarily long until all threads reach
+       COLLECT-safe-points by chance at the same time. */
     while (1) {
         if (!rwticket_wrtrylock(&rw_collection_lock))
             break;              /* acquired! */
diff --git a/duhton/duhton.c b/duhton/duhton.c
--- a/duhton/duhton.c
+++ b/duhton/duhton.c
@@ -1,7 +1,6 @@
 #include <string.h>
 #include "duhton.h"
 
-#define DEFAULT_NUM_THREADS 2
 
 int main(int argc, char **argv)
 {
diff --git a/duhton/duhton.h b/duhton/duhton.h
--- a/duhton/duhton.h
+++ b/duhton/duhton.h
@@ -1,10 +1,16 @@
 #ifndef _DUHTON_H_
 #define _DUHTON_H_
 
-#include "../c7/core.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <assert.h>
+#include "../c7/core.h"
+#include "../c7/list.h"
+
+#define STM 1                   /* hackish removal of all read/write
+                                   barriers. synchronization is up to
+                                   the program */
+#define DEFAULT_NUM_THREADS 2   /* required by stm-c7 */
 
 
 struct DuObject_s {
@@ -173,8 +179,17 @@
                                   p1 = (typeof(p1))_pop_root())
 
 
+#if STM
 #define _du_read1(p1)           stm_read((object_t *)(p1))
 #define _du_write1(p1)          stm_write((object_t *)(p1))
+#else
+#define _du_read1(p1)
+#define _du_write1(p1)          {                                       \
+    if (UNLIKELY(((object_t *)(p1))->stm_flags & GCFLAG_WRITE_BARRIER)) { \
+        LIST_APPEND(_STM_TL->old_objects_to_trace, ((object_t *)(p1))); \
+        ((object_t *)(p1))->stm_flags &= ~GCFLAG_WRITE_BARRIER;         \
+    }}
+#endif
 
 
 #ifdef NDEBUG
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to