comparison src/bytecode.c @ 37029:d7378777b985

(BYTE_CODE_QUIT): New macro. (Fbyte_code): Use BYTE_CODE_QUIT instead of QUIT.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 28 Mar 2001 10:01:51 +0000
parents f4b666ca7ea3
children 6b08e1812292
comparison
equal deleted inserted replaced
37028:f023c8a482ec 37029:d7378777b985
1 /* Execution of byte code produced by bytecomp.el. 1 /* Execution of byte code produced by bytecomp.el.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 2000 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 2000, 2001
3 Free Software Foundation, Inc.
3 4
4 This file is part of GNU Emacs. 5 This file is part of GNU Emacs.
5 6
6 GNU Emacs is free software; you can redistribute it and/or modify 7 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
394 395
395 #define CHECK_RANGE(ARG) 396 #define CHECK_RANGE(ARG)
396 397
397 #endif /* not BYTE_CODE_SAFE */ 398 #endif /* not BYTE_CODE_SAFE */
398 399
400 /* A version of the QUIT macro which makes sure that the stack top is
401 set before signaling `quit'. */
402
403 #define BYTE_CODE_QUIT \
404 do { \
405 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
406 { \
407 Vquit_flag = Qnil; \
408 BEFORE_POTENTIAL_GC (); \
409 Fsignal (Qquit, Qnil); \
410 } \
411 } while (0)
412
399 413
400 DEFUN ("byte-code", Fbyte_code, Sbyte_code, 3, 3, 0, 414 DEFUN ("byte-code", Fbyte_code, Sbyte_code, 3, 3, 0,
401 "Function used internally in byte-compiled code.\n\ 415 "Function used internally in byte-compiled code.\n\
402 The first argument, BYTESTR, is a string of byte code;\n\ 416 The first argument, BYTESTR, is a string of byte code;\n\
403 the second, VECTOR, a vector of constants;\n\ 417 the second, VECTOR, a vector of constants;\n\
527 case Bgotoifnil: 541 case Bgotoifnil:
528 MAYBE_GC (); 542 MAYBE_GC ();
529 op = FETCH2; 543 op = FETCH2;
530 if (NILP (POP)) 544 if (NILP (POP))
531 { 545 {
532 QUIT; 546 BYTE_CODE_QUIT;
533 CHECK_RANGE (op); 547 CHECK_RANGE (op);
534 stack.pc = stack.byte_string_start + op; 548 stack.pc = stack.byte_string_start + op;
535 } 549 }
536 break; 550 break;
537 551
733 AFTER_POTENTIAL_GC (); 747 AFTER_POTENTIAL_GC ();
734 break; 748 break;
735 749
736 case Bgoto: 750 case Bgoto:
737 MAYBE_GC (); 751 MAYBE_GC ();
738 QUIT; 752 BYTE_CODE_QUIT;
739 op = FETCH2; /* pc = FETCH2 loses since FETCH2 contains pc++ */ 753 op = FETCH2; /* pc = FETCH2 loses since FETCH2 contains pc++ */
740 CHECK_RANGE (op); 754 CHECK_RANGE (op);
741 stack.pc = stack.byte_string_start + op; 755 stack.pc = stack.byte_string_start + op;
742 break; 756 break;
743 757
744 case Bgotoifnonnil: 758 case Bgotoifnonnil:
745 MAYBE_GC (); 759 MAYBE_GC ();
746 op = FETCH2; 760 op = FETCH2;
747 if (!NILP (POP)) 761 if (!NILP (POP))
748 { 762 {
749 QUIT; 763 BYTE_CODE_QUIT;
750 CHECK_RANGE (op); 764 CHECK_RANGE (op);
751 stack.pc = stack.byte_string_start + op; 765 stack.pc = stack.byte_string_start + op;
752 } 766 }
753 break; 767 break;
754 768
755 case Bgotoifnilelsepop: 769 case Bgotoifnilelsepop:
756 MAYBE_GC (); 770 MAYBE_GC ();
757 op = FETCH2; 771 op = FETCH2;
758 if (NILP (TOP)) 772 if (NILP (TOP))
759 { 773 {
760 QUIT; 774 BYTE_CODE_QUIT;
761 CHECK_RANGE (op); 775 CHECK_RANGE (op);
762 stack.pc = stack.byte_string_start + op; 776 stack.pc = stack.byte_string_start + op;
763 } 777 }
764 else DISCARD (1); 778 else DISCARD (1);
765 break; 779 break;
767 case Bgotoifnonnilelsepop: 781 case Bgotoifnonnilelsepop:
768 MAYBE_GC (); 782 MAYBE_GC ();
769 op = FETCH2; 783 op = FETCH2;
770 if (!NILP (TOP)) 784 if (!NILP (TOP))
771 { 785 {
772 QUIT; 786 BYTE_CODE_QUIT;
773 CHECK_RANGE (op); 787 CHECK_RANGE (op);
774 stack.pc = stack.byte_string_start + op; 788 stack.pc = stack.byte_string_start + op;
775 } 789 }
776 else DISCARD (1); 790 else DISCARD (1);
777 break; 791 break;
778 792
779 case BRgoto: 793 case BRgoto:
780 MAYBE_GC (); 794 MAYBE_GC ();
781 QUIT; 795 BYTE_CODE_QUIT;
782 stack.pc += (int) *stack.pc - 127; 796 stack.pc += (int) *stack.pc - 127;
783 break; 797 break;
784 798
785 case BRgotoifnil: 799 case BRgotoifnil:
786 MAYBE_GC (); 800 MAYBE_GC ();
787 if (NILP (POP)) 801 if (NILP (POP))
788 { 802 {
789 QUIT; 803 BYTE_CODE_QUIT;
790 stack.pc += (int) *stack.pc - 128; 804 stack.pc += (int) *stack.pc - 128;
791 } 805 }
792 stack.pc++; 806 stack.pc++;
793 break; 807 break;
794 808
795 case BRgotoifnonnil: 809 case BRgotoifnonnil:
796 MAYBE_GC (); 810 MAYBE_GC ();
797 if (!NILP (POP)) 811 if (!NILP (POP))
798 { 812 {
799 QUIT; 813 BYTE_CODE_QUIT;
800 stack.pc += (int) *stack.pc - 128; 814 stack.pc += (int) *stack.pc - 128;
801 } 815 }
802 stack.pc++; 816 stack.pc++;
803 break; 817 break;
804 818
805 case BRgotoifnilelsepop: 819 case BRgotoifnilelsepop:
806 MAYBE_GC (); 820 MAYBE_GC ();
807 op = *stack.pc++; 821 op = *stack.pc++;
808 if (NILP (TOP)) 822 if (NILP (TOP))
809 { 823 {
810 QUIT; 824 BYTE_CODE_QUIT;
811 stack.pc += op - 128; 825 stack.pc += op - 128;
812 } 826 }
813 else DISCARD (1); 827 else DISCARD (1);
814 break; 828 break;
815 829
816 case BRgotoifnonnilelsepop: 830 case BRgotoifnonnilelsepop:
817 MAYBE_GC (); 831 MAYBE_GC ();
818 op = *stack.pc++; 832 op = *stack.pc++;
819 if (!NILP (TOP)) 833 if (!NILP (TOP))
820 { 834 {
821 QUIT; 835 BYTE_CODE_QUIT;
822 stack.pc += op - 128; 836 stack.pc += op - 128;
823 } 837 }
824 else DISCARD (1); 838 else DISCARD (1);
825 break; 839 break;
826 840