[pypy-commit] stmgc c7-refactor: Tweaks
arigo
noreply at buildbot.pypy.org
Sun Feb 23 14:25:16 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch: c7-refactor
Changeset: r812:027470d9d12b
Date: 2014-02-23 14:25 +0100
http://bitbucket.org/pypy/stmgc/changeset/027470d9d12b/
Log: Tweaks
diff --git a/c7/stm/core.c b/c7/stm/core.c
--- a/c7/stm/core.c
+++ b/c7/stm/core.c
@@ -128,8 +128,14 @@
uint8_t old_rv = STM_SEGMENT->transaction_read_version;
STM_SEGMENT->transaction_read_version = old_rv + 1;
- if (UNLIKELY(old_rv == 0xff))
+ if (UNLIKELY(old_rv >= 0xfe)) {
+ /* reset if transaction_read_version was 0xfe or 0xff. If it's
+ 0xff, then we need it because the new value would overflow to
+ 0. But resetting it already from 0xfe is better for short
+ or medium transactions: at the next minor collection we'll
+ still have one free number to increase to. */
reset_transaction_read_version();
+ }
STM_PSEGMENT->min_read_version_outside_nursery =
STM_SEGMENT->transaction_read_version;
diff --git a/c7/stm/nursery.c b/c7/stm/nursery.c
--- a/c7/stm/nursery.c
+++ b/c7/stm/nursery.c
@@ -245,18 +245,19 @@
static void trace_and_drag_out_of_nursery(object_t *obj)
{
- if (is_in_shared_pages(obj)) {
- /* the object needs fixing only in one copy, because all copies
- are shared and identical. */
- char *realobj = (char *)REAL_ADDRESS(stm_object_pages, obj);
+ long i;
+ for (i = 0; i < NB_SEGMENTS; i++) {
+ struct object_s *realobj =
+ (struct object_s *)REAL_ADDRESS(get_segment_base(i), obj);
+
+ realobj->stm_flags &= ~GCFLAG_WRITE_BARRIER_CALLED;
+
stmcb_trace((struct object_s *)realobj, &minor_trace_if_young);
- }
- else {
- /* every segment needs fixing */
- long i;
- for (i = 0; i < NB_SEGMENTS; i++) {
- char *realobj = (char *)REAL_ADDRESS(get_segment_base(i), obj);
- stmcb_trace((struct object_s *)realobj, &minor_trace_if_young);
+
+ if (i == 0 && is_in_shared_pages(obj)) {
+ /* the object needs fixing only in one copy, because all copies
+ are shared and identical. */
+ break;
}
}
}
@@ -274,9 +275,9 @@
if ((obj->stm_flags & GCFLAG_WRITE_BARRIER_CALLED) == 0)
continue;
- /* Remove the flag GCFLAG_WRITE_BARRIER_CALLED. No live object
- should have this flag set after a nursery collection. */
- obj->stm_flags &= ~GCFLAG_WRITE_BARRIER_CALLED;
+ /* The flag GCFLAG_WRITE_BARRIER_CALLED is going to be removed:
+ no live object should have this flag set after a nursery
+ collection. It is done in either one or NB_SEGMENTS copies. */
/* Trace the 'obj' to replace pointers to nursery with pointers
outside the nursery, possibly forcing nursery objects out
More information about the pypy-commit
mailing list