Lines Matching refs:dst
27 // void ThreadClock::release(SyncClock *dst) const {
29 // dst->clock[i] = max(dst->clock[i], clock[i]);
32 // void ThreadClock::ReleaseStore(SyncClock *dst) const {
34 // dst->clock[i] = clock[i];
37 // void ThreadClock::acq_rel(SyncClock *dst) {
38 // acquire(dst);
39 // release(dst);
161 void ThreadClock::release(ClockCache *c, SyncClock *dst) const {
163 DCHECK_LE(dst->size_, kMaxTid);
165 if (dst->size_ == 0) {
168 ReleaseStore(c, dst);
173 // Check if we need to resize dst.
174 if (dst->size_ < nclk_)
175 dst->Resize(c, nclk_);
178 // since the last release on dst. If so, we need to update
179 // only dst->elem(tid_).
180 if (dst->elem(tid_).epoch > last_acquire_) {
181 UpdateCurrentThread(dst);
182 if (dst->release_store_tid_ != tid_ ||
183 dst->release_store_reused_ != reused_)
184 dst->release_store_tid_ = kInvalidTid;
190 // First, remember whether we've acquired dst.
191 bool acquired = IsAlreadyAcquired(dst);
194 // Update dst->clk_.
196 ClockElem &ce = dst->elem(i);
201 if (nclk_ < dst->size_)
203 for (uptr i = nclk_; i < dst->size_; i++)
204 dst->elem(i).reused = 0;
206 dst->dirty_tids_[i] = kInvalidTid;
207 dst->release_store_tid_ = kInvalidTid;
208 dst->release_store_reused_ = 0;
209 // If we've acquired dst, remember this fact,
212 dst->elem(tid_).reused = reused_;
215 void ThreadClock::ReleaseStore(ClockCache *c, SyncClock *dst) const {
217 DCHECK(dst->size_ <= kMaxTid);
220 // Check if we need to resize dst.
221 if (dst->size_ < nclk_)
222 dst->Resize(c, nclk_);
224 if (dst->release_store_tid_ == tid_ &&
225 dst->release_store_reused_ == reused_ &&
226 dst->elem(tid_).epoch > last_acquire_) {
228 UpdateCurrentThread(dst);
235 ClockElem &ce = dst->elem(i);
239 // Clear the tail of dst->clk_.
240 if (nclk_ < dst->size_) {
241 for (uptr i = nclk_; i < dst->size_; i++) {
242 ClockElem &ce = dst->elem(i);
249 dst->dirty_tids_[i] = kInvalidTid;
250 dst->release_store_tid_ = tid_;
251 dst->release_store_reused_ = reused_;
253 dst->elem(tid_).reused = reused_;
256 void ThreadClock::acq_rel(ClockCache *c, SyncClock *dst) {
258 acquire(c, dst);
259 ReleaseStore(c, dst);
262 // Updates only single element related to the current thread in dst->clk_.
263 void ThreadClock::UpdateCurrentThread(SyncClock *dst) const {
265 dst->elem(tid_).epoch = clk_[tid_].epoch;
268 if (dst->dirty_tids_[i] == tid_) {
272 if (dst->dirty_tids_[i] == kInvalidTid) {
274 dst->dirty_tids_[i] = tid_;
280 for (uptr i = 0; i < dst->size_; i++)
281 dst->elem(i).reused = 0;
283 dst->dirty_tids_[i] = kInvalidTid;