修訂 | 143c56bc3cde16bf38f1ce2bfb1ed3178bbdda05 (tree) |
---|---|
時間 | 2019-02-13 04:52:52 |
作者 | Agustina Arzille <avarzille@rise...> |
Commiter | Agustina Arzille |
Small changes in tuples
@@ -270,13 +270,12 @@ | ||
270 | 270 | if (outp) |
271 | 271 | *outp = ap.pred; |
272 | 272 | |
273 | -retry: | |
274 | 273 | for (int lvl = tp->hi_water - 1; lvl >= 0; --lvl) |
275 | 274 | { |
276 | 275 | if ((ap.next = node_next (ap.pred, lvl)) == UNBOUND && lvl >= n) |
277 | 276 | continue; |
278 | 277 | else if (ap.next & EXTRA_BIT) |
279 | - goto retry; | |
278 | + return (find_preds_mt (interp, tp, ap, n, key, unlink, outp)); | |
280 | 279 | |
281 | 280 | for (ap.item = ap.next; ap.item != UNBOUND; ) |
282 | 281 | { |
@@ -299,7 +298,8 @@ | ||
299 | 298 | else |
300 | 299 | { |
301 | 300 | if (ap.other & EXTRA_BIT) |
302 | - goto retry; | |
301 | + return (find_preds_mt (interp, | |
302 | + tp, ap, n, key, unlink, outp)); | |
303 | 303 | |
304 | 304 | ap.item = ap.other; |
305 | 305 | } |
@@ -325,7 +325,7 @@ | ||
325 | 325 | ap.l_succs[lvl] = ap.item; |
326 | 326 | } |
327 | 327 | |
328 | - return (d == 0 && ap.item != UNBOUND ? ap.item : UNBOUND); | |
328 | + return (d == 0 ? ap.item : UNBOUND); | |
329 | 329 | } |
330 | 330 | |
331 | 331 | static inline object |
@@ -366,14 +366,12 @@ | ||
366 | 366 | object nval = make_node (interp, n, key); |
367 | 367 | f.call (interp, node_key (nval)); |
368 | 368 | |
369 | - ap.next = node_next (nval, 0) = *ap.l_succs; | |
370 | - for (int lvl = 1; lvl < n; ++lvl) | |
371 | - node_next(nval, lvl) = ap.l_succs[lvl]; | |
369 | + copy_objs (&node_next(nval, 0), ap.l_succs, n); | |
372 | 370 | |
373 | 371 | ap.pred = *ap.l_preds; |
374 | 372 | /* Try to link the new element bottom-up. If we manage to |
375 | 373 | * do so, it becomes part of the tuple. */ |
376 | - if (!atomic_cas_bool ((atomic_t *)&node_next(ap.pred, 0), ap.next, nval)) | |
374 | + if (!atomic_cas_bool ((atomic_t *)&node_next(ap.pred, 0), *ap.l_succs, nval)) | |
377 | 375 | // Another thread beat us - Retry. |
378 | 376 | goto retry; |
379 | 377 |