[pypy-commit] stmgc default: in-progress
arigo
noreply at buildbot.pypy.org
Sat Jun 15 22:46:41 CEST 2013
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r137:f0d8de30d1d4
Date: 2013-06-15 22:16 +0200
http://bitbucket.org/pypy/stmgc/changeset/f0d8de30d1d4/
Log: in-progress
diff --git a/c4/et.c b/c4/et.c
--- a/c4/et.c
+++ b/c4/et.c
@@ -409,6 +409,7 @@
P->h_revision = (revision_t)B;
gcptrlist_insert(&d->private_from_protected, P);
+ fprintf(stderr, "private_from_protected: insert %p\n", P);
return P; /* always returns its arg: the object is converted in-place */
}
@@ -779,6 +780,7 @@
}
assert(d->list_of_read_objects.size == 0);
assert(d->private_from_protected.size == 0);
+ assert(d->num_private_from_protected_known_old == 0);
assert(!g2l_any_entry(&d->public_to_private));
assert(d->public_descriptor->stolen_objects.size == 0);
@@ -993,6 +995,8 @@
}
};
gcptrlist_clear(&d->private_from_protected);
+ d->num_private_from_protected_known_old = 0;
+ fprintf(stderr, "private_from_protected: clear (commit)\n");
}
void AbortPrivateFromProtected(struct tx_descriptor *d)
@@ -1005,6 +1009,7 @@
gcptr P = items[i];
assert(P->h_tid & GCFLAG_PRIVATE_FROM_PROTECTED);
assert(IS_POINTER(P->h_revision));
+ P->h_tid &= ~GCFLAG_PRIVATE_FROM_PROTECTED;
gcptr B = (gcptr)P->h_revision;
assert(B->h_tid & GCFLAG_OLD);
@@ -1012,7 +1017,6 @@
if (B->h_tid & GCFLAG_PUBLIC)
{
assert(!(B->h_tid & GCFLAG_BACKUP_COPY));
- P->h_tid &= ~GCFLAG_PRIVATE_FROM_PROTECTED;
P->h_tid |= GCFLAG_PUBLIC;
if (!(P->h_tid & GCFLAG_OLD)) P->h_tid |= GCFLAG_NURSERY_MOVED;
/* P becomes a public outdated object. It may create an
@@ -1024,12 +1028,20 @@
}
else
{
+ /* copy the backup copy B back over the now-protected object P,
+ and then free B, which will not be used any more. */
+ size_t size = stmcb_size(B);
assert(B->h_tid & GCFLAG_BACKUP_COPY);
- memcpy(P, B, stmcb_size(P));
- P->h_tid &= ~GCFLAG_BACKUP_COPY;
+ memcpy(((char *)P) + offsetof(struct stm_object_s, h_revision),
+ ((char *)B) + offsetof(struct stm_object_s, h_revision),
+ size - offsetof(struct stm_object_s, h_revision));
+ assert(!(P->h_tid & GCFLAG_BACKUP_COPY));
+ stm_free(B, size);
}
};
gcptrlist_clear(&d->private_from_protected);
+ d->num_private_from_protected_known_old = 0;
+ fprintf(stderr, "private_from_protected: clear (abort)\n");
}
void CommitTransaction(void)
diff --git a/c4/nursery.c b/c4/nursery.c
--- a/c4/nursery.c
+++ b/c4/nursery.c
@@ -129,6 +129,18 @@
}
}
+static void mark_private_from_protected(struct tx_descriptor *d)
+{
+ long i, size = d->public_with_young_copy.size;
+ gcptr *items = d->public_with_young_copy.items;
+
+ for (i = d->num_private_from_protected_known_old; i < size; i++) {
+ visit_if_young(&items[i]);
+ }
+
+ d->num_private_from_protected_known_old = size;
+}
+
static void mark_public_to_young(struct tx_descriptor *d)
{
/* "public_with_young_copy" lists the public copies that may have
@@ -256,6 +268,8 @@
mark_young_roots(d);
+ mark_private_from_protected(d);
+
mark_public_to_young(d);
visit_all_outside_objects(d);
diff --git a/c4/nursery.h b/c4/nursery.h
--- a/c4/nursery.h
+++ b/c4/nursery.h
@@ -11,7 +11,8 @@
char *nursery_end; \
char *nursery_base; \
struct GcPtrList old_objects_to_trace; \
- struct GcPtrList public_with_young_copy;
+ struct GcPtrList public_with_young_copy; \
+ long num_private_from_protected_known_old;
struct tx_descriptor; /* from et.h */
diff --git a/c4/test/test_random.py b/c4/test/test_random.py
--- a/c4/test/test_random.py
+++ b/c4/test/test_random.py
@@ -411,7 +411,7 @@
tester.run_single_thread()
def test_more_single_thread():
- py.test.skip("more random tests")
+ #py.test.skip("more random tests")
for i in range(100):
yield test_single_thread, i + 3900
More information about the pypy-commit
mailing list