[pypy-commit] pypy stm-thread-2: test_stmgcintf passes again.
arigo
noreply at buildbot.pypy.org
Wed Sep 5 18:34:19 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch: stm-thread-2
Changeset: r57153:2ca264122290
Date: 2012-09-05 17:26 +0200
http://bitbucket.org/pypy/pypy/changeset/2ca264122290/
Log: test_stmgcintf passes again.
diff --git a/pypy/translator/stm/src_stm/et.c b/pypy/translator/stm/src_stm/et.c
--- a/pypy/translator/stm/src_stm/et.c
+++ b/pypy/translator/stm/src_stm/et.c
@@ -30,13 +30,15 @@
/************************************************************/
-#define ABORT_REASONS 4
+#define ABORT_REASONS 5
#define SPINLOOP_REASONS 3
struct tx_descriptor {
jmp_buf *setjmp_buf;
revision_t start_time;
revision_t my_lock;
+ long atomic; /* 0 = not atomic, > 0 atomic */
+ long reads_size_limit, reads_size_limit_nonatomic; /* see should_break_tr. */
int active; /* 0 = inactive, 1 = regular, 2 = inevitable */
int readonly_updates;
unsigned int num_commits;
@@ -186,6 +188,16 @@
return _direct_read_barrier(G, R_Container, offset);
}
+gcptr _RepeatReadBarrier(gcptr O)
+{
+ // LatestGlobalRevision(O) would either return O or abort
+ // the whole transaction, so omitting it is not wrong
+ struct tx_descriptor *d = thread_descriptor;
+ wlog_t *entry;
+ G2L_FIND(d->global_to_local, O, entry, return O);
+ return entry->val;
+}
+
gcptr _NonTransactionalReadBarrier(gcptr P)
{
/* testing only: use this outside transactions to check the state */
@@ -210,15 +222,12 @@
{
wlog_t *entry;
gcptr L;
- size_t size;
G2L_FIND(d->global_to_local, R, entry, goto not_found);
L = entry->val;
return L;
not_found:
- size = pypy_g__stm_getsize(R);
- L = malloc(size);
- memcpy(L, R, size);
+ L = pypy_g__stm_duplicate(R);
L->h_tid &= ~(GCFLAG_GLOBAL | GCFLAG_POSSIBLY_OUTDATED);
assert(L->h_tid & GCFLAG_NOT_WRITTEN);
L->h_tid |= GCFLAG_LOCAL_COPY;
@@ -366,17 +375,30 @@
/************************************************************/
-void BeginTransaction(jmp_buf* buf)
+static void update_reads_size_limit(struct tx_descriptor *d)
{
- struct tx_descriptor *d = thread_descriptor;
+ /* 'reads_size_limit' is set to LONG_MAX if we are atomic; else
+ we copy the value from reads_size_limit_nonatomic. */
+ d->reads_size_limit = d->atomic ? LONG_MAX : d->reads_size_limit_nonatomic;
+}
+
+static void init_transaction(struct tx_descriptor *d)
+{
assert(d->active == 0);
- d->active = 1;
- d->setjmp_buf = buf;
gcptrlist_clear(&d->list_of_read_objects);
gcptrlist_clear(&d->gcroots);
g2l_clear(&d->global_to_local);
fxcache_clear(&d->recent_reads_cache);
+}
+
+void BeginTransaction(jmp_buf* buf)
+{
+ struct tx_descriptor *d = thread_descriptor;
+ init_transaction(d);
+ d->active = 1;
+ d->setjmp_buf = buf;
d->start_time = GetGlobalCurTime(d);
+ update_reads_size_limit(d);
}
#if 0
@@ -471,7 +493,7 @@
}
}
-struct gcroot_s *FindRootsForLocalCollect(void)
+static struct gcroot_s *FindRootsForLocalCollect(void)
{
struct tx_descriptor *d = thread_descriptor;
wlog_t *item;
@@ -506,6 +528,8 @@
revision_t cur_time;
struct tx_descriptor *d = thread_descriptor;
assert(d->active != 0);
+ if (d->gcroots.size == 0)
+ FindRootsForLocalCollect(); /* for tests */
AcquireLocks(d);
@@ -549,12 +573,30 @@
/************************************************************/
-void BecomeInevitable(void)
+static void make_inevitable(struct tx_descriptor *d)
+{
+ d->setjmp_buf = NULL;
+ d->active = 2;
+ d->reads_size_limit_nonatomic = 0;
+ update_reads_size_limit(d);
+}
+
+void BecomeInevitable(const char *why)
{
revision_t cur_time;
struct tx_descriptor *d = thread_descriptor;
- if (is_inevitable(d))
- return;
+ if (d == NULL || d->active != 1)
+ return; /* I am already inevitable, or not in a transaction at all
+ (XXX statically we should know when we're outside
+ a transaction) */
+
+#ifdef RPY_STM_DEBUG_PRINT
+ PYPY_DEBUG_START("stm-inevitable");
+ if (PYPY_HAVE_DEBUG_PRINTS)
+ {
+ fprintf(PYPY_DEBUG_FILE, "%s\n", why);
+ }
+#endif
inev_mutex_acquire();
cur_time = global_cur_time;
@@ -572,8 +614,26 @@
AbortTransaction(3);
}
}
- d->active = 2;
- d->setjmp_buf = NULL; /* cannot abort any more */
+ make_inevitable(d); /* cannot abort any more */
+
+#ifdef RPY_STM_DEBUG_PRINT
+ PYPY_DEBUG_STOP("stm-inevitable");
+#endif
+}
+
+void BeginInevitableTransaction(void)
+{
+ struct tx_descriptor *d = thread_descriptor;
+ revision_t cur_time;
+
+ init_transaction(d);
+ inev_mutex_acquire();
+ cur_time = global_cur_time;
+ while (!bool_cas(&global_cur_time, cur_time, INEVITABLE))
+ cur_time = global_cur_time; /* try again */
+ assert(cur_time != INEVITABLE);
+ d->start_time = cur_time;
+ make_inevitable(d);
}
/************************************************************/
diff --git a/pypy/translator/stm/src_stm/et.h b/pypy/translator/stm/src_stm/et.h
--- a/pypy/translator/stm/src_stm/et.h
+++ b/pypy/translator/stm/src_stm/et.h
@@ -43,6 +43,11 @@
(assert(((gcptr)(G))->h_tid & GCFLAG_GLOBAL), \
(typeof(G))_DirectReadBarrier((gcptr)(G)))
+#define STM_BARRIER_O2R(O) \
+ (__builtin_expect((((gcptr)(O))->h_tid & GCFLAG_POSSIBLY_OUTDATED) == 0, \
+ 1) ? \
+ (O) : (typeof(O))_RepeatReadBarrier((gcptr)(O)))
+
/*#define STM_READ_BARRIER_P_FROM_R(P, R_container, offset) \
(__builtin_expect((((gcptr)(P))->h_tid & GCFLAG_GLOBAL) == 0, 1) ? \
(P) : (typeof(P))_DirectReadBarrierFromR((gcptr)(P), \
@@ -58,28 +63,42 @@
(R) : (typeof(R))_WriteBarrierFromReady((gcptr)(R)))
void BeginTransaction(jmp_buf *);
-int _FakeReach(gcptr);
+void BeginInevitableTransaction(void);
+//int _FakeReach(gcptr);
void CommitTransaction(void);
-void BecomeInevitable(void);
+void BecomeInevitable(const char *why);
//void BeginInevitableTransaction(void);
void DescriptorInit(void);
void DescriptorDone(void);
+int _FakeReach(gcptr P);
//gcptr Allocate(size_t size, int gctid);
_Bool PtrEq(gcptr P1, gcptr P2);
gcptr _DirectReadBarrier(gcptr);
gcptr _DirectReadBarrierFromR(gcptr, gcptr, size_t);
+gcptr _RepeatReadBarrier(gcptr);
gcptr _WriteBarrier(gcptr);
gcptr _WriteBarrierFromReady(gcptr);
//gcptr _NonTransactionalReadBarrier(gcptr);
-extern Signed pypy_g__stm_getsize(gcptr);
+extern gcptr pypy_g__stm_duplicate(gcptr);
+extern void pypy_g__stm_enum_callback(void *, gcptr, gcptr);
void stm_set_tls(void *newtls);
void *stm_get_tls(void);
void stm_del_tls(void);
gcptr stm_tldict_lookup(gcptr); /* for tests only */
void stm_tldict_add(gcptr, gcptr); /* for tests only */
+void stm_tldict_enum(void);
+long stm_in_transaction(void);
+long stm_is_inevitable(void);
+void stm_add_atomic(long delta);
+long stm_get_atomic(void);
+long stm_should_break_transaction(void);
+void stm_set_transaction_length(long length_max);
+void stm_perform_transaction(long(*callback)(void*, long), void *arg,
+ void *save_and_restore);
+void stm_abort_and_retry(void);
#endif /* _ET_H */
diff --git a/pypy/translator/stm/src_stm/rpyintf.c b/pypy/translator/stm/src_stm/rpyintf.c
--- a/pypy/translator/stm/src_stm/rpyintf.c
+++ b/pypy/translator/stm/src_stm/rpyintf.c
@@ -26,10 +26,153 @@
not_found:
return NULL;
}
-
+
void stm_tldict_add(gcptr key, gcptr value)
{
struct tx_descriptor *d = thread_descriptor;
assert(d != NULL);
g2l_insert(&d->global_to_local, key, value);
}
+
+void stm_tldict_enum(void)
+{
+ struct tx_descriptor *d = thread_descriptor;
+ wlog_t *item;
+ void *tls = stm_get_tls();
+ struct gcroot_s *gcroots = FindRootsForLocalCollect();
+
+ while (gcroots->R != NULL)
+ {
+ pypy_g__stm_enum_callback(tls, gcroots->R, gcroots->L);
+ gcroots++;
+ }
+}
+
+long stm_in_transaction(void)
+{
+ struct tx_descriptor *d = thread_descriptor;
+ return d->active;
+}
+
+long stm_is_inevitable(void)
+{
+ struct tx_descriptor *d = thread_descriptor;
+ return is_inevitable(d);
+}
+
+static long stm_regular_length_limit = LONG_MAX;
+
+void stm_add_atomic(long delta)
+{
+ struct tx_descriptor *d = thread_descriptor;
+ d->atomic += delta;
+ update_reads_size_limit(d);
+}
+
+long stm_get_atomic(void)
+{
+ struct tx_descriptor *d = thread_descriptor;
+ return d->atomic;
+}
+
+long stm_should_break_transaction(void)
+{
+ struct tx_descriptor *d = thread_descriptor;
+
+ /* a single comparison to handle all cases:
+
+ - if d->atomic, then we should return False. This is done by
+ forcing reads_size_limit to LONG_MAX as soon as atomic > 0.
+
+ - otherwise, if is_inevitable(), then we should return True.
+ This is done by forcing both reads_size_limit and
+ reads_size_limit_nonatomic to 0 in that case.
+
+ - finally, the default case: return True if
+ d->list_of_read_objects.size is
+ greater than reads_size_limit == reads_size_limit_nonatomic.
+ */
+#ifdef RPY_STM_ASSERT
+ /* reads_size_limit is LONG_MAX if d->atomic, or else it is equal to
+ reads_size_limit_nonatomic. */
+ assert(d->reads_size_limit == (d->atomic ? LONG_MAX :
+ d->reads_size_limit_nonatomic));
+ /* if is_inevitable(), reads_size_limit_nonatomic should be 0
+ (and thus reads_size_limit too, if !d->atomic.) */
+ if (is_inevitable(d))
+ assert(d->reads_size_limit_nonatomic == 0);
+#endif
+
+ return d->list_of_read_objects.size >= d->reads_size_limit;
+}
+
+void stm_set_transaction_length(long length_max)
+{
+ struct tx_descriptor *d = thread_descriptor;
+ BecomeInevitable("set_transaction_length");
+ stm_regular_length_limit = length_max;
+}
+
+#define END_MARKER ((void*)-8) /* keep in sync with stmframework.py */
+
+void stm_perform_transaction(long(*callback)(void*, long), void *arg,
+ void *save_and_restore)
+{
+ jmp_buf _jmpbuf;
+ long volatile v_counter = 0;
+ void **volatile v_saved_value;
+ long volatile v_atomic = thread_descriptor->atomic;
+ assert((!thread_descriptor->active) == (!v_atomic));
+ v_saved_value = *(void***)save_and_restore;
+ /***/
+ setjmp(_jmpbuf);
+ /* After setjmp(), the local variables v_* are preserved because they
+ * are volatile. The other variables are only declared here. */
+ struct tx_descriptor *d = thread_descriptor;
+ long counter, result;
+ void **restore_value;
+ counter = v_counter;
+ d->atomic = v_atomic;
+ restore_value = v_saved_value;
+ if (!d->atomic)
+ {
+ /* In non-atomic mode, we are now between two transactions.
+ It means that in the next transaction's collections we know
+ that we won't need to access the shadows stack beyond its
+ current position. So we add an end marker. */
+ *restore_value++ = END_MARKER;
+ }
+ *(void***)save_and_restore = restore_value;
+
+ do
+ {
+ v_counter = counter + 1;
+ /* initialize 'reads_size_limit_nonatomic' from the configured
+ length limit, scaled down by a factor of 2 for each time we
+ retry an aborted transaction. Note that as soon as such a
+ shortened transaction succeeds, the next one will again have
+ full length, for now. */
+ d->reads_size_limit_nonatomic = stm_regular_length_limit >> counter;
+ if (!d->atomic)
+ BeginTransaction(&_jmpbuf);
+
+ /* invoke the callback in the new transaction */
+ result = callback(arg, counter);
+
+ v_atomic = d->atomic;
+ if (!d->atomic)
+ CommitTransaction();
+ counter = 0;
+ }
+ while (result == 1); /* also stops if we got an RPython exception */
+
+ if (d->atomic && d->setjmp_buf == &_jmpbuf)
+ BecomeInevitable("perform_transaction left with atomic");
+
+ *(void***)save_and_restore = v_saved_value;
+}
+
+void stm_abort_and_retry(void)
+{
+ AbortTransaction(4); /* manual abort */
+}
diff --git a/pypy/translator/stm/test/test_stmgcintf.c b/pypy/translator/stm/test/test_stmgcintf.c
--- a/pypy/translator/stm/test/test_stmgcintf.c
+++ b/pypy/translator/stm/test/test_stmgcintf.c
@@ -22,12 +22,6 @@
typedef struct {
struct pypy_header0 header;
char value1;
- short value2;
- int value4;
- long long value8;
- double value8f;
- float value4f;
- char last_16_bytes[16];
} S1;
typedef char bool_t;
@@ -37,14 +31,14 @@
#include "src_stm/et.c"
-long (*cb_getsize)(gcptr);
-void (*cb_enum_callback)(void *, void *, void *);
+gcptr (*cb_duplicate)(gcptr);
+void (*cb_enum_callback)(void *, gcptr, gcptr);
-long pypy_g__stm_getsize(gcptr a) {
- assert(cb_getsize != NULL);
- return cb_getsize(a);
+gcptr pypy_g__stm_duplicate(gcptr a) {
+ assert(cb_duplicate != NULL);
+ return cb_duplicate(a);
}
-void pypy_g__stm_enum_callback(void *a, void *b, void *c) {
+void pypy_g__stm_enum_callback(void *a, gcptr b, gcptr c) {
assert(cb_enum_callback != NULL);
cb_enum_callback(a, b, c);
}
@@ -164,14 +158,19 @@
/************************************************************/
+struct pypy_header0 etldn1 = {GCFLAG_PREBUILT, REV_INITIAL};
+struct pypy_header0 etldn2 = {0, 0};
+struct pypy_header0 etldn3 = {GCFLAG_PREBUILT, REV_INITIAL};
+struct pypy_header0 etldn4 = {0, 0};
+
int check_enum_1_found;
-void check_enum_1(void *tls, void *a, void *b)
+void check_enum_1(void *tls, gcptr a, gcptr b)
{
int n;
assert(tls == (void *)742);
- if (a == (void *)0x4020 && b == (void *)10002)
+ if (a == &etldn1 && b == &etldn2)
n = 1;
- else if (a == (void *)0x4028 && b == (void *)10004)
+ else if (a == &etldn3 && b == &etldn4)
n = 2;
else
assert(!"unexpected a or b");
@@ -180,14 +179,9 @@
}
void enum_tldict_nonempty(void)
{
- void *a1 = (void *)0x4020;
- void *a2 = (void *)10002;
- void *a3 = (void *)0x4028;
- void *a4 = (void *)10004;
-
stm_set_tls((void *)742);
- stm_tldict_add(a1, a2);
- stm_tldict_add(a3, a4);
+ stm_tldict_add(&etldn1, &etldn2);
+ stm_tldict_add(&etldn3, &etldn4);
cb_enum_callback = check_enum_1;
check_enum_1_found = 0;
stm_tldict_enum();
@@ -199,28 +193,21 @@
/************************************************************/
-#if 0
void test_read_main_thread(void)
{
S1 s1;
+ S1 *p2;
int i;
- stm_begin_inevitable_transaction();
+ BeginInevitableTransaction();
for (i=0; i<2; i++) {
- s1.header.h_tid = GCFLAG_GLOBAL | (i ? GCFLAG_WAS_COPIED : 0);
- s1.header.h_version = NULL;
- s1.value1 = 49;
- s1.value2 = 3981;
- s1.value4 = 4204229;
- s1.value8 = 3419103092099219LL;
- s1.value8f = 289.25;
- s1.value4f = -5.5;
+ s1.header.h_tid = GCFLAG_PREBUILT | (i ? GCFLAG_POSSIBLY_OUTDATED : 0);
+ s1.header.h_revision = REV_INITIAL;
- assert(stm_read_int1( &s1, offsetof(S1, value1 )) == 49);
- assert(stm_read_int2( &s1, offsetof(S1, value2 )) == 3981);
- assert(stm_read_int4( &s1, offsetof(S1, value4 )) == 4204229);
- assert(stm_read_int8( &s1, offsetof(S1, value8))== 3419103092099219LL);
- assert(stm_read_int8f(&s1, offsetof(S1, value8f)) == 289.25);
- assert(stm_read_int4f(&s1, offsetof(S1, value4f)) == -5.5);
+ p2 = STM_BARRIER_P2R(&s1);
+ assert(p2 == &s1);
+
+ p2 = STM_BARRIER_G2R(&s1);
+ assert(p2 == &s1);
}
}
@@ -229,43 +216,40 @@
void read_transaction(void)
{
S1 s1, s2;
+ S1 *p2;
int i;
for (i=0; i<2; i++) {
- s1.header.h_tid = GCFLAG_GLOBAL | (i ? GCFLAG_WAS_COPIED : 0);
- s1.header.h_version = NULL;
- s1.value1 = 49;
- s1.value2 = 3981;
- s1.value4 = 4204229;
- s1.value8 = 3419103092099219LL;
- s1.value8f = 289.25;
- s1.value4f = -5.5;
+ s1.header.h_tid = GCFLAG_PREBUILT | (i ? GCFLAG_POSSIBLY_OUTDATED : 0);
+ s1.header.h_revision = REV_INITIAL;
- assert(stm_read_int1( &s1, offsetof(S1, value1 )) == 49);
- assert(stm_read_int2( &s1, offsetof(S1, value2 )) == 3981);
- assert(stm_read_int4( &s1, offsetof(S1, value4 )) == 4204229);
- assert(stm_read_int8( &s1, offsetof(S1, value8))== 3419103092099219LL);
- assert(stm_read_int8f(&s1, offsetof(S1, value8f)) == 289.25);
- assert(stm_read_int4f(&s1, offsetof(S1, value4f)) == -5.5);
+ p2 = STM_BARRIER_P2R(&s1);
+ assert(p2 == &s1);
+
+ p2 = STM_BARRIER_G2R(&s1);
+ assert(p2 == &s1);
}
- s1.header.h_tid = GCFLAG_GLOBAL | GCFLAG_WAS_COPIED;
- s1.header.h_version = NULL;
- s2.header.h_tid = GCFLAG_WAS_COPIED;
- s2.header.h_version = &s1;
- s2.value1 = -49;
- s2.value2 = -3981;
- s2.value4 = -4204229;
- s2.value8 = -3419103092099219LL;
- s2.value8f = -289.25;
- s2.value4f = 5.5;
- stm_tldict_add(&s1, &s2);
+ s1.header.h_tid = GCFLAG_PREBUILT | GCFLAG_POSSIBLY_OUTDATED;
+ s1.header.h_revision = REV_INITIAL;
+ s2.header.h_tid = GCFLAG_LOCAL_COPY;
+ s2.header.h_revision = (revision_t)&s1;
+ stm_tldict_add(&s1.header, &s2.header);
- assert(stm_read_int1( &s1, offsetof(S1, value1 )) == -49);
- assert(stm_read_int2( &s1, offsetof(S1, value2 )) == -3981);
- assert(stm_read_int4( &s1, offsetof(S1, value4 )) == -4204229);
- assert(stm_read_int8( &s1, offsetof(S1, value8)) == -3419103092099219LL);
- assert(stm_read_int8f(&s1, offsetof(S1, value8f)) == -289.25);
- assert(stm_read_int4f(&s1, offsetof(S1, value4f)) == 5.5);
+ p2 = STM_BARRIER_P2R(&s1);
+ assert(p2 == &s2);
+
+ p2 = STM_BARRIER_G2R(&s1);
+ assert(p2 == &s2);
+
+ p2 = STM_BARRIER_O2R(&s1);
+ assert(p2 == &s2);
+
+ p2 = STM_BARRIER_P2R(&s2);
+ assert(p2 == &s2);
+
+ p2 = STM_BARRIER_O2R(&s2);
+ assert(p2 == &s2);
+
stm_abort_and_retry();
}
void test_read_transaction(void) { run_in_transaction(read_transaction, 1); }
@@ -273,65 +257,44 @@
/************************************************************/
int sg_seen = 0;
-S1 sg_global;
-void size_getter(void)
+S1 sg_global, sg_local;
+void duplicator(void)
{
- S1 *s2 = malloc(sizeof(S1));
+ S1 *s2;
int i;
- sg_global.header.h_tid = GCFLAG_GLOBAL | GCFLAG_WAS_COPIED;
- sg_global.header.h_version = NULL;
- s2->header.h_tid = GCFLAG_WAS_COPIED;
- s2->header.h_version = &sg_global;
- for (i=0; i<16; i++)
- s2->last_16_bytes[i] = 'A' + i;
- stm_tldict_add(&sg_global, s2);
+ sg_global.header.h_tid = GCFLAG_PREBUILT | GCFLAG_POSSIBLY_OUTDATED;
+ sg_global.header.h_revision = REV_INITIAL;
+ sg_global.value1 = 123;
+
+ s2 = STM_BARRIER_P2W(&sg_global);
+ assert(s2 == &sg_local);
+ assert(s2->header.h_tid == GCFLAG_LOCAL_COPY);
+ assert(s2->header.h_revision == (revision_t)&sg_global);
+ assert(s2->value1 == 123);
+
+ /* simulate PerformLocalCollect */
+ _FakeReach(&s2->header);
}
-long size_getter_cb(gcptr x)
+gcptr duplicator_cb(gcptr x)
{
- return offsetof(S1, last_16_bytes) + 15;
+ assert(x == &sg_global);
+ sg_local = sg_global;
+ return &sg_local;
}
-void test_size_getter(void)
+void test_duplicator(void)
{
- int i;
- cb_getsize = size_getter_cb;
- sg_global.last_16_bytes[15] = '!';
- run_in_transaction(size_getter, '.');
- for (i=0; i<15; i++)
- assert(sg_global.last_16_bytes[i] == 'A' + i);
- assert(sg_global.last_16_bytes[15] == '!'); /* not overwritten */
+ cb_duplicate = duplicator_cb;
+ run_in_transaction(duplicator, '.');
}
/************************************************************/
-void copy_transactional_to_raw(void)
-{
- S1 s1, s2;
- int i;
- s1.header.h_tid = GCFLAG_GLOBAL | 99;
- s1.header.h_version = NULL;
- for (i=0; i<16; i++)
- s1.last_16_bytes[i] = 'A' + i;
- s2.header.h_tid = 101;
- s2.last_16_bytes[15] = '!';
- stm_copy_transactional_to_raw(&s1, &s2, offsetof(S1, last_16_bytes) + 15);
- for (i=0; i<15; i++)
- assert(s2.last_16_bytes[i] == 'A' + i);
- assert(s2.last_16_bytes[15] == '!'); /* not overwritten */
- assert(s2.header.h_tid = 101); /* not overwritten */
-}
-void test_copy_transactional_to_raw(void) {
- run_in_transaction(copy_transactional_to_raw, '.');
-}
-#endif
-
-/************************************************************/
-
void try_inevitable(void)
{
assert(stm_in_transaction() == 1);
assert(!stm_is_inevitable());
/* not really testing anything more than the presence of the function */
- stm_try_inevitable(STM_EXPLAIN1("some explanation"));
+ BecomeInevitable("some explanation");
assert(stm_is_inevitable());
}
void test_try_inevitable(void)
@@ -359,7 +322,8 @@
s1[i].value1 = 48+i;
}
for (i=0; i<15; i++) {
- assert(stm_read_int1(s1+i, offsetof(S1, value1)) == 48+i);
+ S1 *p = STM_BARRIER_P2R(&s1[i]);
+ assert(p->value1 == 48+i);
assert(stm_should_break_transaction() == ((i+1) >= 10));
}
}
@@ -378,8 +342,7 @@
int main(int argc, char **argv)
{
- long res = stm_descriptor_init();
- assert(res == 1);
+ DescriptorInit();
XTEST(set_get_del);
XTEST(run_all_transactions);
XTEST(tldict);
@@ -388,8 +351,7 @@
XTEST(enum_tldict_nonempty);
XTEST(read_main_thread);
XTEST(read_transaction);
- XTEST(size_getter);
- XTEST(copy_transactional_to_raw);
+ XTEST(duplicator);
XTEST(try_inevitable);
XTEST(should_break_transaction);
printf("bad test name\n");
More information about the pypy-commit
mailing list