[pypy-commit] stmgc default: Just tweaks
arigo
noreply at buildbot.pypy.org
Wed Apr 9 13:05:46 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r1148:6aed6a111e7a
Date: 2014-04-09 12:50 +0200
http://bitbucket.org/pypy/stmgc/changeset/6aed6a111e7a/
Log: Just tweaks
diff --git a/c7/stm/weakref.c b/c7/stm/weakref.c
--- a/c7/stm/weakref.c
+++ b/c7/stm/weakref.c
@@ -57,11 +57,14 @@
a young outside nursery object. */
assert(_is_in_nursery(item));
object_t *TLPREFIX *pforwarded_array = (object_t *TLPREFIX *)item;
+ ssize_t size = 16;
- /* the following checks are done like in nursery.c: */
- if (!(item->stm_flags & GCFLAG_HAS_SHADOW)
- || (pforwarded_array[0] != GCWORD_MOVED)) {
- /* weakref dies */
+ /* check if the weakref object was moved out of the nursery */
+ if (pforwarded_array[0] != GCWORD_MOVED) {
+ /* no: weakref dies */
+#ifndef NDEBUG
+ *WEAKREF_PTR(item, size) = (object_t *)-99;
+#endif
continue;
}
@@ -69,15 +72,13 @@
assert(!_is_young(item));
- ssize_t size = 16;
object_t *pointing_to = *WEAKREF_PTR(item, size);
assert(pointing_to != NULL);
if (_is_in_nursery(pointing_to)) {
object_t *TLPREFIX *pforwarded_array = (object_t *TLPREFIX *)pointing_to;
- /* the following checks are done like in nursery.c: */
- if (!(pointing_to->stm_flags & GCFLAG_HAS_SHADOW)
- || (pforwarded_array[0] != GCWORD_MOVED)) {
+ /* check if the target was moved out of the nursery */
+ if (pforwarded_array[0] != GCWORD_MOVED) {
/* pointing_to dies */
_set_weakref_in_all_segments(item, NULL);
continue; /* no need to remember in old_weakrefs */
@@ -96,7 +97,9 @@
_set_weakref_in_all_segments(item, NULL);
continue; /* no need to remember in old_weakrefs */
}
- /* pointing_to was already old */
+ /* pointing_to is either a surviving young object outside
+ the nursery, or it was already old; in both cases keeping
+ the currently stored pointer is what we need */
}
LIST_APPEND(STM_PSEGMENT->old_weakrefs, item);
}));
@@ -128,7 +131,7 @@
stm_char *wr = (stm_char *)WEAKREF_PTR(weakref, size);
char *real_wr = REAL_ADDRESS(pseg->pub.segment_base, wr);
object_t *pointing_to = *(object_t **)real_wr;
- assert(pointing_to != NULL);
+ assert((uintptr_t)pointing_to >= NURSERY_END);
if (!mark_visited_test(pointing_to)) {
//assert(flag_page_private[(uintptr_t)weakref / 4096UL] != PRIVATE_PAGE);
_set_weakref_in_all_segments(weakref, NULL);
More information about the pypy-commit
mailing list