aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytecode.c')
-rw-r--r--src/bytecode.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index ed6e2b34e77..8d7240b9966 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -625,9 +625,10 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
625 varref: 625 varref:
626 { 626 {
627 Lisp_Object v1 = vectorp[op], v2; 627 Lisp_Object v1 = vectorp[op], v2;
628 if (!SYMBOLP (v1) 628 if (!BARE_SYMBOL_P (v1)
629 || XSYMBOL (v1)->u.s.redirect != SYMBOL_PLAINVAL 629 || XBARE_SYMBOL (v1)->u.s.redirect != SYMBOL_PLAINVAL
630 || (v2 = SYMBOL_VAL (XSYMBOL (v1)), BASE_EQ (v2, Qunbound))) 630 || (v2 = XBARE_SYMBOL (v1)->u.s.val.value,
631 BASE_EQ (v2, Qunbound)))
631 v2 = Fsymbol_value (v1); 632 v2 = Fsymbol_value (v1);
632 PUSH (v2); 633 PUSH (v2);
633 NEXT; 634 NEXT;
@@ -699,11 +700,11 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
699 Lisp_Object val = POP; 700 Lisp_Object val = POP;
700 701
701 /* Inline the most common case. */ 702 /* Inline the most common case. */
702 if (SYMBOLP (sym) 703 if (BARE_SYMBOL_P (sym)
703 && !BASE_EQ (val, Qunbound) 704 && !BASE_EQ (val, Qunbound)
704 && XSYMBOL (sym)->u.s.redirect == SYMBOL_PLAINVAL 705 && XBARE_SYMBOL (sym)->u.s.redirect == SYMBOL_PLAINVAL
705 && !SYMBOL_TRAPPED_WRITE_P (sym)) 706 && !XBARE_SYMBOL (sym)->u.s.trapped_write)
706 SET_SYMBOL_VAL (XSYMBOL (sym), val); 707 SET_SYMBOL_VAL (XBARE_SYMBOL (sym), val);
707 else 708 else
708 set_internal (sym, val, Qnil, SET_INTERNAL_SET); 709 set_internal (sym, val, Qnil, SET_INTERNAL_SET);
709 } 710 }
@@ -790,24 +791,22 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
790 do_debug_on_call (Qlambda, count1); 791 do_debug_on_call (Qlambda, count1);
791 792
792 Lisp_Object original_fun = call_fun; 793 Lisp_Object original_fun = call_fun;
793 if (SYMBOLP (call_fun)) 794 /* Calls to symbols-with-pos don't need to be on the fast path. */
794 call_fun = XSYMBOL (call_fun)->u.s.function; 795 if (BARE_SYMBOL_P (call_fun))
795 Lisp_Object template; 796 call_fun = XBARE_SYMBOL (call_fun)->u.s.function;
796 Lisp_Object bytecode; 797 if (COMPILEDP (call_fun))
797 if (COMPILEDP (call_fun)
798 /* Lexical binding only. */
799 && (template = AREF (call_fun, COMPILED_ARGLIST),
800 FIXNUMP (template))
801 /* No autoloads. */
802 && (bytecode = AREF (call_fun, COMPILED_BYTECODE),
803 !CONSP (bytecode)))
804 { 798 {
805 fun = call_fun; 799 Lisp_Object template = AREF (call_fun, COMPILED_ARGLIST);
806 bytestr = bytecode; 800 if (FIXNUMP (template))
807 args_template = XFIXNUM (template); 801 {
808 nargs = call_nargs; 802 /* Fast path for lexbound functions. */
809 args = call_args; 803 fun = call_fun;
810 goto setup_frame; 804 bytestr = AREF (call_fun, COMPILED_BYTECODE),
805 args_template = XFIXNUM (template);
806 nargs = call_nargs;
807 args = call_args;
808 goto setup_frame;
809 }
811 } 810 }
812 811
813 Lisp_Object val; 812 Lisp_Object val;
@@ -1738,28 +1737,29 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
1738 if (BYTE_CODE_SAFE && !HASH_TABLE_P (jmp_table)) 1737 if (BYTE_CODE_SAFE && !HASH_TABLE_P (jmp_table))
1739 emacs_abort (); 1738 emacs_abort ();
1740 Lisp_Object v1 = POP; 1739 Lisp_Object v1 = POP;
1741 ptrdiff_t i;
1742 struct Lisp_Hash_Table *h = XHASH_TABLE (jmp_table); 1740 struct Lisp_Hash_Table *h = XHASH_TABLE (jmp_table);
1743 1741 /* Do a linear search if there are few cases and the test is `eq'.
1744 /* h->count is a faster approximation for HASH_TABLE_SIZE (h) 1742 (The table is assumed to be sized exactly; all entries are
1745 here. */ 1743 consecutive at the beginning.)
1746 if (h->count <= 5 && !h->test->cmpfn) 1744 FIXME: 5 is arbitrarily chosen. */
1747 { /* Do a linear search if there are not many cases 1745 if (h->count <= 5 && !h->test->cmpfn && !symbols_with_pos_enabled)
1748 FIXME: 5 is arbitrarily chosen. */ 1746 {
1749 for (i = h->count; 0 <= --i; ) 1747 eassume (h->count >= 2);
1750 if (EQ (v1, HASH_KEY (h, i))) 1748 for (ptrdiff_t i = h->count - 1; i >= 0; i--)
1751 break; 1749 if (BASE_EQ (v1, HASH_KEY (h, i)))
1750 {
1751 op = XFIXNUM (HASH_VALUE (h, i));
1752 goto op_branch;
1753 }
1752 } 1754 }
1753 else 1755 else
1754 i = hash_lookup (h, v1);
1755
1756 if (i >= 0)
1757 { 1756 {
1758 Lisp_Object val = HASH_VALUE (h, i); 1757 ptrdiff_t i = hash_lookup (h, v1);
1759 if (BYTE_CODE_SAFE && !FIXNUMP (val)) 1758 if (i >= 0)
1760 emacs_abort (); 1759 {
1761 op = XFIXNUM (val); 1760 op = XFIXNUM (HASH_VALUE (h, i));
1762 goto op_branch; 1761 goto op_branch;
1762 }
1763 } 1763 }
1764 } 1764 }
1765 NEXT; 1765 NEXT;