quipu mercurial repository
修订版 | c5e4038abc90fa00ce8b4c381da2b6310267c57f (tree) |
---|---|
时间 | 2018-07-21 05:47:02 |
作者 | Agustina Arzille <avarzille@rise...> |
Commiter | Agustina Arzille |
Small optimization in jumps
@@ -328,7 +328,6 @@ | ||
328 | 328 | default: |
329 | 329 | // XXX: Custom types. |
330 | 330 | invalid_arg (interp, "div"); |
331 | - qp_return (UNBOUND); | |
332 | 331 | } |
333 | 332 | |
334 | 333 | #undef DISPATCH_1 |
@@ -559,15 +559,16 @@ | ||
559 | 559 | } |
560 | 560 | |
561 | 561 | static int |
562 | -lastjmp (const uint8_t *ip, int off) | |
562 | +lastjmp (const uint8_t *ip, int off, bool large, int first) | |
563 | 563 | { |
564 | - while (true) | |
565 | - if (ip[off] == OP_JMP) | |
566 | - off += (int16_t)get16 (&ip[off + 1]) + 1; | |
567 | - else if (ip[off] == OP_JMPL) | |
568 | - off += (int32_t)get32 (&ip[off + 1]) + 1; | |
569 | - else | |
570 | - break; | |
564 | + for (int ijmp = large ? OP_JMPL : OP_JMP ; ; ) | |
565 | + { | |
566 | + int opc = ip[off]; | |
567 | + if (opc == ijmp || opc == first) | |
568 | + off += label_get (large, &ip[off + 1]) + 1; | |
569 | + else | |
570 | + break; | |
571 | + } | |
571 | 572 | |
572 | 573 | return (off); |
573 | 574 | } |
@@ -578,7 +579,7 @@ | ||
578 | 579 | for (sorted_list<>::iterator it (fixup); it.valid (); it.adv ()) |
579 | 580 | { |
580 | 581 | int off = it.key () + label_get (large, &bvp->data[it.key ()]); |
581 | - int npos = lastjmp (bvp->data, off); | |
582 | + int npos = lastjmp (bvp->data, off, large, bvp->data[it.key () - 1]); | |
582 | 583 | |
583 | 584 | if (npos != off) |
584 | 585 | label_put (large, bvp->data + it.key (), npos - it.key ()); |
@@ -219,18 +219,16 @@ | ||
219 | 219 | do |
220 | 220 | { |
221 | 221 | int sx = as_int (interp->stack[cf - 3]); |
222 | + int nbp = cf - interpreter::frame_size - sx; | |
222 | 223 | |
223 | 224 | if (interp->dynframe_captured (cf - 1)) |
224 | - break; | |
225 | - else if (sx == 0) | |
226 | 225 | { |
227 | - cf = as_int (interp->stack[cf - 4]); | |
228 | - continue; | |
226 | + *lp = interp->stack[nbp]; | |
227 | + break; | |
229 | 228 | } |
230 | 229 | |
231 | 230 | array *ap = as_array (alloc_array (interp, sx + 1, NIL)); |
232 | - int nbp = cf - interpreter::frame_size - sx; | |
233 | - copy_objs (ap->data, &interp->stack[nbp], sx + 1); | |
231 | + copy_objs (ap->data, &interp->stack[nbp], sx); | |
234 | 232 | interp->stack[nbp] = *lp = interp->alval; |
235 | 233 | |
236 | 234 | lp = &ap->data[sx]; |
@@ -576,7 +576,6 @@ | ||
576 | 576 | vecp->data[ix + 1] = DELETED_VAL | EXTRA_BIT; |
577 | 577 | atomic_mfence_rel (); |
578 | 578 | vecp->data[ix + 0] = DELETED_KEY; |
579 | - atomic_mfence_rel (); | |
580 | 579 | } |
581 | 580 | |
582 | 581 | #if 0 |