Author: Armin Rigo <[email protected]>
Branch: stmgc-c8
Changeset: r76294:c92a99a4f5f0
Date: 2015-03-10 15:57 +0100
http://bitbucket.org/pypy/pypy/changeset/c92a99a4f5f0/
Log: import stmgc (branch c8-marker)
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 @@
-321802556392
+a4e4d3ad014a
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
@@ -464,7 +464,7 @@
static void wait_for_other_inevitable(struct stm_commit_log_entry_s *old)
{
- timing_wait_other_inevitable();
+ timing_event(STM_SEGMENT->running_thread, STM_WAIT_OTHER_INEVITABLE);
while (old->next == INEV_RUNNING && !safe_point_requested()) {
spin_loop();
@@ -1171,7 +1171,7 @@
/************************************************************/
-static void _finish_transaction(enum stm_event_e event, bool was_inev)
+static void _finish_transaction(enum stm_event_e event)
{
stm_thread_local_t *tl = STM_SEGMENT->running_thread;
@@ -1182,10 +1182,7 @@
list_clear(STM_PSEGMENT->objects_pointing_to_nursery);
list_clear(STM_PSEGMENT->old_objects_with_cards_set);
list_clear(STM_PSEGMENT->large_overflow_objects);
- if (was_inev)
- timing_commit_inev_position();
- else
- timing_event(tl, event);
+ timing_event(tl, event);
release_thread_segment(tl);
/* cannot access STM_SEGMENT or STM_PSEGMENT from here ! */
@@ -1285,7 +1282,7 @@
/* done */
stm_thread_local_t *tl = STM_SEGMENT->running_thread;
- _finish_transaction(STM_TRANSACTION_COMMIT, was_inev);
+ _finish_transaction(STM_TRANSACTION_COMMIT);
/* cannot access STM_SEGMENT or STM_PSEGMENT from here ! */
s_mutex_unlock();
@@ -1420,7 +1417,7 @@
: NURSERY_END;
}
- _finish_transaction(STM_TRANSACTION_ABORT, false);
+ _finish_transaction(STM_TRANSACTION_ABORT);
/* cannot access STM_SEGMENT or STM_PSEGMENT from here ! */
return tl;
@@ -1459,10 +1456,10 @@
if (STM_PSEGMENT->transaction_state == TS_REGULAR) {
dprintf(("become_inevitable: %s\n", msg));
_stm_collectable_safe_point();
+ timing_become_inevitable();
_validate_and_turn_inevitable();
STM_PSEGMENT->transaction_state = TS_INEVITABLE;
- timing_record_inev_position();
stm_rewind_jmp_forget(STM_SEGMENT->running_thread);
invoke_and_clear_user_callbacks(0); /* for commit */
diff --git a/rpython/translator/stm/src_stm/stm/core.h
b/rpython/translator/stm/src_stm/stm/core.h
--- a/rpython/translator/stm/src_stm/stm/core.h
+++ b/rpython/translator/stm/src_stm/stm/core.h
@@ -141,9 +141,6 @@
pthread_t running_pthread;
#endif
- /* marker where this thread became inevitable */
- stm_loc_marker_t marker_inev;
-
/* light finalizers */
struct list_s *young_objects_with_light_finalizers;
struct list_s *old_objects_with_light_finalizers;
diff --git a/rpython/translator/stm/src_stm/stm/gcpage.c
b/rpython/translator/stm/src_stm/stm/gcpage.c
--- a/rpython/translator/stm/src_stm/stm/gcpage.c
+++ b/rpython/translator/stm/src_stm/stm/gcpage.c
@@ -408,9 +408,6 @@
if (modified->type == TYPE_POSITION_MARKER)
mark_visit_possibly_new_object(modified->marker_object, pseg);
}
-
- if (pseg->transaction_state == TS_INEVITABLE)
- mark_visit_possibly_new_object(pseg->marker_inev.object, pseg);
}
}
diff --git a/rpython/translator/stm/src_stm/stm/marker.c
b/rpython/translator/stm/src_stm/stm/marker.c
--- a/rpython/translator/stm/src_stm/stm/marker.c
+++ b/rpython/translator/stm/src_stm/stm/marker.c
@@ -89,32 +89,12 @@
STM_CONTENTION_WRITE_READ, &marker);
}
-static void _timing_record_inev_position(void)
+static void _timing_become_inevitable(void)
{
stm_loc_marker_t marker;
marker_fetch(STM_SEGMENT->running_thread, &marker);
- STM_PSEGMENT->marker_inev.odd_number = marker.odd_number;
- STM_PSEGMENT->marker_inev.object = marker.object;
-}
-
-static void _timing_commit_inev_position(void)
-{
- stm_loc_marker_t marker;
- marker.odd_number = STM_PSEGMENT->marker_inev.odd_number;
- marker.object = STM_PSEGMENT->marker_inev.object;
stmcb_timing_event(STM_SEGMENT->running_thread,
- STM_TRANSACTION_COMMIT, &marker);
-}
-
-static void timing_wait_other_inevitable(void)
-{
- if (stmcb_timing_event == NULL)
- return;
-
- stm_loc_marker_t marker;
- marker_fetch(STM_SEGMENT->running_thread, &marker);
- stmcb_timing_event(STM_SEGMENT->running_thread,
- STM_WAIT_OTHER_INEVITABLE, &marker);
+ STM_BECOME_INEVITABLE, &marker);
}
diff --git a/rpython/translator/stm/src_stm/stm/marker.h
b/rpython/translator/stm/src_stm/stm/marker.h
--- a/rpython/translator/stm/src_stm/stm/marker.h
+++ b/rpython/translator/stm/src_stm/stm/marker.h
@@ -2,9 +2,7 @@
static void _timing_record_write_position(void);
static void timing_write_read_contention(struct stm_undo_s *start,
struct stm_undo_s *contention);
-static void _timing_record_inev_position(void);
-static void _timing_commit_inev_position(void);
-static void timing_wait_other_inevitable(void);
+static void _timing_become_inevitable(void);
#define timing_enabled() (stmcb_timing_event != NULL)
@@ -15,8 +13,5 @@
#define timing_record_write_position() \
(timing_enabled() ? _timing_record_write_position() : (void)0)
-#define timing_record_inev_position() \
- (timing_enabled() ? _timing_record_inev_position() : (void)0)
-
-#define timing_commit_inev_position() \
- (timing_enabled() ? _timing_commit_inev_position() : (void)0)
+#define timing_become_inevitable() \
+ (timing_enabled() ? _timing_become_inevitable() : (void)0)
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
@@ -425,13 +425,6 @@
if (undo->type == TYPE_POSITION_MARKER)
minor_trace_if_young(&undo->marker_object);
}
-
- if (STM_PSEGMENT->transaction_state == TS_INEVITABLE) {
- object_t **pmarker_inev_obj = (object_t **)
- REAL_ADDRESS(STM_SEGMENT->segment_base,
- &STM_PSEGMENT->marker_inev.object);
- minor_trace_if_young(pmarker_inev_obj);
- }
}
static void collect_objs_still_young_but_with_finalizers(void)
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
@@ -354,11 +354,12 @@
saying where the write was done. Followed by STM_TRANSACTION_ABORT. */
STM_CONTENTION_WRITE_READ,
- /* inevitable contention: the thread that waited is
- STM_WAIT_OTHER_INEVITABLE (with a marker) and the thread that
- it waited for is the next STM_TRANSACTION_COMMIT (with a marker
- as well; both markers point to the place that made each
- transaction inevitable). */
+ /* inevitable contention: all threads that try to become inevitable
+ have a STM_BECOME_INEVITABLE event with a position marker. Then,
+ if it waits it gets a STM_WAIT_OTHER_INEVITABLE. It is possible
+ that a thread gets STM_BECOME_INEVITABLE followed by
+ STM_TRANSACTION_ABORT if it fails to become inevitable. */
+ STM_BECOME_INEVITABLE,
/* always one STM_WAIT_xxx followed later by STM_WAIT_DONE */
STM_WAIT_FREE_SEGMENT,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit