aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode.c
diff options
context:
space:
mode:
authorStephen Berman2013-06-14 22:07:55 +0200
committerStephen Berman2013-06-14 22:07:55 +0200
commitbd358779861f265a7acff31ead40172735af693e (patch)
tree345217a9889dbd29b09bdc80a94265c17719d41f /src/bytecode.c
parent2a97b47f0878cbda86cb6ba0e7e744924810b70e (diff)
parentf7394b12358ae453a0c8b85fc307afc1b740010d (diff)
downloademacs-bd358779861f265a7acff31ead40172735af693e.tar.gz
emacs-bd358779861f265a7acff31ead40172735af693e.zip
Merge from trunk.
Diffstat (limited to 'src/bytecode.c')
-rw-r--r--src/bytecode.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/bytecode.c b/src/bytecode.c
index 97730636d0e..4940fd5c182 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1,5 +1,6 @@
1/* Execution of byte code produced by bytecomp.el. 1/* Execution of byte code produced by bytecomp.el.
2 Copyright (C) 1985-1988, 1993, 2000-2012 Free Software Foundation, Inc. 2 Copyright (C) 1985-1988, 1993, 2000-2013 Free Software Foundation,
3 Inc.
3 4
4This file is part of GNU Emacs. 5This file is part of GNU Emacs.
5 6
@@ -33,7 +34,7 @@ by Hallvard:
33 */ 34 */
34 35
35#include <config.h> 36#include <config.h>
36#include <setjmp.h> 37
37#include "lisp.h" 38#include "lisp.h"
38#include "character.h" 39#include "character.h"
39#include "buffer.h" 40#include "buffer.h"
@@ -87,8 +88,6 @@ Lisp_Object Qbyte_code_meter;
87#endif /* BYTE_CODE_METER */ 88#endif /* BYTE_CODE_METER */
88 89
89 90
90Lisp_Object Qbytecode;
91
92/* Byte codes: */ 91/* Byte codes: */
93 92
94#define BYTE_CODES \ 93#define BYTE_CODES \
@@ -314,9 +313,11 @@ struct byte_stack
314 Lisp_Object byte_string; 313 Lisp_Object byte_string;
315 const unsigned char *byte_string_start; 314 const unsigned char *byte_string_start;
316 315
316#if BYTE_MARK_STACK
317 /* The vector of constants used during byte-code execution. Storing 317 /* The vector of constants used during byte-code execution. Storing
318 this here protects it from GC because mark_byte_stack marks it. */ 318 this here protects it from GC because mark_byte_stack marks it. */
319 Lisp_Object constants; 319 Lisp_Object constants;
320#endif
320 321
321 /* Next entry in byte_stack_list. */ 322 /* Next entry in byte_stack_list. */
322 struct byte_stack *next; 323 struct byte_stack *next;
@@ -380,12 +381,12 @@ unmark_byte_stack (void)
380} 381}
381 382
382 383
383/* Fetch the next byte from the bytecode stream */ 384/* Fetch the next byte from the bytecode stream. */
384 385
385#define FETCH *stack.pc++ 386#define FETCH *stack.pc++
386 387
387/* Fetch two bytes from the bytecode stream and make a 16-bit number 388/* Fetch two bytes from the bytecode stream and make a 16-bit number
388 out of them */ 389 out of them. */
389 390
390#define FETCH2 (op = FETCH, op + (FETCH << 8)) 391#define FETCH2 (op = FETCH, op + (FETCH << 8))
391 392
@@ -405,7 +406,7 @@ unmark_byte_stack (void)
405#define DISCARD(n) (top -= (n)) 406#define DISCARD(n) (top -= (n))
406 407
407/* Get the value which is at the top of the execution stack, but don't 408/* Get the value which is at the top of the execution stack, but don't
408 pop it. */ 409 pop it. */
409 410
410#define TOP (*top) 411#define TOP (*top)
411 412
@@ -458,7 +459,8 @@ unmark_byte_stack (void)
458 Fsignal (Qquit, Qnil); \ 459 Fsignal (Qquit, Qnil); \
459 AFTER_POTENTIAL_GC (); \ 460 AFTER_POTENTIAL_GC (); \
460 } \ 461 } \
461 ELSE_PENDING_SIGNALS \ 462 else if (pending_signals) \
463 process_pending_signals (); \
462 } while (0) 464 } while (0)
463 465
464 466
@@ -535,7 +537,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
535 537
536 stack.byte_string = bytestr; 538 stack.byte_string = bytestr;
537 stack.pc = stack.byte_string_start = SDATA (bytestr); 539 stack.pc = stack.byte_string_start = SDATA (bytestr);
540#if BYTE_MARK_STACK
538 stack.constants = vector; 541 stack.constants = vector;
542#endif
539 if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth)) 543 if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth))
540 memory_full (SIZE_MAX); 544 memory_full (SIZE_MAX);
541 top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top); 545 top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top);
@@ -656,9 +660,12 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
656 the table clearer. */ 660 the table clearer. */
657#define LABEL(OP) [OP] = &&insn_ ## OP 661#define LABEL(OP) [OP] = &&insn_ ## OP
658 662
659#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ 663#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
660# pragma GCC diagnostic push 664# pragma GCC diagnostic push
661# pragma GCC diagnostic ignored "-Woverride-init" 665# pragma GCC diagnostic ignored "-Woverride-init"
666#elif defined __clang__
667# pragma GCC diagnostic push
668# pragma GCC diagnostic ignored "-Winitializer-overrides"
662#endif 669#endif
663 670
664 /* This is the dispatch table for the threaded interpreter. */ 671 /* This is the dispatch table for the threaded interpreter. */
@@ -672,7 +679,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
672#undef DEFINE 679#undef DEFINE
673 }; 680 };
674 681
675#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ 682#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) || defined __clang__
676# pragma GCC diagnostic pop 683# pragma GCC diagnostic pop
677#endif 684#endif
678 685
@@ -751,7 +758,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
751 { 758 {
752 BEFORE_POTENTIAL_GC (); 759 BEFORE_POTENTIAL_GC ();
753 wrong_type_argument (Qlistp, v1); 760 wrong_type_argument (Qlistp, v1);
754 AFTER_POTENTIAL_GC ();
755 } 761 }
756 NEXT; 762 NEXT;
757 } 763 }
@@ -786,7 +792,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
786 { 792 {
787 BEFORE_POTENTIAL_GC (); 793 BEFORE_POTENTIAL_GC ();
788 wrong_type_argument (Qlistp, v1); 794 wrong_type_argument (Qlistp, v1);
789 AFTER_POTENTIAL_GC ();
790 } 795 }
791 NEXT; 796 NEXT;
792 } 797 }
@@ -1578,7 +1583,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1578 NEXT; 1583 NEXT;
1579 1584
1580 CASE (Binteractive_p): /* Obsolete since 24.1. */ 1585 CASE (Binteractive_p): /* Obsolete since 24.1. */
1581 PUSH (Finteractive_p ()); 1586 BEFORE_POTENTIAL_GC ();
1587 PUSH (call0 (intern ("interactive-p")));
1588 AFTER_POTENTIAL_GC ();
1582 NEXT; 1589 NEXT;
1583 1590
1584 CASE (Bforward_char): 1591 CASE (Bforward_char):
@@ -1875,7 +1882,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1875 /* Actually this is Bstack_ref with offset 0, but we use Bdup 1882 /* Actually this is Bstack_ref with offset 0, but we use Bdup
1876 for that instead. */ 1883 for that instead. */
1877 /* CASE (Bstack_ref): */ 1884 /* CASE (Bstack_ref): */
1878 emacs_abort (); 1885 error ("Invalid byte opcode");
1879 1886
1880 /* Handy byte-codes for lexical binding. */ 1887 /* Handy byte-codes for lexical binding. */
1881 CASE (Bstack_ref1): 1888 CASE (Bstack_ref1):
@@ -1960,8 +1967,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1960void 1967void
1961syms_of_bytecode (void) 1968syms_of_bytecode (void)
1962{ 1969{
1963 DEFSYM (Qbytecode, "byte-code");
1964
1965 defsubr (&Sbyte_code); 1970 defsubr (&Sbyte_code);
1966 1971
1967#ifdef BYTE_CODE_METER 1972#ifdef BYTE_CODE_METER