[pypy-commit] pypy stmgc-c7: import stmgc 70c403598485
Raemi
noreply at buildbot.pypy.org
Thu May 29 12:36:41 CEST 2014
Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: stmgc-c7
Changeset: r71775:f0c0a7378c89
Date: 2014-05-29 12:35 +0200
http://bitbucket.org/pypy/pypy/changeset/f0c0a7378c89/
Log: import stmgc 70c403598485
diff --git a/rpython/translator/stm/src_stm/stm/core.c b/rpython/translator/stm/src_stm/stm/core.c
--- a/rpython/translator/stm/src_stm/stm/core.c
+++ b/rpython/translator/stm/src_stm/stm/core.c
@@ -210,9 +210,7 @@
STM_PSEGMENT->start_time = tl->_timing_cur_start;
STM_PSEGMENT->signalled_to_commit_soon = false;
STM_PSEGMENT->safe_point = SP_RUNNING;
-#ifndef NDEBUG
- STM_PSEGMENT->marker_inev[1] = 99999999999999999L;
-#endif
+ STM_PSEGMENT->marker_inev[1] = 0;
if (jmpbuf == NULL)
marker_fetch_inev();
STM_PSEGMENT->transaction_state = (jmpbuf != NULL ? TS_REGULAR
@@ -482,6 +480,9 @@
STM_PSEGMENT->safe_point = SP_NO_TRANSACTION;
STM_PSEGMENT->transaction_state = TS_NONE;
+ /* marker_inev is not needed anymore */
+ STM_PSEGMENT->marker_inev[1] = 0;
+
/* reset these lists to NULL for the next transaction */
LIST_FREE(STM_PSEGMENT->objects_pointing_to_nursery);
LIST_FREE(STM_PSEGMENT->large_overflow_objects);
diff --git a/rpython/translator/stm/src_stm/stm/core.h b/rpython/translator/stm/src_stm/stm/core.h
--- a/rpython/translator/stm/src_stm/stm/core.h
+++ b/rpython/translator/stm/src_stm/stm/core.h
@@ -79,9 +79,7 @@
/* List of old objects (older than the current transaction) that the
current transaction attempts to modify. This is used to track
the STM status: they are old objects that where written to and
- that need to be copied to other segments upon commit. Note that
- every object takes three list items: the object, and two words for
- the location marker. */
+ that need to be copied to other segments upon commit. */
struct list_s *modified_old_objects;
/* For each entry in 'modified_old_objects', we have two entries
diff --git a/rpython/translator/stm/src_stm/stm/gcpage.c b/rpython/translator/stm/src_stm/stm/gcpage.c
--- a/rpython/translator/stm/src_stm/stm/gcpage.c
+++ b/rpython/translator/stm/src_stm/stm/gcpage.c
@@ -432,7 +432,7 @@
for (i = list_count(lst); i > 0; i -= 2) {
mark_visit_object((object_t *)list_item(lst, i - 1), base);
}
- if (get_priv_segment(j)->transaction_state == TS_INEVITABLE) {
+ if (get_priv_segment(j)->marker_inev[1]) {
uintptr_t marker_inev_obj = get_priv_segment(j)->marker_inev[1];
mark_visit_object((object_t *)marker_inev_obj, base);
}
@@ -483,7 +483,22 @@
static inline bool largemalloc_keep_object_at(char *data)
{
/* this is called by _stm_largemalloc_sweep() */
- return mark_visited_test_and_clear((object_t *)(data - stm_object_pages));
+ object_t *obj = (object_t *)(data - stm_object_pages);
+ if (!mark_visited_test_and_clear(obj)) {
+#ifndef NDEBUG
+ /* This is actually needed in order to avoid random write-read
+ conflicts with objects read and freed long in the past. Still,
+ it is probably rare enough so that we don't need this additional
+ overhead. (test_random hits it sometimes) */
+ long i;
+ for (i = 1; i <= NB_SEGMENTS; i++) {
+ ((struct stm_read_marker_s *)
+ (get_segment_base(i) + (((uintptr_t)obj) >> 4)))->rm = 0;
+ }
+#endif
+ return false;
+ }
+ return true;
}
static void sweep_large_objects(void)
diff --git a/rpython/translator/stm/src_stm/stm/nursery.c b/rpython/translator/stm/src_stm/stm/nursery.c
--- a/rpython/translator/stm/src_stm/stm/nursery.c
+++ b/rpython/translator/stm/src_stm/stm/nursery.c
@@ -219,9 +219,9 @@
acquire_privatization_lock();
synchronize_object_now(obj);
release_privatization_lock();
+ } else {
+ LIST_APPEND(STM_PSEGMENT->large_overflow_objects, obj);
}
- else
- LIST_APPEND(STM_PSEGMENT->large_overflow_objects, obj);
}
/* the list could have moved while appending */
@@ -245,7 +245,7 @@
for (i = num_old + 1; i < total; i += 2) {
minor_trace_if_young((object_t **)list_ptr_to_item(mlst, i));
}
- if (STM_PSEGMENT->transaction_state == TS_INEVITABLE) {
+ if (STM_PSEGMENT->marker_inev[1]) {
uintptr_t *pmarker_inev_obj = (uintptr_t *)
REAL_ADDRESS(STM_SEGMENT->segment_base,
&STM_PSEGMENT->marker_inev[1]);
@@ -281,6 +281,10 @@
TREE_LOOP_FORWARD(*pseg->young_outside_nursery, item) {
assert(!_is_in_nursery((object_t *)item->addr));
+ /* mark slot as unread */
+ ((struct stm_read_marker_s *)
+ (pseg->pub.segment_base + (item->addr >> 4)))->rm = 0;
+
_stm_large_free(stm_object_pages + item->addr);
} TREE_LOOP_END;
@@ -342,8 +346,9 @@
collect_modified_old_objects();
num_old = 0;
}
- else
+ else {
num_old = STM_PSEGMENT->modified_old_objects_markers_num_old;
+ }
collect_roots_from_markers(num_old);
More information about the pypy-commit
mailing list