[pypy-commit] pypy stm-thread-2: Random initial tweaks.

arigo noreply at buildbot.pypy.org
Mon Sep 3 19:45:13 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread-2
Changeset: r57104:8b836d5d5fdb
Date: 2012-09-03 17:14 +0200
http://bitbucket.org/pypy/pypy/changeset/8b836d5d5fdb/

Log:	Random initial tweaks.

diff --git a/pypy/translator/c/funcgen.py b/pypy/translator/c/funcgen.py
--- a/pypy/translator/c/funcgen.py
+++ b/pypy/translator/c/funcgen.py
@@ -603,16 +603,9 @@
             from pypy.translator.stm.funcgen import op_stm
             self.__class__.op_stm = op_stm
         return self.op_stm(op)
-    OP_STM_GETFIELD = _OP_STM
-    OP_STM_SETFIELD = _OP_STM
-    OP_STM_GETARRAYITEM = _OP_STM
-    OP_STM_SETARRAYITEM = _OP_STM
-    OP_STM_GETINTERIORFIELD = _OP_STM
-    OP_STM_SETINTERIORFIELD = _OP_STM
     OP_STM_BECOME_INEVITABLE = _OP_STM
-    OP_STM_GC_LOAD = _OP_STM
-    OP_STM_GC_STORE = _OP_STM
-    OP_STM_JIT_INVOKE_CODE = _OP_STM
+    OP_STM_BARRIER = _OP_STM
+    OP_STM_PTR_EQ = _OP_STM
 
 
     def OP_PTR_NONZERO(self, op):
diff --git a/pypy/translator/stm/src_stm/et.h b/pypy/translator/stm/src_stm/et.h
--- a/pypy/translator/stm/src_stm/et.h
+++ b/pypy/translator/stm/src_stm/et.h
@@ -14,87 +14,71 @@
 #ifndef _ET_H
 #define _ET_H
 
-#include <stddef.h>
-#include <stdint.h>
 #include <setjmp.h>
 
 
-#define GCFLAG_GLOBAL              0x10000
-#define GCFLAG_POSSIBLY_OUTDATED   0x20000
-#define GCFLAG_NOT_WRITTEN         0x40000
+/* These are partly the same flags as defined in stmgc.py.  Keep in sync! */
+enum {
+  _first_gcflag            = 1L << (PYPY_LONG_BIT / 2),
+  GCFLAG_GLOBAL            = _first_gcflag << 0,
+  GCFLAG_POSSIBLY_OUTDATED = _first_gcflag << 1,
+  GCFLAG_NOT_WRITTEN       = _first_gcflag << 2,
 
-#define GCFLAG_PREBUILT            (GCFLAG_GLOBAL|GCFLAG_NOT_WRITTEN)
-#define REV_INITIAL                1
+  GCFLAG_PREBUILT          = GCFLAG_GLOBAL|GCFLAG_NOT_WRITTEN,
+  REV_INITIAL              = 1
+};
 
-typedef uintptr_t revision_t;
+typedef struct pypy_header0 *gcptr;
+/*declared in structdef.h as {
+    Signed h_tid;
+    void *h_revision;
+}*/
 
-typedef struct pypy_header0 {
-    long h_tid;
-    revision_t h_revision;
-} *gcptr;
-
-
-#define STM_READ_BARRIER_P(P)                                           \
+#define STM_BARRIER_P2R(P)                                              \
     (__builtin_expect((((gcptr)(P))->h_tid & GCFLAG_GLOBAL) == 0, 1) ?  \
      (P) : (typeof(P))_DirectReadBarrier((gcptr)(P)))
 
-#define STM_READ_BARRIER_P_FROM_R(P, R_container, offset)               \
+#define STM_BARRIER_G2R(G)                                          \
+    (assert(((gcptr)(G))->h_tid & GCFLAG_GLOBAL),                   \
+     (typeof(G))_DirectReadBarrier((gcptr)(G)))
+
+/*#define STM_READ_BARRIER_P_FROM_R(P, R_container, offset)             \
     (__builtin_expect((((gcptr)(P))->h_tid & GCFLAG_GLOBAL) == 0, 1) ?  \
      (P) : (typeof(P))_DirectReadBarrierFromR((gcptr)(P),               \
                                               (gcptr)(R_container),     \
-                                              offset))
+                                              offset))*/
 
-#define STM_WRITE_BARRIER_P(R)                                          \
-    (__builtin_expect((((gcptr)(R))->h_tid & GCFLAG_NOT_WRITTEN) == 0, 1) ? \
-     (R) : (typeof(R))_WriteBarrier((gcptr)(R)))
+#define STM_BARRIER_P2W(P)                                                  \
+    (__builtin_expect((((gcptr)(P))->h_tid & GCFLAG_NOT_WRITTEN) == 0, 1) ? \
+     (P) : (typeof(P))_WriteBarrier((gcptr)(P)))
 
-#define STM_WRITE_BARRIER_R(R)                                          \
+#define STM_BARRIER_R2W(R)                                                  \
     (__builtin_expect((((gcptr)(R))->h_tid & GCFLAG_NOT_WRITTEN) == 0, 1) ? \
      (R) : (typeof(R))_WriteBarrierFromReady((gcptr)(R)))
 
-#define STM_NONTRANSACTIONAL_READ_BARRIER(P)                            \
-    ((typeof(P))_NonTransactionalReadBarrier((gcptr)(P)))
-
-#define _REACH(P) _FakeReach((gcptr)(P))
-
-#define BEGIN_TRANSACTION                         \
-  {                                               \
-    jmp_buf _jmpbuf;                              \
-    setjmp(_jmpbuf);                              \
-    BeginTransaction(&_jmpbuf);                   \
-    {
-
-#define END_TRANSACTION                           \
-    }                                             \
-    CommitTransaction();                          \
-  }
-#define _END_TRANSACTION_NUM(t)                   \
-    }                                             \
-    t = CommitTransaction();                      \
-  }
-
+/* declared in structdef.h:
 struct gcroot_s {
     gcptr R, L;
-    revision_t v;
-};
+    Signed v;
+};*/
 
 void BeginTransaction(jmp_buf *);
 struct gcroot_s *FindRootsForLocalCollect(void);
 int _FakeReach(gcptr);
-revision_t CommitTransaction(void);
+void CommitTransaction(void);
 void BecomeInevitable(void);
 //void BeginInevitableTransaction(void);
-revision_t DescriptorInit(void);
+void DescriptorInit(void);
 void DescriptorDone(void);
 
-gcptr Allocate(size_t size, int gctid);
+//gcptr Allocate(size_t size, int gctid);
 _Bool PtrEq(gcptr P1, gcptr P2);
 
 gcptr _DirectReadBarrier(gcptr);
 gcptr _DirectReadBarrierFromR(gcptr, gcptr, size_t);
 gcptr _WriteBarrier(gcptr);
 gcptr _WriteBarrierFromReady(gcptr);
-gcptr _NonTransactionalReadBarrier(gcptr);
+//gcptr _NonTransactionalReadBarrier(gcptr);
 
 
 extern size_t pypy_g__stm_getsize(gcptr);


More information about the pypy-commit mailing list