Author: Remi Meier
Branch: c7
Changeset: r658:70275e7c7c74
Date: 2014-01-21 12:50 +0100
http://bitbucket.org/pypy/stmgc/changeset/70275e7c7c74/
Log: add failing test for partially uncommitted pages / uncommitted
objects
diff --git a/c7/core.h b/c7/core.h
--- a/c7/core.h
+++ b/c7/core.h
@@ -39,7 +39,8 @@
or PRIVATE), but not committed yet. So only visible from
this transaction. */
GCFLAG_NOT_COMMITTED = (1 << 1),
-
+ /* only used during collections to mark an obj as moved out of the
+ generation it was in */
GCFLAG_MOVED = (1 << 2),
};
@@ -62,7 +63,6 @@
struct object_s {
uint8_t stm_flags; /* reserved for the STM library */
- uint8_t stm_write_lock; /* 1 if writeable by some thread */
/* make sure it doesn't get bigger than 4 bytes for performance
reasons */
};
diff --git a/c7/test/support.py b/c7/test/support.py
--- a/c7/test/support.py
+++ b/c7/test/support.py
@@ -74,13 +74,22 @@
extern size_t stmcb_size(struct object_s *);
extern void stmcb_trace(struct object_s *, void (object_t **));
+uint8_t _stm_get_flags(object_t *obj);
+uint8_t _stm_get_page_flag(int pagenum);
enum {
SHARED_PAGE=0,
REMAPPING_PAGE,
PRIVATE_PAGE,
UNCOMMITTED_SHARED_PAGE,
}; /* flag_page_private */
-uint8_t _stm_get_page_flag(int pagenum);
+
+enum {
+ GCFLAG_WRITE_BARRIER = 1,
+ GCFLAG_NOT_COMMITTED = 2,
+ GCFLAG_MOVED = 4
+};
+
+
""")
lib = ffi.verify('''
@@ -101,6 +110,11 @@
}
+uint8_t _stm_get_flags(object_t *obj) {
+ return obj->stm_flags;
+}
+
+
bool _checked_stm_write(object_t *object) {
jmpbufptr_t here;
if (__builtin_setjmp(here) == 0) { // returned directly
@@ -327,6 +341,9 @@
startp = start // 4096
return range(startp, startp + stm_get_obj_size(o) // 4096 + 1)
+def stm_get_flags(o):
+ return lib._stm_get_flags(o)
+
class BaseTest(object):
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
@@ -391,8 +391,18 @@
rnew = stm_get_real_address(new)
assert rnew[4097] == '\0'
+ def test_partial_alloced_pages(self):
+ stm_start_transaction()
+ new = stm_allocate(16)
+ stm_push_root(new)
+ stm_minor_collect()
+ new = stm_pop_root()
+ assert stm_get_page_flag(stm_get_obj_pages(new)[0]) ==
lib.UNCOMMITTED_SHARED_PAGE
+ assert stm_get_flags(new) & lib.GCFLAG_NOT_COMMITTED
-
+ stm_stop_transaction()
+ assert stm_get_page_flag(stm_get_obj_pages(new)[0]) == lib.SHARED_PAGE
+ assert not (stm_get_flags(new) & lib.GCFLAG_NOT_COMMITTED)
# def test_resolve_write_write_no_conflict(self):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit