[pypy-commit] stmgc default: fix for on-major-gc validation not doing anything when a transaction thought it was still uncommitted and inevitable

Raemi noreply at buildbot.pypy.org
Mon Feb 16 16:32:56 CET 2015


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: 
Changeset: r1627:30791bd74ef2
Date: 2015-02-16 16:34 +0100
http://bitbucket.org/pypy/stmgc/changeset/30791bd74ef2/

Log:	fix for on-major-gc validation not doing anything when a transaction
	thought it was still uncommitted and inevitable

diff --git a/c8/stm/core.c b/c8/stm/core.c
--- a/c8/stm/core.c
+++ b/c8/stm/core.c
@@ -179,7 +179,7 @@
     /* increment_total_allocated(4096); */
 
     if (copy_from_segnum == -1) {
-        /* this page is only accessible in the sharing segment so far (new
+        /* this page is only accessible in the sharing segment seg0 so far (new
            allocation). We can thus simply mark it accessible here. */
         pagecopy(get_virtual_page(my_segnum, pagenum),
                  get_virtual_page(0, pagenum));
@@ -288,7 +288,8 @@
 {
     /* returns true if we reached a valid state, or false if
        we need to abort now */
-    dprintf(("_stm_validate()\n"));
+    dprintf(("_stm_validate() at cl=%p, rev=%lu\n", STM_PSEGMENT->last_commit_log_entry,
+             STM_PSEGMENT->last_commit_log_entry->rev_num));
     /* go from last known entry in commit log to the
        most current one and apply all changes done
        by other transactions. Abort if we have read one of
@@ -388,6 +389,7 @@
                          !needs_abort);  /* if we abort, we still want to copy everything */
                 }
 
+                dprintf(("_stm_validate() to cl=%p, rev=%lu\n", cl, cl->rev_num));
                 /* last fully validated entry */
                 STM_PSEGMENT->last_commit_log_entry = cl;
                 if (cl == last_cl)
@@ -531,6 +533,9 @@
         _validate_and_attach(new);
     }
 
+    STM_PSEGMENT->transaction_state = TS_NONE;
+    STM_PSEGMENT->safe_point = SP_NO_TRANSACTION;
+
     acquire_modification_lock(STM_SEGMENT->segment_num);
     list_clear(STM_PSEGMENT->modified_old_objects);
     STM_PSEGMENT->last_commit_log_entry = new;
@@ -843,6 +848,7 @@
 
     push_new_objects_to_other_segments();
     /* push before validate. otherwise they are reachable too early */
+    bool was_inev = STM_PSEGMENT->transaction_state == TS_INEVITABLE;
     _validate_and_add_to_commit_log();
 
     invoke_and_clear_user_callbacks(0);   /* for commit */
@@ -854,7 +860,7 @@
 
     stm_rewind_jmp_forget(STM_SEGMENT->running_thread);
 
-    if (globally_unique_transaction && STM_PSEGMENT->transaction_state == TS_INEVITABLE) {
+    if (globally_unique_transaction && was_inev) {
         committed_globally_unique_transaction();
     }
 
diff --git a/c8/stm/gcpage.c b/c8/stm/gcpage.c
--- a/c8/stm/gcpage.c
+++ b/c8/stm/gcpage.c
@@ -100,7 +100,9 @@
     stm_char *p = allocate_outside_nursery_large(size_rounded_up);
     object_t *o = (object_t *)p;
 
-    // sharing seg0 needs to be current:
+    /* Sharing seg0 needs to be current, because in core.c handle_segfault_in_page,
+       we depend on simply copying the page from seg0 if it was never accessed by
+       anyone so far (we only run in seg1 <= seg < NB_SEGMENT). */
     assert(STM_SEGMENT->segment_num == 0);
     memset(REAL_ADDRESS(STM_SEGMENT->segment_base, o), 0, size_rounded_up);
     o->stm_flags = GCFLAG_WRITE_BARRIER;


More information about the pypy-commit mailing list