From 5ad5b797f78dacb9c901d3c63bee05b1762fa94f Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Tue, 18 Oct 2022 15:14:32 +0200 Subject: Set `comp-no-spawn' earlier using -no-comp-spawn * src/emacs.c (standard_args): Add '-no-comp-spawn' cmd line option. * lisp/startup.el (command-line): Parse '-no-comp-spawn' cmd line option. * lisp/emacs-lisp/comp.el (comp-run-async-workers, comp-final): Use '-no-comp-spawn'. --- lisp/emacs-lisp/comp.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lisp/emacs-lisp/comp.el') diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 5a05fe4854b..3987692f6f9 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -3689,8 +3689,7 @@ Prepare every function for final compilation and drive the C back-end." (print-circle t) (print-escape-multibyte t) (expr `((require 'comp) - (setf comp-no-spawn t - native-comp-verbose ,native-comp-verbose + (setf native-comp-verbose ,native-comp-verbose comp-libgccjit-reproducer ,comp-libgccjit-reproducer comp-ctxt ,comp-ctxt native-comp-eln-load-path ',native-comp-eln-load-path @@ -3716,7 +3715,8 @@ Prepare every function for final compilation and drive the C back-end." (if (zerop (call-process (expand-file-name invocation-name invocation-directory) - nil t t "--batch" "-l" temp-file)) + nil t t "-no-comp-spawn" "--batch" "-l" + temp-file)) (progn (delete-file temp-file) output) @@ -3948,7 +3948,6 @@ display a message." source-file (comp-el-to-eln-filename source-file)))) do (let* ((expr `((require 'comp) (setq comp-async-compilation t - comp-no-spawn t warning-fill-column most-positive-fixnum) ,(let ((set (list 'setq))) (dolist (var '(comp-file-preloaded-p @@ -4005,7 +4004,8 @@ display a message." :command (list (expand-file-name invocation-name invocation-directory) - "--batch" "-l" temp-file) + "-no-comp-spawn" "--batch" "-l" + temp-file) :sentinel (lambda (process _event) (run-hook-with-args -- cgit v1.2.3 From 31e7b9c073bd0dddedb90a1ff882dc78ff33315c Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Sat, 29 Oct 2022 13:21:39 +0000 Subject: Fix the subr-arity returned by native compiled functions with lots of args This fixes bug #58739. Make subr-arity return, e.g., (12 . 12) rather than (12 . many) for a function with a fixed number of arguments more than 8. * lisp/emacs-lisp/comp.el (comp-prepare-args-for-top-level): Only return a cdr of 'many when there are &rest arguments. * src/eval.c (eval_sub): Also check for a fixed number of args over 8 when using the nargs + *args calling convention. (funcall_subr): Also check numargs <= 8 before using the fixed args calling convention. Include the case numargs > 8 in the aMany calling convention. * src/lisp.h (DEFUN): Amend the comment about MANY. --- lisp/emacs-lisp/comp.el | 7 ++++--- src/eval.c | 15 ++++++++------- src/lisp.h | 9 +++++---- 3 files changed, 17 insertions(+), 14 deletions(-) (limited to 'lisp/emacs-lisp/comp.el') diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 3987692f6f9..21395c23d9a 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2057,9 +2057,10 @@ and the annotation emission." "Lexically-scoped FUNCTION." (let ((args (comp-func-l-args function))) (cons (make-comp-mvar :constant (comp-args-base-min args)) - (make-comp-mvar :constant (if (comp-args-p args) - (comp-args-max args) - 'many))))) + (make-comp-mvar :constant (cond + ((comp-args-p args) (comp-args-max args)) + ((comp-nargs-rest args) 'many) + (t (comp-nargs-nonrest args))))))) (cl-defmethod comp-prepare-args-for-top-level ((function comp-func-d)) "Dynamically scoped FUNCTION." diff --git a/src/eval.c b/src/eval.c index e1399d6a05c..ea238299488 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2435,7 +2435,9 @@ eval_sub (Lisp_Object form) else if (XSUBR (fun)->max_args == UNEVALLED) val = (XSUBR (fun)->function.aUNEVALLED) (args_left); - else if (XSUBR (fun)->max_args == MANY) + else if (XSUBR (fun)->max_args == MANY + || XSUBR (fun)->max_args > 8) + { /* Pass a vector of evaluated arguments. */ Lisp_Object *vals; @@ -2998,7 +3000,8 @@ funcall_subr (struct Lisp_Subr *subr, ptrdiff_t numargs, Lisp_Object *args) if (numargs >= subr->min_args) { /* Conforming call to finite-arity subr. */ - if (numargs <= subr->max_args) + if (numargs <= subr->max_args + && subr->max_args <= 8) { Lisp_Object argbuf[8]; Lisp_Object *a; @@ -3034,15 +3037,13 @@ funcall_subr (struct Lisp_Subr *subr, ptrdiff_t numargs, Lisp_Object *args) return subr->function.a8 (a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]); default: - /* If a subr takes more than 8 arguments without using MANY - or UNEVALLED, we need to extend this function to support it. - Until this is done, there is no way to call the function. */ - emacs_abort (); + emacs_abort (); /* Can't happen. */ } } /* Call to n-adic subr. */ - if (subr->max_args == MANY) + if (subr->max_args == MANY + || subr->max_args > 8) return subr->function.aMANY (numargs, args); } diff --git a/src/lisp.h b/src/lisp.h index 4701dfa868d..d87f9549382 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3183,10 +3183,11 @@ CHECK_SUBR (Lisp_Object x) `minargs' should be a number, the minimum number of arguments allowed. `maxargs' should be a number, the maximum number of arguments allowed, or else MANY or UNEVALLED. - MANY means pass a vector of evaluated arguments, - in the form of an integer number-of-arguments - followed by the address of a vector of Lisp_Objects - which contains the argument values. + MANY means there are &rest arguments. Here we pass a vector + of evaluated arguments in the form of an integer + number-of-arguments followed by the address of a vector of + Lisp_Objects which contains the argument values. (We also use + this convention when calling a subr with more than 8 parameters.) UNEVALLED means pass the list of unevaluated arguments `intspec' says how interactive arguments are to be fetched. If the string starts with a `(', `intspec' is evaluated and the resulting -- cgit v1.2.3 From df7ca69920e0a21ec425118090a4116fa0f7c0a6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 29 Oct 2022 18:59:04 +0300 Subject: Set 'native-comp-debug' to zero on MS-Windows * lisp/emacs-lisp/comp.el (native-comp-debug): Don't emit debug symbols on MS-Windows. The default was originally made 1 because without that, C backtraces on Windows would not show natively-compiled functions correctly, or would even stop short of reaching the topmost call frame. But that turned out to be due to a bug in GDB, which was meanwhile fixed in GDB 12. So we can now reset the value back to zero, and gain smaller *.eln files on MS-Windows. --- lisp/emacs-lisp/comp.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lisp/emacs-lisp/comp.el') diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 21395c23d9a..863e895efdb 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -57,7 +57,7 @@ :safe #'integerp :version "28.1") -(defcustom native-comp-debug (if (eq 'windows-nt system-type) 1 0) +(defcustom native-comp-debug 0 "Debug level for native compilation, a number between 0 and 3. This is intended for debugging the compiler itself. 0 no debug output. @@ -67,7 +67,7 @@ This is intended for debugging the compiler itself. passes and libgccjit log file." :type 'natnum :safe #'natnump - :version "28.1") + :version "29.1") (defcustom native-comp-verbose 0 "Compiler verbosity for native compilation, a number between 0 and 3. -- cgit v1.2.3