[pypy-commit] stmgc c7-refactor: Tweaks
arigo
noreply at buildbot.pypy.org
Mon Feb 24 10:44:15 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: c7-refactor
Changeset: r819:c39f632101a6
Date: 2014-02-24 10:44 +0100
http://bitbucket.org/pypy/stmgc/changeset/c39f632101a6/
Log: Tweaks
diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -251,14 +251,16 @@
static void _finish_transaction(void)
{
+ STM_PSEGMENT->safe_point = SP_NO_TRANSACTION;
+ STM_PSEGMENT->transaction_state = TS_NONE;
+
+ /* reset these lists to NULL for the next transaction */
+ LIST_FREE(STM_PSEGMENT->old_objects_pointing_to_nursery);
+ LIST_FREE(STM_PSEGMENT->overflow_objects_pointing_to_nursery);
+
stm_thread_local_t *tl = STM_SEGMENT->running_thread;
release_thread_segment(tl);
- STM_PSEGMENT->safe_point = SP_NO_TRANSACTION;
- STM_PSEGMENT->transaction_state = TS_NONE;
- if (STM_PSEGMENT->overflow_objects_pointing_to_nursery != NULL) {
- list_free(STM_PSEGMENT->overflow_objects_pointing_to_nursery);
- STM_PSEGMENT->overflow_objects_pointing_to_nursery = NULL;
- }
+ /* cannot access STM_SEGMENT or STM_PSEGMENT from here ! */
}
void stm_commit_transaction(void)
@@ -315,8 +317,6 @@
static void reset_modified_from_other_segments(void)
{
- abort();//...
-#if 0
/* pull the right versions from other threads in order
to reset our pages as part of an abort */
long remote_num = 1 - STM_SEGMENT->segment_num;
@@ -327,8 +327,8 @@
STM_PSEGMENT->modified_old_objects,
object_t * /*item*/,
({
- /* all objects in 'modified_objects' have this flag */
- assert(item->stm_flags & GCFLAG_WRITE_BARRIER_CALLED);
+ /* all objects in 'modified_objects' have this flag removed */
+ assert((item->stm_flags & GCFLAG_WRITE_BARRIER) == 0);
/* memcpy in the opposite direction than
push_modified_to_other_segments() */
@@ -337,9 +337,9 @@
ssize_t size = stmcb_size_rounded_up((struct object_s *)src);
memcpy(dst, src, size);
- /* copying from the other segment removed again the
- WRITE_BARRIER_CALLED flag */
- assert(!(item->stm_flags & GCFLAG_WRITE_BARRIER_CALLED));
+ /* copying from the other segment added again the
+ WRITE_BARRIER flag */
+ assert(item->stm_flags & GCFLAG_WRITE_BARRIER);
/* write all changes to the object before we release the
write lock below. This is needed because we need to
@@ -353,12 +353,11 @@
/* clear the write-lock */
uintptr_t lock_idx = (((uintptr_t)item) >> 4) - WRITELOCK_START;
assert((intptr_t)lock_idx >= 0);
- assert(write_locks[lock_idx]);
+ assert(write_locks[lock_idx] == STM_PSEGMENT->write_lock_num);
write_locks[lock_idx] = 0;
}));
- list_clear(STM_PSEGMENT->modified_objects);
-#endif
+ list_clear(STM_PSEGMENT->modified_old_objects);
}
static void abort_with_mutex(void)
diff --git a/c7/stm/list.h b/c7/stm/list.h
--- a/c7/stm/list.h
+++ b/c7/stm/list.h
@@ -13,6 +13,8 @@
free(lst);
}
+#define LIST_FREE(lst) (list_free(lst), (lst) = NULL)
+
static struct list_s *_list_grow(struct list_s *, uintptr_t);
diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -26,6 +26,10 @@
assert(_STM_FAST_ALLOC <= NURSERY_SIZE);
_stm_nursery_start = NURSERY_START;
_stm_nursery_end = NURSERY_END;
+
+ long i;
+ for (i = 0; i < NB_SEGMENTS; i++)
+ get_segment(i)->nursery_current = (stm_char *)NURSERY_START;
}
static void teardown_nursery(void)
More information about the pypy-commit
mailing list