|
From: <sv...@va...> - 2009-05-24 07:20:32
|
Author: bart
Date: 2009-05-24 08:20:24 +0100 (Sun, 24 May 2009)
New Revision: 10127
Log:
Swapped the order of segment creation and vector clock combining.
Modified:
branches/DRDDEV/drd/drd_barrier.c
branches/DRDDEV/drd/drd_mutex.c
branches/DRDDEV/drd/drd_rwlock.c
branches/DRDDEV/drd/drd_semaphore.c
Modified: branches/DRDDEV/drd/drd_barrier.c
===================================================================
--- branches/DRDDEV/drd/drd_barrier.c 2009-05-24 07:18:36 UTC (rev 10126)
+++ branches/DRDDEV/drd/drd_barrier.c 2009-05-24 07:20:24 UTC (rev 10127)
@@ -456,6 +456,12 @@
VG_(OSetGen_Insert)(p->oset, q);
tl_assert(VG_(OSetGen_Lookup)(p->oset, &word_tid) == q);
}
+
+ /* Create a new segment and store a pointer to that segment. */
+ DRD_(thread_new_segment)(tid);
+ DRD_(thread_get_latest_segment)(&q->post_wait_sg, tid);
+ s_barrier_segment_creation_count++;
+
/*
* Combine all vector clocks that were stored in the pre_barrier_wait
* wrapper with the vector clock of the current thread.
@@ -478,11 +484,6 @@
DRD_(vc_cleanup)(&old_vc);
}
- /* Create a new segment and store a pointer to that segment. */
- DRD_(thread_new_segment)(tid);
- DRD_(thread_get_latest_segment)(&q->post_wait_sg, tid);
- s_barrier_segment_creation_count++;
-
/*
* If the same number of threads as the barrier count indicates have
* called the post *_barrier_wait() wrapper, toggle p->post_iteration and
Modified: branches/DRDDEV/drd/drd_mutex.c
===================================================================
--- branches/DRDDEV/drd/drd_mutex.c 2009-05-24 07:18:36 UTC (rev 10126)
+++ branches/DRDDEV/drd/drd_mutex.c 2009-05-24 07:20:24 UTC (rev 10127)
@@ -305,13 +305,14 @@
{
const DrdThreadId last_owner = p->owner;
+ DRD_(thread_new_segment)(drd_tid);
+ s_mutex_segment_creation_count++;
+
if (last_owner != drd_tid && last_owner != DRD_INVALID_THREADID)
{
tl_assert(p->last_locked_segment);
DRD_(thread_combine_vc_sync)(drd_tid, p->last_locked_segment);
}
- DRD_(thread_new_segment)(drd_tid);
- s_mutex_segment_creation_count++;
p->owner = drd_tid;
p->acquiry_time_ms = VG_(read_millisecond_timer)();
Modified: branches/DRDDEV/drd/drd_rwlock.c
===================================================================
--- branches/DRDDEV/drd/drd_rwlock.c 2009-05-24 07:18:36 UTC (rev 10126)
+++ branches/DRDDEV/drd/drd_rwlock.c 2009-05-24 07:20:24 UTC (rev 10127)
@@ -385,11 +385,12 @@
q = DRD_(lookup_or_insert_node)(p->thread_info, drd_tid);
if (++q->reader_nesting_count == 1)
{
- DRD_(rwlock_combine_other_vc)(p, drd_tid, False);
- q->last_lock_was_writer_lock = False;
DRD_(thread_new_segment)(drd_tid);
DRD_(s_rwlock_segment_creation_count)++;
+ DRD_(rwlock_combine_other_vc)(p, drd_tid, False);
+ q->last_lock_was_writer_lock = False;
+
p->acquiry_time_ms = VG_(read_millisecond_timer)();
p->acquired_at = VG_(record_ExeContext)(VG_(get_running_tid)(), 0);
}
Modified: branches/DRDDEV/drd/drd_semaphore.c
===================================================================
--- branches/DRDDEV/drd/drd_semaphore.c 2009-05-24 07:18:36 UTC (rev 10126)
+++ branches/DRDDEV/drd/drd_semaphore.c 2009-05-24 07:20:24 UTC (rev 10127)
@@ -299,14 +299,15 @@
tl_assert(sg);
if (sg)
{
+ DRD_(thread_new_segment)(tid);
+ s_semaphore_segment_creation_count++;
+
if (p->last_sem_post_tid != tid
&& p->last_sem_post_tid != DRD_INVALID_THREADID)
{
DRD_(thread_combine_vc_sync)(tid, sg);
}
DRD_(sg_put)(sg);
- DRD_(thread_new_segment)(tid);
- s_semaphore_segment_creation_count++;
}
}
}
|