Author: Armin Rigo <[email protected]>
Branch: stm-thread-2
Changeset: r57218:e75885115a22
Date: 2012-09-07 17:07 +0200
http://bitbucket.org/pypy/pypy/changeset/e75885115a22/
Log: test_ztranslation starts to pass. Yay!
diff --git a/pypy/rpython/memory/gc/stmgc.py b/pypy/rpython/memory/gc/stmgc.py
--- a/pypy/rpython/memory/gc/stmgc.py
+++ b/pypy/rpython/memory/gc/stmgc.py
@@ -121,7 +121,7 @@
GCFLAG_POSSIBLY_OUTDATED = first_gcflag << 1 # keep in sync with et.h
GCFLAG_NOT_WRITTEN = first_gcflag << 2 # keep in sync with et.h
GCFLAG_LOCAL_COPY = first_gcflag << 3 # keep in sync with et.h
-GCFLAG_VISITED = first_gcflag << 4
+GCFLAG_VISITED = first_gcflag << 4 # keep in sync with et.h
GCFLAG_HAS_SHADOW = first_gcflag << 5
GCFLAG_FIXED_HASH = first_gcflag << 6
diff --git a/pypy/rpython/memory/gc/stmtls.py b/pypy/rpython/memory/gc/stmtls.py
--- a/pypy/rpython/memory/gc/stmtls.py
+++ b/pypy/rpython/memory/gc/stmtls.py
@@ -123,7 +123,7 @@
# At this point, all visible objects are GLOBAL, but newly
# malloced objects will be LOCAL.
if self.gc.DEBUG:
- self.check_all_global_objects()
+ self.check_all_global_objects(False)
#self.relocalize_from_stack()
def stop_transaction(self):
@@ -137,7 +137,7 @@
self._promote_locals_to_globals()
self._disable_mallocs()
if self.gc.DEBUG:
- self.check_all_global_objects()
+ self.check_all_global_objects(True)
def local_nursery_is_empty(self):
ll_assert(bool(self.nursery_free),
@@ -273,15 +273,7 @@
hdr.tid |= GCFLAG_GLOBAL | GCFLAG_NOT_WRITTEN
self._clear_version_for_global_object(hdr)
#
- while self.copied_local_objects.non_empty():
- obj = self.copied_local_objects.pop()
- hdr = self.gc.header(obj)
- ll_assert(hdr.tid & GCFLAG_LOCAL_COPY, "missing LOCAL_COPY [0]")
- ll_assert(hdr.tid & GCFLAG_GLOBAL == 0, "already GLOBAL [0]")
- ll_assert(hdr.tid & GCFLAG_VISITED, "missing VISITED [0]")
- hdr.tid |= GCFLAG_GLOBAL | GCFLAG_NOT_WRITTEN
- hdr.tid &= ~(GCFLAG_VISITED | GCFLAG_LOCAL_COPY)
- # don't touch 'revision' in this case
+ self.copied_local_objects.clear()
def _clear_version_for_global_object(self, hdr):
# Reset the 'version' to initialize a newly global object.
@@ -583,10 +575,14 @@
if self.debug_seen.contains(obj):
return
hdr = self.gc.header(obj)
- ll_assert(hdr.tid & GCFLAG_GLOBAL != 0,
- "debug_check: missing GLOBAL")
- ll_assert(hdr.tid & GCFLAG_LOCAL_COPY == 0,
- "debug_check: unexpected LOCAL_COPY")
+ is_global = hdr.tid & GCFLAG_GLOBAL != 0
+ is_local_copy = hdr.tid & GCFLAG_LOCAL_COPY != 0
+ if not self._allow_local_copy:
+ ll_assert(is_global, "debug_check: missing GLOBAL")
+ if is_global:
+ ll_assert(not is_local_copy, "debug_check: unexpected LOCAL_COPY")
+ else:
+ ll_assert(is_local_copy, "debug_check: missing LOCAL_COPY")
ll_assert(hdr.tid & GCFLAG_VISITED == 0,
"debug_check: unexpected VISITED")
ll_assert(hdr.tid & GCFLAG_HAS_SHADOW == 0,
@@ -595,9 +591,10 @@
self.pending.append(obj)
self.debug_seen.setitem(obj, obj)
- def check_all_global_objects(self):
+ def check_all_global_objects(self, allow_local_copy):
self.pending = self.AddressStack()
self.debug_seen = self.AddressDict()
+ self._allow_local_copy = allow_local_copy
self.gc.root_walker.walk_current_stack_roots(
StmGCTLS._debug_check_all_global_from_stack_1, self)
while self.pending.non_empty():
diff --git a/pypy/translator/stm/src_stm/et.c b/pypy/translator/stm/src_stm/et.c
--- a/pypy/translator/stm/src_stm/et.c
+++ b/pypy/translator/stm/src_stm/et.c
@@ -502,7 +502,9 @@
assert(L->h_tid & GCFLAG_LOCAL_COPY);
assert((L->h_tid & GCFLAG_POSSIBLY_OUTDATED) == 0);
- L->h_tid &= ~GCFLAG_LOCAL_COPY;
+ /* GCFLAG_VISITED is only used by stmgc, but it's convenient to
+ * remove that flag from here */
+ L->h_tid &= ~(GCFLAG_VISITED | GCFLAG_LOCAL_COPY);
if (L->h_tid & GCFLAG_NOT_WRITTEN)
{
L->h_tid |= GCFLAG_GLOBAL | GCFLAG_POSSIBLY_OUTDATED;
diff --git a/pypy/translator/stm/src_stm/et.h b/pypy/translator/stm/src_stm/et.h
--- a/pypy/translator/stm/src_stm/et.h
+++ b/pypy/translator/stm/src_stm/et.h
@@ -26,6 +26,7 @@
GCFLAG_POSSIBLY_OUTDATED = _first_gcflag << 1,
GCFLAG_NOT_WRITTEN = _first_gcflag << 2,
GCFLAG_LOCAL_COPY = _first_gcflag << 3,
+ GCFLAG_VISITED = _first_gcflag << 4,
GCFLAG_PREBUILT = GCFLAG_GLOBAL|GCFLAG_NOT_WRITTEN,
REV_INITIAL = 1
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit