Author: Armin Rigo <[email protected]>
Branch: stmgc-c7
Changeset: r69794:82f2ddadfc97
Date: 2014-03-08 10:33 +0100
http://bitbucket.org/pypy/pypy/changeset/82f2ddadfc97/
Log: import stmgc/d0f79129cbb7
diff --git a/rpython/translator/stm/src_stm/revision
b/rpython/translator/stm/src_stm/revision
--- a/rpython/translator/stm/src_stm/revision
+++ b/rpython/translator/stm/src_stm/revision
@@ -1,1 +1,1 @@
-202ea90b3c60
+d0f79129cbb7
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
@@ -474,6 +474,10 @@
stm_thread_local_t *tl = pseg->pub.running_thread;
tl->shadowstack = pseg->shadowstack_at_start_of_transaction;
tl->thread_local_obj = pseg->threadlocal_at_start_of_transaction;
+
+ /* reset these lists to NULL too on abort */
+ LIST_FREE(pseg->objects_pointing_to_nursery);
+ LIST_FREE(pseg->large_overflow_objects);
}
static void abort_with_mutex(void)
diff --git a/rpython/translator/stm/src_stm/stm/list.h
b/rpython/translator/stm/src_stm/stm/list.h
--- a/rpython/translator/stm/src_stm/stm/list.h
+++ b/rpython/translator/stm/src_stm/stm/list.h
@@ -1,5 +1,6 @@
/* Imported by rpython/translator/stm/import_stmgc.py */
#include <stdlib.h>
+#include <stdbool.h>
/************************************************************/
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
@@ -49,8 +49,9 @@
tree_contains(STM_PSEGMENT->young_outside_nursery, (uintptr_t)obj));
}
-bool _stm_in_nursery(object_t *obj)
+long stm_can_move(object_t *obj)
{
+ /* 'long' return value to avoid using 'bool' in the public interface */
return _is_in_nursery(obj);
}
diff --git a/rpython/translator/stm/src_stm/stmgc.h
b/rpython/translator/stm/src_stm/stmgc.h
--- a/rpython/translator/stm/src_stm/stmgc.h
+++ b/rpython/translator/stm/src_stm/stmgc.h
@@ -10,7 +10,6 @@
#include <stddef.h>
#include <stdint.h>
-#include <stdbool.h>
#include <assert.h>
#include <limits.h>
#include <unistd.h>
@@ -73,10 +72,10 @@
object_t *_stm_allocate_old(ssize_t size_rounded_up);
char *_stm_real_address(object_t *o);
#ifdef STM_TESTS
+#include <stdbool.h>
bool _stm_was_read(object_t *obj);
bool _stm_was_written(object_t *obj);
uint8_t _stm_get_page_flag(uintptr_t index);
-bool _stm_in_nursery(object_t *obj);
bool _stm_in_transaction(stm_thread_local_t *tl);
char *_stm_get_segment_base(long index);
void _stm_test_switch(stm_thread_local_t *tl);
@@ -109,8 +108,8 @@
#else
#define OPT_ASSERT(cond) assert(cond)
#endif
-#define LIKELY(x) __builtin_expect(x, true)
-#define UNLIKELY(x) __builtin_expect(x, false)
+#define LIKELY(x) __builtin_expect(x, 1)
+#define UNLIKELY(x) __builtin_expect(x, 0)
#define IMPLY(a, b) (!(a) || (b))
@@ -270,6 +269,10 @@
long stm_id(object_t *obj);
void stm_set_prebuilt_identityhash(object_t *obj, uint64_t hash);
+/* Returns 1 if the object can still move (it's in the nursery), or 0
+ otherwise. After a minor collection no object can move any more. */
+long stm_can_move(object_t *);
+
/* ==================== END ==================== */
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit