aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode.c
diff options
context:
space:
mode:
authorVibhav Pant2017-02-11 20:36:30 +0530
committerVibhav Pant2017-02-11 20:36:30 +0530
commit245fb2529bc4394003a020d6c43b8bcc1d6237ba (patch)
tree08c7725d0e089e8a3a44982844875eeadb572784 /src/bytecode.c
parent7c2d493540b6e2e1661397812c5ed9fcff04e36c (diff)
downloademacs-245fb2529bc4394003a020d6c43b8bcc1d6237ba.tar.gz
emacs-245fb2529bc4394003a020d6c43b8bcc1d6237ba.zip
; src/bytecode.c (exec_byte_code): Refactor byte-switch code.
Remove unnecessary asserts, remove duplicate code.
Diffstat (limited to 'src/bytecode.c')
-rw-r--r--src/bytecode.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index 29674a0d9de..8bc1ecfeaa5 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1431,29 +1431,22 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1431 { /* Do a linear search if there are not many cases 1431 { /* Do a linear search if there are not many cases
1432 FIXME: 5 is arbitrarily chosen. */ 1432 FIXME: 5 is arbitrarily chosen. */
1433 EMACS_UINT hash_code = h->test.hashfn (&h->test, v1); 1433 EMACS_UINT hash_code = h->test.hashfn (&h->test, v1);
1434 for (i = 0; i < h->count; i++) 1434 for (i = h->count; 0 <= --i;)
1435 { 1435 if (EQ (v1, HASH_KEY (h, i))
1436 if (BYTE_CODE_SAFE) 1436 || (h->test.cmpfn
1437 eassert (!NILP (HASH_HASH (h, i))); 1437 && hash_code == XUINT (HASH_HASH (h, i))
1438 1438 && h->test.cmpfn (&h->test, v1, HASH_KEY (h, i))))
1439 if (EQ (v1, HASH_KEY (h, i)) 1439 break;
1440 || (h->test.cmpfn 1440
1441 && hash_code == XUINT (HASH_HASH (h, i))
1442 && h->test.cmpfn (&h->test, v1, HASH_KEY (h, i))))
1443 {
1444 op = XINT (HASH_VALUE (h, i));
1445 goto op_branch;
1446 }
1447 }
1448 } 1441 }
1449 else 1442 else
1450 { 1443 i = hash_lookup(h, v1, NULL);
1451 i = hash_lookup(h, v1, NULL); 1444
1452 if (i >= 0) { 1445 if (i >= 0)
1453 op = XINT(HASH_VALUE (h, i)); 1446 {
1454 goto op_branch; 1447 op = XINT (HASH_VALUE (h, i));
1455 } 1448 goto op_branch;
1456 } 1449 }
1457 } 1450 }
1458 NEXT; 1451 NEXT;
1459 1452