• R/O
  • SSH

quipu: 提交

quipu mercurial repository


Commit MetaInfo

修订版c5e4038abc90fa00ce8b4c381da2b6310267c57f (tree)
时间2018-07-21 05:47:02
作者Agustina Arzille <avarzille@rise...>
CommiterAgustina Arzille

Log Message

Small optimization in jumps

更改概述

差异

diff -r 62f4957da297 -r c5e4038abc90 builtins.cpp
--- a/builtins.cpp Fri Jul 20 10:44:12 2018 -0300
+++ b/builtins.cpp Fri Jul 20 17:47:02 2018 -0300
@@ -328,7 +328,6 @@
328328 default:
329329 // XXX: Custom types.
330330 invalid_arg (interp, "div");
331- qp_return (UNBOUND);
332331 }
333332
334333 #undef DISPATCH_1
diff -r 62f4957da297 -r c5e4038abc90 compiler.cpp
--- a/compiler.cpp Fri Jul 20 10:44:12 2018 -0300
+++ b/compiler.cpp Fri Jul 20 17:47:02 2018 -0300
@@ -559,15 +559,16 @@
559559 }
560560
561561 static int
562-lastjmp (const uint8_t *ip, int off)
562+lastjmp (const uint8_t *ip, int off, bool large, int first)
563563 {
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+ }
571572
572573 return (off);
573574 }
@@ -578,7 +579,7 @@
578579 for (sorted_list<>::iterator it (fixup); it.valid (); it.adv ())
579580 {
580581 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]);
582583
583584 if (npos != off)
584585 label_put (large, bvp->data + it.key (), npos - it.key ());
diff -r 62f4957da297 -r c5e4038abc90 eval.cpp
--- a/eval.cpp Fri Jul 20 10:44:12 2018 -0300
+++ b/eval.cpp Fri Jul 20 17:47:02 2018 -0300
@@ -219,18 +219,16 @@
219219 do
220220 {
221221 int sx = as_int (interp->stack[cf - 3]);
222+ int nbp = cf - interpreter::frame_size - sx;
222223
223224 if (interp->dynframe_captured (cf - 1))
224- break;
225- else if (sx == 0)
226225 {
227- cf = as_int (interp->stack[cf - 4]);
228- continue;
226+ *lp = interp->stack[nbp];
227+ break;
229228 }
230229
231230 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);
234232 interp->stack[nbp] = *lp = interp->alval;
235233
236234 lp = &ap->data[sx];
diff -r 62f4957da297 -r c5e4038abc90 table.cpp
--- a/table.cpp Fri Jul 20 10:44:12 2018 -0300
+++ b/table.cpp Fri Jul 20 17:47:02 2018 -0300
@@ -576,7 +576,6 @@
576576 vecp->data[ix + 1] = DELETED_VAL | EXTRA_BIT;
577577 atomic_mfence_rel ();
578578 vecp->data[ix + 0] = DELETED_KEY;
579- atomic_mfence_rel ();
580579 }
581580
582581 #if 0
Show on old repository browser