bart | 922304f | 2011-03-13 12:02:44 +0000 | [diff] [blame] | 1 | /* -*- mode: C; c-basic-offset: 3; indent-tabs-mode: nil; -*- */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 2 | /* |
bart | 86562bd | 2009-02-16 19:43:56 +0000 | [diff] [blame] | 3 | This file is part of drd, a thread error detector. |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 4 | |
bart | 922304f | 2011-03-13 12:02:44 +0000 | [diff] [blame] | 5 | Copyright (C) 2006-2011 Bart Van Assche <bvanassche@acm.org>. |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 6 | |
| 7 | This program is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU General Public License as |
| 9 | published by the Free Software Foundation; either version 2 of the |
| 10 | License, or (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, but |
| 13 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 20 | 02111-1307, USA. |
| 21 | |
| 22 | The GNU General Public License is contained in the file COPYING. |
| 23 | */ |
| 24 | |
| 25 | |
| 26 | #include "drd_barrier.h" |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 27 | #include "drd_clientobj.h" |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 28 | #include "drd_error.h" |
| 29 | #include "drd_suppression.h" |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 30 | #include "pub_tool_errormgr.h" // VG_(maybe_record_error)() |
| 31 | #include "pub_tool_libcassert.h" // tl_assert() |
| 32 | #include "pub_tool_libcprint.h" // VG_(printf)() |
| 33 | #include "pub_tool_machine.h" // VG_(get_IP)() |
| 34 | #include "pub_tool_mallocfree.h" // VG_(malloc)(), VG_(free)() |
| 35 | #include "pub_tool_oset.h" |
| 36 | #include "pub_tool_threadstate.h" // VG_(get_running_tid)() |
| 37 | |
| 38 | |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 39 | /* Type definitions. */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 40 | |
bart | 8ddef88 | 2008-03-09 08:48:01 +0000 | [diff] [blame] | 41 | /** Information associated with one thread participating in a barrier. */ |
bart | bebc5d6 | 2008-02-24 18:42:53 +0000 | [diff] [blame] | 42 | struct barrier_thread_info |
| 43 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 44 | UWord tid; // A DrdThreadId declared as UWord because |
bart | 62cc232 | 2010-03-07 10:54:21 +0000 | [diff] [blame] | 45 | // this member variable is the key of an OSet. |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 46 | Segment* sg; // Segment of the last pthread_barrier() call |
| 47 | // by thread tid. |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 48 | Segment* post_wait_sg; // Segment created after *_barrier_wait() finished |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 49 | ExeContext* wait_call_ctxt;// call stack for *_barrier_wait() call. |
| 50 | Bool thread_finished;// Whether thread 'tid' has finished. |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 54 | /* Local functions. */ |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 55 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 56 | static void barrier_cleanup(struct barrier_info* p); |
| 57 | static void barrier_delete_thread(struct barrier_info* const p, |
| 58 | const DrdThreadId tid); |
| 59 | static const char* barrier_get_typename(struct barrier_info* const p); |
| 60 | static const char* barrier_type_name(const BarrierT bt); |
| 61 | static |
| 62 | void barrier_report_wait_delete_race(const struct barrier_info* const p, |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 63 | const struct barrier_thread_info* const q); |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 64 | |
| 65 | |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 66 | /* Local variables. */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 67 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 68 | static Bool s_trace_barrier = False; |
| 69 | static ULong s_barrier_segment_creation_count; |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 70 | |
| 71 | |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 72 | /* Function definitions. */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 73 | |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 74 | void DRD_(barrier_set_trace)(const Bool trace_barrier) |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 75 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 76 | s_trace_barrier = trace_barrier; |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 77 | } |
| 78 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 79 | /** |
| 80 | * Initialize the structure *p with the specified thread ID and iteration |
| 81 | * information. |
| 82 | */ |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 83 | static |
| 84 | void DRD_(barrier_thread_initialize)(struct barrier_thread_info* const p, |
bart | cdc3fdb | 2011-07-29 12:31:33 +0000 | [diff] [blame] | 85 | const DrdThreadId tid) |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 86 | { |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 87 | p->tid = tid; |
| 88 | p->sg = NULL; |
| 89 | p->post_wait_sg = 0; |
| 90 | p->wait_call_ctxt = 0; |
| 91 | p->thread_finished = False; |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 92 | } |
| 93 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 94 | /** |
| 95 | * Deallocate the memory that is owned by members of |
| 96 | * struct barrier_thread_info. |
| 97 | */ |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 98 | static void DRD_(barrier_thread_destroy)(struct barrier_thread_info* const p) |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 99 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 100 | tl_assert(p); |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 101 | DRD_(sg_put)(p->sg); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 102 | DRD_(sg_put)(p->post_wait_sg); |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 103 | } |
| 104 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 105 | /** |
| 106 | * Initialize the structure *p with the specified client-side barrier address, |
| 107 | * barrier object size and number of participants in each barrier. |
| 108 | */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 109 | static |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 110 | void DRD_(barrier_initialize)(struct barrier_info* const p, |
| 111 | const Addr barrier, |
| 112 | const BarrierT barrier_type, |
| 113 | const Word count) |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 114 | { |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 115 | int i; |
| 116 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 117 | tl_assert(barrier != 0); |
| 118 | tl_assert(barrier_type == pthread_barrier || barrier_type == gomp_barrier); |
| 119 | tl_assert(p->a1 == barrier); |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 120 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 121 | p->cleanup = (void(*)(DrdClientobj*))barrier_cleanup; |
| 122 | p->delete_thread |
| 123 | = (void(*)(DrdClientobj*, DrdThreadId))barrier_delete_thread; |
| 124 | p->barrier_type = barrier_type; |
| 125 | p->count = count; |
| 126 | p->pre_iteration = 0; |
| 127 | p->post_iteration = 0; |
| 128 | p->pre_waiters_left = count; |
| 129 | p->post_waiters_left = count; |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 130 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 131 | tl_assert(sizeof(((struct barrier_thread_info*)0)->tid) == sizeof(Word)); |
| 132 | tl_assert(sizeof(((struct barrier_thread_info*)0)->tid) |
| 133 | >= sizeof(DrdThreadId)); |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 134 | for (i = 0; i < 2; i++) { |
| 135 | p->oset[i] = VG_(OSetGen_Create)(0, 0, VG_(malloc), "drd.barrier.bi.1", |
| 136 | VG_(free)); |
| 137 | } |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 138 | } |
| 139 | |
bart | 195e41f | 2009-02-15 11:34:57 +0000 | [diff] [blame] | 140 | /** |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 141 | * Deallocate the memory owned by the struct barrier_info object and also |
| 142 | * all the nodes in the OSet p->oset. |
| 143 | * |
bart | 195e41f | 2009-02-15 11:34:57 +0000 | [diff] [blame] | 144 | * Called by clientobj_destroy(). |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 145 | */ |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 146 | static void barrier_cleanup(struct barrier_info* p) |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 147 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 148 | struct barrier_thread_info* q; |
| 149 | Segment* latest_sg = 0; |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 150 | OSet* oset; |
| 151 | int i; |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 152 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 153 | tl_assert(p); |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 154 | |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 155 | DRD_(thread_get_latest_segment)(&latest_sg, DRD_(thread_get_running_tid)()); |
| 156 | tl_assert(latest_sg); |
| 157 | |
| 158 | if (p->pre_waiters_left != p->count) { |
bart | d45d995 | 2009-05-31 18:53:54 +0000 | [diff] [blame] | 159 | BarrierErrInfo bei = { DRD_(thread_get_running_tid)(), p->a1, 0, 0 }; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 160 | VG_(maybe_record_error)(VG_(get_running_tid)(), |
| 161 | BarrierErr, |
| 162 | VG_(get_IP)(VG_(get_running_tid)()), |
| 163 | "Destruction of barrier that is being waited" |
| 164 | " upon", |
| 165 | &bei); |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 166 | } else { |
bart | d378eaa | 2011-07-30 09:35:56 +0000 | [diff] [blame] | 167 | oset = p->oset[1 - (p->pre_iteration & 1)]; |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 168 | VG_(OSetGen_ResetIter)(oset); |
| 169 | for ( ; (q = VG_(OSetGen_Next)(oset)) != 0; ) { |
| 170 | if (q->post_wait_sg && !DRD_(vc_lte)(&q->post_wait_sg->vc, |
| 171 | &latest_sg->vc)) |
| 172 | { |
| 173 | barrier_report_wait_delete_race(p, q); |
| 174 | } |
| 175 | DRD_(barrier_thread_destroy)(q); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 176 | } |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 177 | } |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 178 | |
| 179 | for (i = 0; i < 2; i++) { |
| 180 | VG_(OSetGen_Destroy)(p->oset[i]); |
| 181 | p->oset[i] = NULL; |
| 182 | } |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 183 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 184 | DRD_(sg_put)(latest_sg); |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 185 | } |
| 186 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 187 | /** |
| 188 | * Look up the client-side barrier address barrier in s_barrier[]. If not |
| 189 | * found, add it. |
| 190 | */ |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 191 | static |
| 192 | struct barrier_info* |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 193 | DRD_(barrier_get_or_allocate)(const Addr barrier, |
| 194 | const BarrierT barrier_type, const Word count) |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 195 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 196 | struct barrier_info *p; |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 197 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 198 | tl_assert(barrier_type == pthread_barrier || barrier_type == gomp_barrier); |
bart | 0268dfa | 2008-03-11 20:10:21 +0000 | [diff] [blame] | 199 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 200 | tl_assert(offsetof(DrdClientobj, barrier) == 0); |
| 201 | p = &(DRD_(clientobj_get)(barrier, ClientBarrier)->barrier); |
| 202 | if (p == 0) |
| 203 | { |
| 204 | p = &(DRD_(clientobj_add)(barrier, ClientBarrier)->barrier); |
| 205 | DRD_(barrier_initialize)(p, barrier, barrier_type, count); |
| 206 | } |
| 207 | return p; |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 208 | } |
| 209 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 210 | /** |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 211 | * Look up the address of the struct barrier_info associated with the |
| 212 | * client-side barrier object. |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 213 | */ |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 214 | static struct barrier_info* DRD_(barrier_get)(const Addr barrier) |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 215 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 216 | tl_assert(offsetof(DrdClientobj, barrier) == 0); |
| 217 | return &(DRD_(clientobj_get)(barrier, ClientBarrier)->barrier); |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 218 | } |
| 219 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 220 | /** |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 221 | * Initialize a barrier with given client address, barrier type and number of |
| 222 | * participants. The 'reinitialization' argument indicates whether a barrier |
| 223 | * object is being initialized or reinitialized. |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 224 | * |
| 225 | * Called before pthread_barrier_init(). |
bart | 28230a3 | 2008-02-29 17:27:03 +0000 | [diff] [blame] | 226 | */ |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 227 | void DRD_(barrier_init)(const Addr barrier, |
| 228 | const BarrierT barrier_type, const Word count, |
| 229 | const Bool reinitialization) |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 230 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 231 | struct barrier_info* p; |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 232 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 233 | tl_assert(barrier_type == pthread_barrier || barrier_type == gomp_barrier); |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 234 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 235 | if (count == 0) |
| 236 | { |
bart | d45d995 | 2009-05-31 18:53:54 +0000 | [diff] [blame] | 237 | BarrierErrInfo bei = { DRD_(thread_get_running_tid)(), barrier, 0, 0 }; |
bart | d9e39ec | 2008-06-28 15:03:26 +0000 | [diff] [blame] | 238 | VG_(maybe_record_error)(VG_(get_running_tid)(), |
| 239 | BarrierErr, |
| 240 | VG_(get_IP)(VG_(get_running_tid)()), |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 241 | "pthread_barrier_init: 'count' argument is zero", |
bart | d9e39ec | 2008-06-28 15:03:26 +0000 | [diff] [blame] | 242 | &bei); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 243 | } |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 244 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 245 | if (! reinitialization && barrier_type == pthread_barrier) |
| 246 | { |
| 247 | p = DRD_(barrier_get)(barrier); |
| 248 | if (p) |
| 249 | { |
bart | d45d995 | 2009-05-31 18:53:54 +0000 | [diff] [blame] | 250 | BarrierErrInfo bei = { DRD_(thread_get_running_tid)(), barrier, 0, 0 }; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 251 | VG_(maybe_record_error)(VG_(get_running_tid)(), |
| 252 | BarrierErr, |
| 253 | VG_(get_IP)(VG_(get_running_tid)()), |
| 254 | "Barrier reinitialization", |
| 255 | &bei); |
| 256 | } |
| 257 | } |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 258 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 259 | p = DRD_(barrier_get_or_allocate)(barrier, barrier_type, count); |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 260 | |
bart | b92ff0f | 2011-10-08 08:29:29 +0000 | [diff] [blame^] | 261 | if (s_trace_barrier) { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 262 | if (reinitialization) |
bart | b92ff0f | 2011-10-08 08:29:29 +0000 | [diff] [blame^] | 263 | DRD_(trace_msg)("[%d] barrier_reinit %s 0x%lx count %ld -> %ld\n", |
| 264 | DRD_(thread_get_running_tid)(), |
| 265 | barrier_get_typename(p), barrier, p->count, count); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 266 | else |
bart | b92ff0f | 2011-10-08 08:29:29 +0000 | [diff] [blame^] | 267 | DRD_(trace_msg)("[%d] barrier_init %s 0x%lx\n", |
| 268 | DRD_(thread_get_running_tid)(), |
| 269 | barrier_get_typename(p), |
| 270 | barrier); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | if (reinitialization && p->count != count) |
| 274 | { |
| 275 | if (p->pre_waiters_left != p->count || p->post_waiters_left != p->count) |
| 276 | { |
bart | d45d995 | 2009-05-31 18:53:54 +0000 | [diff] [blame] | 277 | BarrierErrInfo bei = { DRD_(thread_get_running_tid)(), p->a1, 0, 0 }; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 278 | VG_(maybe_record_error)(VG_(get_running_tid)(), |
| 279 | BarrierErr, |
| 280 | VG_(get_IP)(VG_(get_running_tid)()), |
| 281 | "Reinitialization of barrier with active" |
| 282 | " waiters", |
| 283 | &bei); |
| 284 | } |
| 285 | p->count = count; |
| 286 | } |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 287 | } |
| 288 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 289 | /** Called after pthread_barrier_destroy() / gomp_barrier_destroy(). */ |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 290 | void DRD_(barrier_destroy)(const Addr barrier, const BarrierT barrier_type) |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 291 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 292 | struct barrier_info* p; |
bart | 72b751c | 2008-03-01 13:44:24 +0000 | [diff] [blame] | 293 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 294 | p = DRD_(barrier_get)(barrier); |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 295 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 296 | if (s_trace_barrier) |
bart | b92ff0f | 2011-10-08 08:29:29 +0000 | [diff] [blame^] | 297 | DRD_(trace_msg)("[%d] barrier_destroy %s 0x%lx\n", |
| 298 | DRD_(thread_get_running_tid)(), |
| 299 | barrier_get_typename(p), barrier); |
bart | 72b751c | 2008-03-01 13:44:24 +0000 | [diff] [blame] | 300 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 301 | if (p == 0) |
| 302 | { |
bart | 62cc232 | 2010-03-07 10:54:21 +0000 | [diff] [blame] | 303 | GenericErrInfo GEI = { |
| 304 | .tid = DRD_(thread_get_running_tid)(), |
| 305 | .addr = barrier, |
| 306 | }; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 307 | VG_(maybe_record_error)(VG_(get_running_tid)(), |
| 308 | GenericErr, |
| 309 | VG_(get_IP)(VG_(get_running_tid)()), |
| 310 | "Not a barrier", |
| 311 | &GEI); |
| 312 | return; |
| 313 | } |
bart | 72b751c | 2008-03-01 13:44:24 +0000 | [diff] [blame] | 314 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 315 | if (p->pre_waiters_left != p->count || p->post_waiters_left != p->count) |
| 316 | { |
bart | d45d995 | 2009-05-31 18:53:54 +0000 | [diff] [blame] | 317 | BarrierErrInfo bei = { DRD_(thread_get_running_tid)(), p->a1, 0, 0 }; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 318 | VG_(maybe_record_error)(VG_(get_running_tid)(), |
| 319 | BarrierErr, |
| 320 | VG_(get_IP)(VG_(get_running_tid)()), |
| 321 | "Destruction of a barrier with active waiters", |
| 322 | &bei); |
| 323 | } |
bart | 195a398 | 2008-07-01 13:15:31 +0000 | [diff] [blame] | 324 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 325 | DRD_(clientobj_remove)(p->a1, ClientBarrier); |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 326 | } |
| 327 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 328 | /** Called before pthread_barrier_wait() / gomp_barrier_wait(). */ |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 329 | void DRD_(barrier_pre_wait)(const DrdThreadId tid, const Addr barrier, |
| 330 | const BarrierT barrier_type) |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 331 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 332 | struct barrier_info* p; |
| 333 | struct barrier_thread_info* q; |
| 334 | const UWord word_tid = tid; |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 335 | OSet* oset; |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 336 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 337 | p = DRD_(barrier_get)(barrier); |
| 338 | if (p == 0 && barrier_type == gomp_barrier) |
| 339 | { |
| 340 | /* |
| 341 | * gomp_barrier_wait() call has been intercepted but gomp_barrier_init() |
| 342 | * not. The only cause I know of that can trigger this is that libgomp.so |
| 343 | * has been compiled with --enable-linux-futex. |
| 344 | */ |
sewardj | 1e29ebc | 2009-07-15 14:49:17 +0000 | [diff] [blame] | 345 | VG_(message)(Vg_UserMsg, "\n"); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 346 | VG_(message)(Vg_UserMsg, |
| 347 | "Please verify whether gcc has been configured" |
sewardj | 1e29ebc | 2009-07-15 14:49:17 +0000 | [diff] [blame] | 348 | " with option --disable-linux-futex.\n"); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 349 | VG_(message)(Vg_UserMsg, |
sewardj | 1e29ebc | 2009-07-15 14:49:17 +0000 | [diff] [blame] | 350 | "See also the section about OpenMP in the DRD manual.\n"); |
| 351 | VG_(message)(Vg_UserMsg, "\n"); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 352 | } |
| 353 | tl_assert(p); |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 354 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 355 | if (s_trace_barrier) |
bart | b92ff0f | 2011-10-08 08:29:29 +0000 | [diff] [blame^] | 356 | DRD_(trace_msg)("[%d] barrier_pre_wait %s 0x%lx iteration %ld\n", |
| 357 | DRD_(thread_get_running_tid)(), |
| 358 | barrier_get_typename(p), barrier, p->pre_iteration); |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 359 | |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 360 | /* Clean up nodes associated with finished threads. */ |
bart | d378eaa | 2011-07-30 09:35:56 +0000 | [diff] [blame] | 361 | oset = p->oset[p->pre_iteration & 1]; |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 362 | tl_assert(oset); |
| 363 | VG_(OSetGen_ResetIter)(oset); |
| 364 | for ( ; (q = VG_(OSetGen_Next)(oset)) != 0; ) { |
| 365 | if (q->thread_finished) { |
| 366 | void* r = VG_(OSetGen_Remove)(oset, &q->tid); |
| 367 | tl_assert(r == q); |
| 368 | DRD_(barrier_thread_destroy)(q); |
| 369 | VG_(OSetGen_FreeNode)(oset, q); |
| 370 | VG_(OSetGen_ResetIterAt)(oset, &word_tid); |
| 371 | } |
| 372 | } |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 373 | /* Allocate the per-thread data structure if necessary. */ |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 374 | q = VG_(OSetGen_Lookup)(oset, &word_tid); |
| 375 | if (q == NULL) { |
| 376 | q = VG_(OSetGen_AllocNode)(oset, sizeof(*q)); |
bart | cdc3fdb | 2011-07-29 12:31:33 +0000 | [diff] [blame] | 377 | DRD_(barrier_thread_initialize)(q, tid); |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 378 | VG_(OSetGen_Insert)(oset, q); |
| 379 | tl_assert(VG_(OSetGen_Lookup)(oset, &word_tid) == q); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 380 | } |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 381 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 382 | /* Record *_barrier_wait() call context. */ |
| 383 | q->wait_call_ctxt = VG_(record_ExeContext)(VG_(get_running_tid)(), 0); |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 384 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 385 | /* |
| 386 | * Store a pointer to the latest segment of the current thread in the |
| 387 | * per-thread data structure. |
| 388 | */ |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 389 | DRD_(thread_get_latest_segment)(&q->sg, tid); |
bart | bebc5d6 | 2008-02-24 18:42:53 +0000 | [diff] [blame] | 390 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 391 | /* |
| 392 | * If the same number of threads as the barrier count indicates have |
| 393 | * called the pre *_barrier_wait() wrapper, toggle p->pre_iteration and |
| 394 | * reset the p->pre_waiters_left counter. |
| 395 | */ |
| 396 | if (--p->pre_waiters_left <= 0) |
| 397 | { |
bart | d378eaa | 2011-07-30 09:35:56 +0000 | [diff] [blame] | 398 | p->pre_iteration++; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 399 | p->pre_waiters_left = p->count; |
| 400 | } |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 401 | } |
| 402 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 403 | /** Called after pthread_barrier_wait() / gomp_barrier_wait(). */ |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 404 | void DRD_(barrier_post_wait)(const DrdThreadId tid, const Addr barrier, |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 405 | const BarrierT barrier_type, const Bool waited, |
| 406 | const Bool serializing) |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 407 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 408 | struct barrier_info* p; |
| 409 | const UWord word_tid = tid; |
| 410 | struct barrier_thread_info* q; |
| 411 | struct barrier_thread_info* r; |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 412 | OSet* oset; |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 413 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 414 | p = DRD_(barrier_get)(barrier); |
bart | bebc5d6 | 2008-02-24 18:42:53 +0000 | [diff] [blame] | 415 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 416 | if (s_trace_barrier) |
bart | b92ff0f | 2011-10-08 08:29:29 +0000 | [diff] [blame^] | 417 | DRD_(trace_msg)("[%d] barrier_post_wait %s 0x%lx iteration %ld%s\n", |
| 418 | tid, p ? barrier_get_typename(p) : "(?)", |
| 419 | barrier, p ? p->post_iteration : -1, |
| 420 | serializing ? " (serializing)" : ""); |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 421 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 422 | /* |
| 423 | * If p == 0, this means that the barrier has been destroyed after |
| 424 | * *_barrier_wait() returned and before this function was called. Just |
| 425 | * return in that case -- race conditions between *_barrier_wait() |
| 426 | * and *_barrier_destroy() are detected by the *_barrier_destroy() wrapper. |
| 427 | */ |
| 428 | if (p == 0) |
| 429 | return; |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 430 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 431 | /* If the *_barrier_wait() call returned an error code, exit. */ |
| 432 | if (! waited) |
| 433 | return; |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 434 | |
bart | d378eaa | 2011-07-30 09:35:56 +0000 | [diff] [blame] | 435 | oset = p->oset[p->post_iteration & 1]; |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 436 | q = VG_(OSetGen_Lookup)(oset, &word_tid); |
bart | d378eaa | 2011-07-30 09:35:56 +0000 | [diff] [blame] | 437 | if (p->pre_iteration - p->post_iteration > 1) { |
| 438 | BarrierErrInfo bei = { DRD_(thread_get_running_tid)(), p->a1, 0, 0 }; |
| 439 | VG_(maybe_record_error)(VG_(get_running_tid)(), |
| 440 | BarrierErr, |
| 441 | VG_(get_IP)(VG_(get_running_tid)()), |
| 442 | "Number of concurrent pthread_barrier_wait()" |
| 443 | " calls exceeds the barrier count", |
| 444 | &bei); |
| 445 | } else if (q == NULL) { |
bart | d45d995 | 2009-05-31 18:53:54 +0000 | [diff] [blame] | 446 | BarrierErrInfo bei = { DRD_(thread_get_running_tid)(), p->a1, 0, 0 }; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 447 | VG_(maybe_record_error)(VG_(get_running_tid)(), |
| 448 | BarrierErr, |
| 449 | VG_(get_IP)(VG_(get_running_tid)()), |
| 450 | "Error in barrier implementation" |
| 451 | " -- barrier_wait() started before" |
| 452 | " barrier_destroy() and finished after" |
| 453 | " barrier_destroy()", |
| 454 | &bei); |
bart | d378eaa | 2011-07-30 09:35:56 +0000 | [diff] [blame] | 455 | } |
| 456 | if (q == NULL) { |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 457 | q = VG_(OSetGen_AllocNode)(oset, sizeof(*q)); |
bart | cdc3fdb | 2011-07-29 12:31:33 +0000 | [diff] [blame] | 458 | DRD_(barrier_thread_initialize)(q, tid); |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 459 | VG_(OSetGen_Insert)(oset, q); |
| 460 | tl_assert(VG_(OSetGen_Lookup)(oset, &word_tid) == q); |
bart | d378eaa | 2011-07-30 09:35:56 +0000 | [diff] [blame] | 461 | DRD_(thread_get_latest_segment)(&q->sg, tid); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 462 | } |
bart | 7627be3 | 2009-06-06 12:26:05 +0000 | [diff] [blame] | 463 | |
| 464 | /* Create a new segment and store a pointer to that segment. */ |
| 465 | DRD_(thread_new_segment)(tid); |
| 466 | DRD_(thread_get_latest_segment)(&q->post_wait_sg, tid); |
| 467 | s_barrier_segment_creation_count++; |
| 468 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 469 | /* |
| 470 | * Combine all vector clocks that were stored in the pre_barrier_wait |
| 471 | * wrapper with the vector clock of the current thread. |
| 472 | */ |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 473 | { |
bart | 8f822af | 2009-06-08 18:20:42 +0000 | [diff] [blame] | 474 | VectorClock old_vc; |
| 475 | |
| 476 | DRD_(vc_copy)(&old_vc, &DRD_(g_threadinfo)[tid].last->vc); |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 477 | VG_(OSetGen_ResetIter)(oset); |
| 478 | for ( ; (r = VG_(OSetGen_Next)(oset)) != 0; ) |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 479 | { |
bart | 8f822af | 2009-06-08 18:20:42 +0000 | [diff] [blame] | 480 | if (r != q) |
| 481 | { |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 482 | tl_assert(r->sg); |
bart | 8f822af | 2009-06-08 18:20:42 +0000 | [diff] [blame] | 483 | DRD_(vc_combine)(&DRD_(g_threadinfo)[tid].last->vc, |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 484 | &r->sg->vc); |
bart | 8f822af | 2009-06-08 18:20:42 +0000 | [diff] [blame] | 485 | } |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 486 | } |
bart | 8f822af | 2009-06-08 18:20:42 +0000 | [diff] [blame] | 487 | DRD_(thread_update_conflict_set)(tid, &old_vc); |
| 488 | DRD_(vc_cleanup)(&old_vc); |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 489 | } |
bart | bebc5d6 | 2008-02-24 18:42:53 +0000 | [diff] [blame] | 490 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 491 | /* |
| 492 | * If the same number of threads as the barrier count indicates have |
| 493 | * called the post *_barrier_wait() wrapper, toggle p->post_iteration and |
| 494 | * reset the p->post_waiters_left counter. |
| 495 | */ |
| 496 | if (--p->post_waiters_left <= 0) |
| 497 | { |
bart | d378eaa | 2011-07-30 09:35:56 +0000 | [diff] [blame] | 498 | p->post_iteration++; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 499 | p->post_waiters_left = p->count; |
| 500 | } |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 501 | } |
| 502 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 503 | /** Called when thread tid stops to exist. */ |
| 504 | static void barrier_delete_thread(struct barrier_info* const p, |
| 505 | const DrdThreadId tid) |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 506 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 507 | struct barrier_thread_info* q; |
| 508 | const UWord word_tid = tid; |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 509 | int i; |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 510 | |
bart | d61580e | 2011-07-29 12:39:44 +0000 | [diff] [blame] | 511 | for (i = 0; i < 2; i++) { |
| 512 | q = VG_(OSetGen_Lookup)(p->oset[i], &word_tid); |
| 513 | if (q) |
| 514 | q->thread_finished = True; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 515 | } |
sewardj | 8564292 | 2008-01-14 11:54:56 +0000 | [diff] [blame] | 516 | } |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 517 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 518 | /** |
| 519 | * Report that *_barrier_destroy() has been called but that this call was |
| 520 | * not synchronized with the last *_barrier_wait() call on the same barrier. |
bart | 776a91e | 2009-02-22 09:29:07 +0000 | [diff] [blame] | 521 | * |
| 522 | * This topic has been discussed extensively on comp.programming.threads |
| 523 | * (February 3, 2009). See also |
| 524 | * <a href="http://groups.google.com/group/comp.programming.threads/browse_thread/thread/4f65535d6192aa50/a5f4bf1e3b437c4d">Immediately destroying pthread barriers</a>. |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 525 | */ |
| 526 | static |
| 527 | void barrier_report_wait_delete_race(const struct barrier_info* const p, |
| 528 | const struct barrier_thread_info* const q) |
| 529 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 530 | tl_assert(p); |
| 531 | tl_assert(q); |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 532 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 533 | { |
| 534 | BarrierErrInfo bei |
bart | d45d995 | 2009-05-31 18:53:54 +0000 | [diff] [blame] | 535 | = { DRD_(thread_get_running_tid)(), p->a1, q->tid, q->wait_call_ctxt }; |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 536 | VG_(maybe_record_error)(VG_(get_running_tid)(), |
| 537 | BarrierErr, |
| 538 | VG_(get_IP)(VG_(get_running_tid)()), |
| 539 | "Destruction of barrier not synchronized with" |
| 540 | " barrier wait call", |
| 541 | &bei); |
| 542 | } |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 543 | } |
| 544 | |
| 545 | static const char* barrier_get_typename(struct barrier_info* const p) |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 546 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 547 | tl_assert(p); |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 548 | |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 549 | return barrier_type_name(p->barrier_type); |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 550 | } |
| 551 | |
bart | d2c5eae | 2009-02-21 15:27:04 +0000 | [diff] [blame] | 552 | static const char* barrier_type_name(const BarrierT bt) |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 553 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 554 | switch (bt) |
| 555 | { |
| 556 | case pthread_barrier: |
| 557 | return "pthread barrier"; |
| 558 | case gomp_barrier: |
| 559 | return "gomp barrier"; |
| 560 | } |
| 561 | return "?"; |
bart | 306527d | 2008-03-12 17:23:07 +0000 | [diff] [blame] | 562 | } |
bart | 6bbefaf | 2008-04-19 15:16:45 +0000 | [diff] [blame] | 563 | |
bart | a8cf765 | 2009-02-15 11:00:29 +0000 | [diff] [blame] | 564 | ULong DRD_(get_barrier_segment_creation_count)(void) |
bart | 6bbefaf | 2008-04-19 15:16:45 +0000 | [diff] [blame] | 565 | { |
bart | bedfd23 | 2009-03-26 19:07:15 +0000 | [diff] [blame] | 566 | return s_barrier_segment_creation_count; |
bart | 6bbefaf | 2008-04-19 15:16:45 +0000 | [diff] [blame] | 567 | } |