aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c61
1 files changed, 3 insertions, 58 deletions
diff --git a/src/eval.c b/src/eval.c
index 6f1c39ffb0e..9d3b98eb359 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3122,19 +3122,6 @@ funcall_subr (struct Lisp_Subr *subr, ptrdiff_t numargs, Lisp_Object *args)
3122 xsignal2 (Qwrong_number_of_arguments, fun, make_fixnum (numargs)); 3122 xsignal2 (Qwrong_number_of_arguments, fun, make_fixnum (numargs));
3123} 3123}
3124 3124
3125/* Call the compiled Lisp function FUN. If we have not yet read FUN's
3126 bytecode string and constants vector, fetch them from the file first. */
3127
3128static Lisp_Object
3129fetch_and_exec_byte_code (Lisp_Object fun, ptrdiff_t args_template,
3130 ptrdiff_t nargs, Lisp_Object *args)
3131{
3132 if (CONSP (AREF (fun, COMPILED_BYTECODE)))
3133 Ffetch_bytecode (fun);
3134
3135 return exec_byte_code (fun, args_template, nargs, args);
3136}
3137
3138static Lisp_Object 3125static Lisp_Object
3139apply_lambda (Lisp_Object fun, Lisp_Object args, specpdl_ref count) 3126apply_lambda (Lisp_Object fun, Lisp_Object args, specpdl_ref count)
3140{ 3127{
@@ -3204,8 +3191,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
3204 ARGLIST slot value: pass the arguments to the byte-code 3191 ARGLIST slot value: pass the arguments to the byte-code
3205 engine directly. */ 3192 engine directly. */
3206 if (FIXNUMP (syms_left)) 3193 if (FIXNUMP (syms_left))
3207 return fetch_and_exec_byte_code (fun, XFIXNUM (syms_left), 3194 return exec_byte_code (fun, XFIXNUM (syms_left), nargs, arg_vector);
3208 nargs, arg_vector);
3209 /* Otherwise the bytecode object uses dynamic binding and the 3195 /* Otherwise the bytecode object uses dynamic binding and the
3210 ARGLIST slot contains a standard formal argument list whose 3196 ARGLIST slot contains a standard formal argument list whose
3211 variables are bound dynamically below. */ 3197 variables are bound dynamically below. */
@@ -3293,7 +3279,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
3293 val = XSUBR (fun)->function.a0 (); 3279 val = XSUBR (fun)->function.a0 ();
3294 } 3280 }
3295 else 3281 else
3296 val = fetch_and_exec_byte_code (fun, 0, 0, NULL); 3282 val = exec_byte_code (fun, 0, 0, NULL);
3297 3283
3298 return unbind_to (count, val); 3284 return unbind_to (count, val);
3299} 3285}
@@ -3411,46 +3397,6 @@ lambda_arity (Lisp_Object fun)
3411 return Fcons (make_fixnum (minargs), make_fixnum (maxargs)); 3397 return Fcons (make_fixnum (minargs), make_fixnum (maxargs));
3412} 3398}
3413 3399
3414DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
3415 1, 1, 0,
3416 doc: /* If byte-compiled OBJECT is lazy-loaded, fetch it now. */)
3417 (Lisp_Object object)
3418{
3419 Lisp_Object tem;
3420
3421 if (COMPILEDP (object))
3422 {
3423 if (CONSP (AREF (object, COMPILED_BYTECODE)))
3424 {
3425 tem = read_doc_string (AREF (object, COMPILED_BYTECODE));
3426 if (! (CONSP (tem) && STRINGP (XCAR (tem))
3427 && VECTORP (XCDR (tem))))
3428 {
3429 tem = AREF (object, COMPILED_BYTECODE);
3430 if (CONSP (tem) && STRINGP (XCAR (tem)))
3431 error ("Invalid byte code in %s", SDATA (XCAR (tem)));
3432 else
3433 error ("Invalid byte code");
3434 }
3435
3436 Lisp_Object bytecode = XCAR (tem);
3437 if (STRING_MULTIBYTE (bytecode))
3438 {
3439 /* BYTECODE must have been produced by Emacs 20.2 or earlier
3440 because it produced a raw 8-bit string for byte-code and now
3441 such a byte-code string is loaded as multibyte with raw 8-bit
3442 characters converted to multibyte form. Convert them back to
3443 the original unibyte form. */
3444 bytecode = Fstring_as_unibyte (bytecode);
3445 }
3446
3447 pin_string (bytecode);
3448 ASET (object, COMPILED_BYTECODE, bytecode);
3449 ASET (object, COMPILED_CONSTANTS, XCDR (tem));
3450 }
3451 }
3452 return object;
3453}
3454 3400
3455/* Return true if SYMBOL's default currently has a let-binding 3401/* Return true if SYMBOL's default currently has a let-binding
3456 which was made in the buffer that is now current. */ 3402 which was made in the buffer that is now current. */
@@ -3529,7 +3475,7 @@ specbind (Lisp_Object symbol, Lisp_Object value)
3529 switch (sym->u.s.redirect) 3475 switch (sym->u.s.redirect)
3530 { 3476 {
3531 case SYMBOL_VARALIAS: 3477 case SYMBOL_VARALIAS:
3532 sym = SYMBOL_ALIAS (sym); XSETSYMBOL (symbol, sym); goto start; 3478 sym = SYMBOL_ALIAS (sym); symbol = make_lisp_symbol (sym); goto start;
3533 case SYMBOL_PLAINVAL: 3479 case SYMBOL_PLAINVAL:
3534 /* The most common case is that of a non-constant symbol with a 3480 /* The most common case is that of a non-constant symbol with a
3535 trivial value. Make that as fast as we can. */ 3481 trivial value. Make that as fast as we can. */
@@ -4512,7 +4458,6 @@ alist of active lexical bindings. */);
4512 defsubr (&Srun_hook_with_args_until_success); 4458 defsubr (&Srun_hook_with_args_until_success);
4513 defsubr (&Srun_hook_with_args_until_failure); 4459 defsubr (&Srun_hook_with_args_until_failure);
4514 defsubr (&Srun_hook_wrapped); 4460 defsubr (&Srun_hook_wrapped);
4515 defsubr (&Sfetch_bytecode);
4516 defsubr (&Sbacktrace_debug); 4461 defsubr (&Sbacktrace_debug);
4517 DEFSYM (QCdebug_on_exit, ":debug-on-exit"); 4462 DEFSYM (QCdebug_on_exit, ":debug-on-exit");
4518 defsubr (&Smapbacktrace); 4463 defsubr (&Smapbacktrace);