[pypy-commit] stmgc c7-refactor: Compilation fixes

arigo noreply at buildbot.pypy.org
Mon Feb 17 14:11:07 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: c7-refactor
Changeset: r757:815b5b0f11f1
Date: 2014-02-17 14:10 +0100
http://bitbucket.org/pypy/stmgc/changeset/815b5b0f11f1/

Log:	Compilation fixes

diff --git a/c7/stm/contention.c b/c7/stm/contention.c
--- a/c7/stm/contention.c
+++ b/c7/stm/contention.c
@@ -9,7 +9,7 @@
        holds the write lock on an object.  The current thread tries
        to do either a write or a read on it. */
 
-    assert_has_mutex();
+    assert(_has_mutex());
     assert(other_segment_num != STM_SEGMENT->segment_num);
 
     /* Who should abort here: this thread, or the other thread? */
diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -55,6 +55,11 @@
 /************************************************************/
 
 
+static void minor_trace_if_young(object_t **pobj)
+{
+    //...
+    abort();
+}
 
 static void minor_trace_roots(void)
 {
@@ -85,7 +90,7 @@
 {
     /* all other threads are paused in safe points during the whole
        minor collection */
-    assert_has_mutex();
+    assert(_has_mutex());
 
     minor_trace_roots();
 
@@ -119,7 +124,7 @@
     /* We just waited here, either from mutex_lock() or from cond_wait(),
        so we should check again if another thread did the minor
        collection itself */
-    if (nursery_ctl.used + bytes <= NURSERY_SIZE)
+    if (nursery_ctl.used + request_size <= NURSERY_SIZE)
         goto exit;
 
     if (!try_wait_for_other_safe_points(SP_SAFE_POINT_CAN_COLLECT))
@@ -163,7 +168,7 @@
     STM_SEGMENT->nursery_current -= size_rounded_up;  /* restore correct val */
 
     if (collectable_safe_point())
-        return stm_allocate(size_rounded_up);
+        return (stm_char *)stm_allocate(size_rounded_up);
 
     if (size_rounded_up < MEDIUM_OBJECT) {
         /* This is a small object.  The current section is really full.
diff --git a/c7/stm/sync.c b/c7/stm/sync.c
--- a/c7/stm/sync.c
+++ b/c7/stm/sync.c
@@ -76,9 +76,9 @@
     }
 }
 
-static inline void assert_has_mutex(void)
+static inline bool _has_mutex(void)
 {
-    assert(pthread_mutex_trylock(&sync_ctl.global_mutex) == EBUSY);
+    return pthread_mutex_trylock(&sync_ctl.global_mutex) == EBUSY;
 }
 
 static inline void cond_wait(void)
@@ -110,7 +110,7 @@
 {
     /* This function acquires a segment for the currently running thread,
        and set up the GS register if it changed. */
-    assert_has_mutex();
+    assert(_has_mutex());
     assert(_is_tl_registered(tl));
 
  retry:;
@@ -145,7 +145,7 @@
 
 static void release_thread_segment(stm_thread_local_t *tl)
 {
-    assert_has_mutex();
+    assert(_has_mutex());
 
     assert(STM_SEGMENT->running_thread == tl);
     STM_SEGMENT->running_thread = NULL;
@@ -215,7 +215,7 @@
        try_wait_for_other_safe_points() while another is currently blocked
        in the cond_wait() in this same function.
     */
-    assert_has_mutex();
+    assert(_has_mutex());
     assert(STM_PSEGMENT->safe_point == SP_SAFE_POINT_CAN_COLLECT);
 
     long i;
@@ -247,9 +247,9 @@
         if (i == STM_SEGMENT->segment_num)
             continue;    /* ignore myself */
 
-        struct stm_priv_segment_info_s *other_pseg = get_priv_segment(i);
-        if (other_pseg->v_nursery_section_end == NSE_SIGNAL)
-            other_pseg->v_nursery_section_end = NSE_SIGNAL_DONE;
+        struct stm_segment_info_s *other_seg = get_segment(i);
+        if (other_seg->v_nursery_section_end == NSE_SIGNAL)
+            other_seg->v_nursery_section_end = NSE_SIGNAL_DONE;
     }
     cond_broadcast();   /* to wake up the other threads, but later,
                            when they get the mutex again */
diff --git a/c7/stm/sync.h b/c7/stm/sync.h
--- a/c7/stm/sync.h
+++ b/c7/stm/sync.h
@@ -8,6 +8,7 @@
 static void mutex_unlock(void);
 static void cond_wait(void);
 static void cond_broadcast(void);
+static bool _has_mutex(void);
 
 /* acquire and release one of the segments for running the given thread
    (must have the mutex acquired!) */
diff --git a/c7/stmgc.h b/c7/stmgc.h
--- a/c7/stmgc.h
+++ b/c7/stmgc.h
@@ -185,7 +185,7 @@
     stm_char *p = STM_SEGMENT->nursery_current;
     stm_char *end = p + size_rounded_up;
     STM_SEGMENT->nursery_current = end;
-    if (UNLIKELY((uintptr_t)end > STM_SEGMENT->nursery_section_end))
+    if (UNLIKELY((uintptr_t)end > STM_SEGMENT->v_nursery_section_end))
         p = _stm_allocate_slowpath(size_rounded_up);
     return (object_t *)p;
 }


More information about the pypy-commit mailing list