Author: Remi Meier <remi.me...@gmail.com> Branch: c8-small-uniform Changeset: r1512:757f479c2b41 Date: 2014-12-02 16:12 +0100 http://bitbucket.org/pypy/stmgc/changeset/757f479c2b41/
Log: fix for previous commit diff --git a/c8/stm/core.c b/c8/stm/core.c --- a/c8/stm/core.c +++ b/c8/stm/core.c @@ -3,20 +3,6 @@ #endif -#ifdef NDEBUG -#define EVENTUALLY(condition) {/* nothing */} -#else -#define EVENTUALLY(condition) \ - { \ - if (!(condition)) { \ - acquire_privatization_lock(STM_SEGMENT->segment_num);\ - if (!(condition)) \ - stm_fatalerror("fails: " #condition); \ - release_privatization_lock(STM_SEGMENT->segment_num);\ - } \ - } -#endif - /* General helper: copies objects into our own segment, from some source described by a range of 'struct stm_undo_s'. Maybe later we could specialize this function to avoid the checks in the @@ -346,6 +332,13 @@ segment_really_copied_from |= (1UL << cl->segment_num); import_objects(cl->segment_num, -1, undo, end); + + /* here we can actually have our own modified version, so + make sure to only copy things that are not modified in our + segment... (if we do not abort) */ + copy_bk_objs_in_page_from + (cl->segment_num, -1, /* any page */ + !needs_abort); /* if we abort, we still want to copy everything */ } /* last fully validated entry */ @@ -355,18 +348,19 @@ } assert(cl == last_cl); - OPT_ASSERT(segment_really_copied_from < (1 << NB_SEGMENTS)); - int segnum; - for (segnum = 0; segnum < NB_SEGMENTS; segnum++) { - if (segment_really_copied_from & (1UL << segnum)) { - /* here we can actually have our own modified version, so - make sure to only copy things that are not modified in our - segment... (if we do not abort) */ - copy_bk_objs_in_page_from( - segnum, -1, /* any page */ - !needs_abort); /* if we abort, we still want to copy everything */ - } - } + /* XXX: this optimization fails in test_basic.py, bug3 */ + /* OPT_ASSERT(segment_really_copied_from < (1 << NB_SEGMENTS)); */ + /* int segnum; */ + /* for (segnum = 0; segnum < NB_SEGMENTS; segnum++) { */ + /* if (segment_really_copied_from & (1UL << segnum)) { */ + /* /\* here we can actually have our own modified version, so */ + /* make sure to only copy things that are not modified in our */ + /* segment... (if we do not abort) *\/ */ + /* copy_bk_objs_in_page_from( */ + /* segnum, -1, /\* any page *\/ */ + /* !needs_abort); /\* if we abort, we still want to copy everything *\/ */ + /* } */ + /* } */ } /* done with modifications */ @@ -503,6 +497,7 @@ assert(!(bk_obj->stm_flags & GCFLAG_WB_EXECUTED)); dprintf(("write_slowpath(%p): sz=%lu, bk=%p\n", obj, obj_size, bk_obj)); + retry: /* privatize pages: */ /* XXX don't always acquire all locks... */ @@ -553,6 +548,7 @@ /* all pages are either private or we were the first to write to a shared page and therefore got it as our private one */ + /* phew, now add the obj to the write-set and register the backup copy. */ /* XXX: we should not be here at all fiddling with page status diff --git a/c8/test/test_basic.py b/c8/test/test_basic.py --- a/c8/test/test_basic.py +++ b/c8/test/test_basic.py @@ -828,15 +828,20 @@ self.start_transaction() stm_set_char(lp_char_5, 'x', HDR, False) + # self.switch(1) self.start_transaction() stm_set_char(lp_char_5, 'a', HDR, False) self.commit_transaction() - + + # self.switch(0) self.start_transaction() assert stm_get_char(lp_char_5, HDR) == 'a' + # + py.test.raises(Conflict, self.switch, 2) + def test_repeated_wb(self): lp_char_5 = stm_allocate_old(384) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit