/* Execution of byte code produced by bytecomp.el.
- Copyright (C) 1985-1988, 1993, 2000-2012 Free Software Foundation, Inc.
+ Copyright (C) 1985-1988, 1993, 2000-2013 Free Software Foundation,
+ Inc.
This file is part of GNU Emacs.
*/
#include <config.h>
-#include <setjmp.h>
+
#include "lisp.h"
#include "character.h"
#include "buffer.h"
#endif /* BYTE_CODE_METER */
\f
-Lisp_Object Qbytecode;
-
/* Byte codes: */
#define BYTE_CODES \
/* Garbage collect if we have consed enough since the last time.
We do this at every branch, to avoid loops that never GC. */
-#define MAYBE_GC() \
- do { \
- if (consing_since_gc > gc_cons_threshold \
- && consing_since_gc > gc_relative_threshold) \
- { \
- BEFORE_POTENTIAL_GC (); \
- Fgarbage_collect (); \
- AFTER_POTENTIAL_GC (); \
- } \
+#define MAYBE_GC() \
+ do { \
+ BEFORE_POTENTIAL_GC (); \
+ maybe_gc (); \
+ AFTER_POTENTIAL_GC (); \
} while (0)
/* Check for jumping out of range. */
#ifdef BYTE_CODE_SAFE
#define CHECK_RANGE(ARG) \
- if (ARG >= bytestr_length) abort ()
+ if (ARG >= bytestr_length) emacs_abort ()
#else /* not BYTE_CODE_SAFE */
Fsignal (Qquit, Qnil); \
AFTER_POTENTIAL_GC (); \
} \
- ELSE_PENDING_SIGNALS \
+ else if (pending_signals) \
+ process_pending_signals (); \
} while (0)
if (FRAME_X_P (f)
&& FRAME_FONT (f)->direction != 0
&& FRAME_FONT (f)->direction != 1)
- abort ();
+ emacs_abort ();
}
#endif
stack.byte_string = bytestr;
stack.pc = stack.byte_string_start = SDATA (bytestr);
stack.constants = vector;
- if (MAX_ALLOCA / sizeof (Lisp_Object) <= XFASTINT (maxdepth))
+ if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth))
memory_full (SIZE_MAX);
top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top);
#if BYTE_MAINTAIN_TOP
if (INTEGERP (args_template))
{
ptrdiff_t at = XINT (args_template);
- int rest = at & 128;
+ bool rest = (at & 128) != 0;
int mandatory = at & 127;
ptrdiff_t nonrest = at >> 8;
eassert (mandatory <= nonrest);
{
#ifdef BYTE_CODE_SAFE
if (top > stacke)
- abort ();
+ emacs_abort ();
else if (top < stack.bottom - 1)
- abort ();
+ emacs_abort ();
#endif
#ifdef BYTE_CODE_METER
the table clearer. */
#define LABEL(OP) [OP] = &&insn_ ## OP
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Woverride-init"
+#endif
+
/* This is the dispatch table for the threaded interpreter. */
static const void *const targets[256] =
{
BYTE_CODES
#undef DEFINE
};
+
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic pop
+#endif
+
#endif
&& !EQ (val, Qunbound)
&& !XSYMBOL (sym)->redirect
&& !SYMBOL_CONSTANT_P (sym))
- XSYMBOL (sym)->val.value = val;
+ SET_SYMBOL_VAL (XSYMBOL (sym), val);
else
{
BEFORE_POTENTIAL_GC ();
CASE (Bsave_current_buffer): /* Obsolete since ??. */
CASE (Bsave_current_buffer_1):
- record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+ record_unwind_current_buffer ();
NEXT;
CASE (Bsave_window_excursion): /* Obsolete since 24.1. */
NEXT;
CASE (Binteractive_p): /* Obsolete since 24.1. */
- PUSH (Finteractive_p ());
+ BEFORE_POTENTIAL_GC ();
+ PUSH (call0 (intern ("interactive-p")));
+ AFTER_POTENTIAL_GC ();
NEXT;
CASE (Bforward_char):
/* Actually this is Bstack_ref with offset 0, but we use Bdup
for that instead. */
/* CASE (Bstack_ref): */
- abort ();
+ error ("Invalid byte opcode");
/* Handy byte-codes for lexical binding. */
CASE (Bstack_ref1):
#ifdef BYTE_CODE_SAFE
if (op < Bconstant)
{
- abort ();
+ emacs_abort ();
}
if ((op -= Bconstant) >= const_length)
{
- abort ();
+ emacs_abort ();
}
PUSH (vectorp[op]);
#else
#ifdef BYTE_CODE_SAFE
error ("binding stack not balanced (serious byte compiler bug)");
#else
- abort ();
+ emacs_abort ();
#endif
return result;
void
syms_of_bytecode (void)
{
- DEFSYM (Qbytecode, "byte-code");
-
defsubr (&Sbyte_code);
#ifdef BYTE_CODE_METER