[pypy-commit] stmgc default: "Implement" the recent addition to the c7 interface, with XXXes

arigo noreply at buildbot.pypy.org
Fri Mar 14 08:01:22 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r1000:3281d387fbf5
Date: 2014-03-14 08:01 +0100
http://bitbucket.org/pypy/stmgc/changeset/3281d387fbf5/

Log:	"Implement" the recent addition to the c7 interface, with XXXes

diff --git a/gil-c7/stmgc.c b/gil-c7/stmgc.c
--- a/gil-c7/stmgc.c
+++ b/gil-c7/stmgc.c
@@ -167,6 +167,11 @@
             (char *)obj < _stm_nursery_end);
 }
 
+long stm_can_move(object_t *obj)
+{
+    return _is_in_nursery(obj);
+}
+
 #define GCWORD_MOVED  ((object_t *) -42)
 
 static void minor_trace_if_young(object_t **pobj)
@@ -264,8 +269,9 @@
     memset(_stm_nursery_base, 0, NURSERY_SIZE);
 }
 
-void do_minor_collect(void)
+void stm_collect(long level)
 {
+    /* 'level' is ignored, only minor collections are implemented */
     collect_roots_in_nursery();
     collect_oldrefs_to_nursery();
     throw_away_nursery();
@@ -275,7 +281,7 @@
 {
     /* run minor collection */
     //fprintf(stderr, "minor collect\n");
-    do_minor_collect();
+    stm_collect(0);
 
     char *p = _stm_nursery_current;
     char *end = p + size_rounded_up;
diff --git a/gil-c7/stmgc.h b/gil-c7/stmgc.h
--- a/gil-c7/stmgc.h
+++ b/gil-c7/stmgc.h
@@ -70,18 +70,19 @@
 
 void stm_setup(void);
 void stm_teardown(void);
+void stm_collect(long level);
 
 inline static void stm_start_inevitable_transaction(stm_thread_local_t *tl) {
     if (pthread_mutex_lock(&_stm_gil) != 0) abort();
     _stm_tloc = tl;
 }
-void do_minor_collect(void);
 inline static void stm_commit_transaction(void) {
-    do_minor_collect();
+    stm_collect(0);
     _stm_tloc = NULL;
     if (pthread_mutex_unlock(&_stm_gil) != 0) abort();
 }
 inline static void stm_become_inevitable(const char *msg) { }
+static inline int stm_is_inevitable(void) { return 1; }
 inline static void stm_read(object_t *ob) { }
 
 void _stm_write_slowpath(object_t *);
@@ -92,6 +93,7 @@
 }
 
 inline static char *_stm_real_address(object_t *ob) { return (char *)ob; }
+static inline void stm_safe_point(void) { }
 
 #define STM_START_TRANSACTION(tl, here)   do {  \
     (void)&(here);                              \
@@ -105,8 +107,26 @@
 extern ssize_t stmcb_size_rounded_up(struct object_s *);
 extern void stmcb_trace(struct object_s *, void (object_t **));
 
-inline static object_t *stm_setup_prebuilt(object_t *preb)
-{
+inline static object_t *stm_setup_prebuilt(object_t *preb) {
     preb->gil_flags |= _STM_GCFLAG_WRITE_BARRIER;
     return preb;
 }
+inline static object_t *stm_setup_prebuilt_weakref(object_t *preb) {
+    return stm_setup_prebuilt(preb);
+}
+
+inline static long stm_identityhash(object_t *obj) {
+    return (long)obj;   // XXX fails after a minor collection
+}
+inline static long stm_id(object_t *obj) {
+    return (long)obj;
+}
+inline static void stm_set_prebuilt_identityhash(object_t *obj, long hash) {
+    // XXX ignored
+}
+long stm_can_move(object_t *);
+
+inline static void stm_call_on_abort(stm_thread_local_t *tl, void *key,
+                                     void callback(void *)) {
+    // XXX ignored
+}


More information about the pypy-commit mailing list