Author: Remi Meier <remi.me...@gmail.com> Branch: c7 Changeset: r609:a0a36a7daa1f Date: 2014-01-14 16:22 +0100 http://bitbucket.org/pypy/stmgc/changeset/a0a36a7daa1f/
Log: simple tests diff --git a/c7/core.c b/c7/core.c --- a/c7/core.c +++ b/c7/core.c @@ -122,7 +122,9 @@ bool _stm_was_written(object_t *obj) { - return obj->stm_flags & GCFLAG_WRITE_BARRIER; + /* if the obj was written to in the current transaction + and doesn't trigger the write-barrier slowpath */ + return !(obj->stm_flags & GCFLAG_WRITE_BARRIER); } diff --git a/c7/test/support.py b/c7/test/support.py --- a/c7/test/support.py +++ b/c7/test/support.py @@ -95,10 +95,10 @@ def stm_write(ptr): lib.stm_write(lib._stm_tl_address(ptr)) -def _stm_was_read(ptr): +def stm_was_read(ptr): return lib._stm_was_read(lib._stm_tl_address(ptr)) -def _stm_was_written(ptr): +def stm_was_written(ptr): return lib._stm_was_written(lib._stm_tl_address(ptr)) def stm_start_transaction(): diff --git a/c7/test/test_basic.py b/c7/test/test_basic.py --- a/c7/test/test_basic.py +++ b/c7/test/test_basic.py @@ -23,7 +23,7 @@ p4 = stm_allocate(16) assert p4 - p3 == 16 - def test_simple(self): + def test_transaction_start_stop(self): stm_start_transaction() self.switch(1) stm_start_transaction() @@ -31,6 +31,19 @@ self.switch(0) stm_stop_transaction() + def test_simple_read(self): + stm_start_transaction() + p1 = stm_allocate(16) + stm_read(p1) + assert stm_was_read(p1) + + def test_simple_write(self): + stm_start_transaction() + p1 = stm_allocate(16) + assert stm_was_written(p1) + stm_write(p1) + assert stm_was_written(p1) + def test_read_write_1(self): stm_start_transaction() p1 = stm_allocate(16) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit