update.
[chise/xemacs-chise.git-] / src / bytecode.c
index 8a685ab..e670665 100644 (file)
@@ -28,7 +28,7 @@ Boston, MA 02111-1307, USA.  */
 
    FSF: long ago.
 
-hacked on by jwz@netscape.com 1991-06
+hacked on by jwz@jwz.org 1991-06
   o  added a compile-time switch to turn on simple sanity checking;
   o  put back the obsolete byte-codes for error-detection;
   o  added a new instruction, unbind_all, which I will use for
@@ -527,6 +527,10 @@ funcall_compiled_function (Lisp_Object fun, int nargs, Lisp_Object args[])
   }
 
  wrong_number_of_arguments:
+  /* The actual printed compiled_function object is incomprehensible.
+     Check the backtrace to see if we can get a more meaningful symbol. */
+  if (EQ (fun, indirect_function (*backtrace_list->function, 0)))
+    fun = *backtrace_list->function;
   return Fsignal (Qwrong_number_of_arguments, list2 (fun, make_int (nargs)));
 }
 
@@ -682,7 +686,7 @@ execute_optimized_program (CONST Opbyte *program,
        do_varset:
        {
          Lisp_Object symbol = constants_data[n];
-         struct Lisp_Symbol *symbol_ptr = XSYMBOL (symbol);
+         Lisp_Symbol *symbol_ptr = XSYMBOL (symbol);
          Lisp_Object old_value = symbol_ptr->value;
          Lisp_Object new_value = POP;
          if (!SYMBOL_VALUE_MAGIC_P (old_value) || UNBOUNDP (old_value))
@@ -703,7 +707,7 @@ execute_optimized_program (CONST Opbyte *program,
        do_varbind:
        {
          Lisp_Object symbol = constants_data[n];
-         struct Lisp_Symbol *symbol_ptr = XSYMBOL (symbol);
+         Lisp_Symbol *symbol_ptr = XSYMBOL (symbol);
          Lisp_Object old_value = symbol_ptr->value;
          Lisp_Object new_value = POP;
          if (!SYMBOL_VALUE_MAGIC_P (old_value) || UNBOUNDP (old_value))
@@ -1890,8 +1894,7 @@ optimize_compiled_function (Lisp_Object compiled_function)
                          program, &program_length, &varbind_count);
       f->specpdl_depth = XINT (Flength (f->arglist)) + varbind_count;
       f->instructions =
-       make_opaque (program_length * sizeof (Opbyte),
-                    (CONST void *) program);
+       make_opaque (program, program_length * sizeof (Opbyte));
     }
 
   assert (OPAQUEP (f->instructions));
@@ -2020,9 +2023,12 @@ compiled_function_hash (Lisp_Object obj, int depth)
 }
 
 static const struct lrecord_description compiled_function_description[] = {
-  { XD_LISP_OBJECT, offsetof(struct Lisp_Compiled_Function, instructions), 4 },
+  { XD_LISP_OBJECT, offsetof (Lisp_Compiled_Function, instructions) },
+  { XD_LISP_OBJECT, offsetof (Lisp_Compiled_Function, constants) },
+  { XD_LISP_OBJECT, offsetof (Lisp_Compiled_Function, arglist) },
+  { XD_LISP_OBJECT, offsetof (Lisp_Compiled_Function, doc_and_interactive) },
 #ifdef COMPILED_FUNCTION_ANNOTATION_HACK
-  { XD_LISP_OBJECT, offsetof(struct Lisp_Compiled_Function, annotated), 1 },
+  { XD_LISP_OBJECT, offsetof (Lisp_Compiled_Function, annotated) },
 #endif
   { XD_END }
 };