]> code.delx.au - gnu-emacs/blobdiff - src/bytecode.c
Merge from trunk
[gnu-emacs] / src / bytecode.c
index b2e9e3c5b56cf58d237f44ab971a409686ce8223..639c543dbf938b9658a06622a8971f578cdbca8c 100644 (file)
@@ -51,7 +51,7 @@ by Hallvard:
  *
  * define BYTE_CODE_METER to enable generation of a byte-op usage histogram.
  */
-#define BYTE_CODE_SAFE
+/* #define BYTE_CODE_SAFE  1 */
 /* #define BYTE_CODE_METER */
 
 \f
@@ -236,6 +236,8 @@ extern Lisp_Object Qand_optional, Qand_rest;
 #define Bconstant 0300
 #define CONSTANTLIM 0100
 
+/* Whether to maintain a `top' and `bottom' field in the stack frame.  */
+#define BYTE_MAINTAIN_TOP (BYTE_CODE_SAFE || BYTE_MARK_STACK)
 \f
 /* Structure describing a value stack used during byte-code execution
    in Fbyte_code.  */
@@ -248,7 +250,9 @@ struct byte_stack
 
   /* Top and bottom of stack.  The bottom points to an area of memory
      allocated with alloca in Fbyte_code.  */
+#if BYTE_MAINTAIN_TOP
   Lisp_Object *top, *bottom;
+#endif
 
   /* The string containing the byte-code, and its current address.
      Storing this here protects it from GC because mark_byte_stack
@@ -275,6 +279,7 @@ struct byte_stack *byte_stack_list;
 \f
 /* Mark objects on byte_stack_list.  Called during GC.  */
 
+#if BYTE_MARK_STACK
 void
 mark_byte_stack (void)
 {
@@ -299,7 +304,7 @@ mark_byte_stack (void)
       mark_object (stack->constants);
     }
 }
-
+#endif
 
 /* Unmark objects in the stacks on byte_stack_list.  Relocate program
    counters.  Called when GC has completed.  */
@@ -353,8 +358,13 @@ unmark_byte_stack (void)
 /* Actions that must be performed before and after calling a function
    that might GC.  */
 
+#if !BYTE_MAINTAIN_TOP
+#define BEFORE_POTENTIAL_GC()  ((void)0)
+#define AFTER_POTENTIAL_GC()   ((void)0)
+#else
 #define BEFORE_POTENTIAL_GC()  stack.top = top
 #define AFTER_POTENTIAL_GC()   stack.top = NULL
+#endif
 
 /* Garbage collect if we have consed enough since the last time.
    We do this at every branch, to avoid loops that never GC.  */
@@ -478,10 +488,13 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
   stack.byte_string = bytestr;
   stack.pc = stack.byte_string_start = SDATA (bytestr);
   stack.constants = vector;
-  stack.bottom = (Lisp_Object *) alloca (XFASTINT (maxdepth)
+  top = (Lisp_Object *) alloca (XFASTINT (maxdepth)
                                          * sizeof (Lisp_Object));
-  top = stack.bottom - 1;
+#if BYTE_MAINTAIN_TOP
+  stack.bottom = top;
   stack.top = NULL;
+#endif
+  top -= 1;
   stack.next = byte_stack_list;
   byte_stack_list = &stack;
 
@@ -1468,7 +1481,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
            CHECK_CHARACTER (TOP);
            AFTER_POTENTIAL_GC ();
            c = XFASTINT (TOP);
-           if (NILP (current_buffer->enable_multibyte_characters))
+           if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
              MAKE_CHAR_MULTIBYTE (c);
            XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (c)]);
          }