aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2023-11-08 16:36:24 +0100
committerAndrea Corallo2023-11-09 12:34:26 +0100
commit5d171d26c00aefaef1496dede69337946a1edb14 (patch)
treeb0efb3f0817b55ddeec82436da2c4301d4480d5c
parentc559f4e36827bd6c1e10e0cb15b0e58a5fdbc59e (diff)
downloademacs-5d171d26c00aefaef1496dede69337946a1edb14.tar.gz
emacs-5d171d26c00aefaef1496dede69337946a1edb14.zip
comp: Don't load.el comp when C-h f
* lisp/emacs-lisp/comp-common.el (comp-known-type-specifiers) (comp-function-type-spec): Move here.
-rw-r--r--lisp/emacs-lisp/comp-common.el362
-rw-r--r--lisp/emacs-lisp/comp.el363
2 files changed, 362 insertions, 363 deletions
diff --git a/lisp/emacs-lisp/comp-common.el b/lisp/emacs-lisp/comp-common.el
index 6da2a98c617..32b5d6ba270 100644
--- a/lisp/emacs-lisp/comp-common.el
+++ b/lisp/emacs-lisp/comp-common.el
@@ -64,6 +64,345 @@ Used to modify the compiler environment."
64 :risky t 64 :risky t
65 :version "28.1") 65 :version "28.1")
66 66
67(defconst comp-known-type-specifiers
68 `(
69 ;; Functions we can trust not to be redefined, or, if redefined,
70 ;; to expose the same type. The vast majority of these are
71 ;; either pure or primitive; the original list is the union of
72 ;; pure + side-effect-free-fns + side-effect-and-error-free-fns:
73 (% (function ((or number marker) (or number marker)) number))
74 (* (function (&rest (or number marker)) number))
75 (+ (function (&rest (or number marker)) number))
76 (- (function (&rest (or number marker)) number))
77 (/ (function ((or number marker) &rest (or number marker)) number))
78 (/= (function ((or number marker) (or number marker)) boolean))
79 (1+ (function ((or number marker)) number))
80 (1- (function ((or number marker)) number))
81 (< (function ((or number marker) &rest (or number marker)) boolean))
82 (<= (function ((or number marker) &rest (or number marker)) boolean))
83 (= (function ((or number marker) &rest (or number marker)) boolean))
84 (> (function ((or number marker) &rest (or number marker)) boolean))
85 (>= (function ((or number marker) &rest (or number marker)) boolean))
86 (abs (function (number) number))
87 (acos (function (number) float))
88 (append (function (&rest t) t))
89 (aref (function (t fixnum) t))
90 (arrayp (function (t) boolean))
91 (ash (function (integer integer) integer))
92 (asin (function (number) float))
93 (assq (function (t list) list))
94 (atan (function (number &optional number) float))
95 (atom (function (t) boolean))
96 (bignump (function (t) boolean))
97 (bobp (function () boolean))
98 (bolp (function () boolean))
99 (bool-vector-count-consecutive
100 (function (bool-vector boolean integer) fixnum))
101 (bool-vector-count-population (function (bool-vector) fixnum))
102 (bool-vector-not (function (bool-vector &optional bool-vector) bool-vector))
103 (bool-vector-p (function (t) boolean))
104 (bool-vector-subsetp (function (bool-vector bool-vector) boolean))
105 (boundp (function (symbol) boolean))
106 (buffer-end (function ((or number marker)) integer))
107 (buffer-file-name (function (&optional buffer) (or string null)))
108 (buffer-list (function (&optional frame) list))
109 (buffer-local-variables (function (&optional buffer) list))
110 (buffer-modified-p
111 (function (&optional buffer) (or boolean (member autosaved))))
112 (buffer-size (function (&optional buffer) integer))
113 (buffer-string (function () string))
114 (buffer-substring
115 (function ((or integer marker) (or integer marker)) string))
116 (bufferp (function (t) boolean))
117 (byte-code-function-p (function (t) boolean))
118 (capitalize (function (or integer string) (or integer string)))
119 (car (function (list) t))
120 (car-less-than-car (function (list list) boolean))
121 (car-safe (function (t) t))
122 (case-table-p (function (t) boolean))
123 (cdr (function (list) t))
124 (cdr-safe (function (t) t))
125 (ceiling (function (number &optional number) integer))
126 (char-after (function (&optional (or marker integer)) (or fixnum null)))
127 (char-before (function (&optional (or marker integer)) (or fixnum null)))
128 (char-equal (function (integer integer) boolean))
129 (char-or-string-p (function (t) boolean))
130 (char-to-string (function (fixnum) string))
131 (char-width (function (fixnum) fixnum))
132 (characterp (function (t &optional t) boolean))
133 (charsetp (function (t) boolean))
134 (commandp (function (t &optional t) boolean))
135 (compare-strings
136 (function (string (or integer marker null) (or integer marker null) string
137 (or integer marker null) (or integer marker null)
138 &optional t)
139 (or (member t) fixnum)))
140 (concat (function (&rest sequence) string))
141 (cons (function (t t) cons))
142 (consp (function (t) boolean))
143 (coordinates-in-window-p
144 (function (cons window)
145 (or cons null
146 (member bottom-divider right-divider mode-line header-line
147 tab-line left-fringe right-fringe vertical-line
148 left-margin right-margin))))
149 (copy-alist (function (list) list))
150 (copy-marker (function (&optional (or integer marker) boolean) marker))
151 (copy-sequence (function (sequence) sequence))
152 (copysign (function (float float) float))
153 (cos (function (number) float))
154 (count-lines
155 (function ((or integer marker) (or integer marker) &optional t) integer))
156 (current-buffer (function () buffer))
157 (current-global-map (function () cons))
158 (current-indentation (function () integer))
159 (current-local-map (function () (or cons null)))
160 (current-minor-mode-maps (function () (or cons null)))
161 (current-time (function () cons))
162 (current-time-string (function (&optional (or number list)
163 (or symbol string cons integer))
164 string))
165 (current-time-zone (function (&optional (or number list)
166 (or symbol string cons integer))
167 cons))
168 (custom-variable-p (function (symbol) t))
169 (decode-char (function (cons t) (or fixnum null)))
170 (decode-time (function (&optional (or number list)
171 (or symbol string cons integer)
172 symbol)
173 cons))
174 (default-boundp (function (symbol) boolean))
175 (default-value (function (symbol) t))
176 (degrees-to-radians (function (number) float))
177 (documentation
178 (function ((or function symbol subr) &optional t) (or null string)))
179 (downcase (function ((or fixnum string)) (or fixnum string)))
180 (elt (function (sequence integer) t))
181 (encode-char (function (fixnum symbol) (or fixnum null)))
182 (encode-time (function (cons &rest t) cons))
183 (eobp (function () boolean))
184 (eolp (function () boolean))
185 (eq (function (t t) boolean))
186 (eql (function (t t) boolean))
187 (equal (function (t t) boolean))
188 (error-message-string (function (list) string))
189 (eventp (function (t) boolean))
190 (exp (function (number) float))
191 (expt (function (number number) number))
192 (fboundp (function (symbol) boolean))
193 (fceiling (function (float) float))
194 (featurep (function (symbol &optional symbol) boolean))
195 (ffloor (function (float) float))
196 (file-directory-p (function (string) boolean))
197 (file-exists-p (function (string) boolean))
198 (file-locked-p (function (string) (or boolean string)))
199 (file-name-absolute-p (function (string) boolean))
200 (file-newer-than-file-p (function (string string) boolean))
201 (file-readable-p (function (string) boolean))
202 (file-symlink-p (function (string) (or boolean string)))
203 (file-writable-p (function (string) boolean))
204 (fixnump (function (t) boolean))
205 (float (function (number) float))
206 (float-time (function (&optional (or number list)) float))
207 (floatp (function (t) boolean))
208 (floor (function (number &optional number) integer))
209 (following-char (function () fixnum))
210 (format (function (string &rest t) string))
211 (format-time-string (function (string &optional (or number list)
212 (or symbol string cons integer))
213 string))
214 (frame-first-window (function ((or frame window)) window))
215 (frame-root-window (function (&optional (or frame window)) window))
216 (frame-selected-window (function (&optional (or frame window)) window))
217 (frame-visible-p (function (frame) (or boolean (member icon))))
218 (framep (function (t) symbol))
219 (fround (function (float) float))
220 (ftruncate (function (float) float))
221 (get (function (symbol symbol) t))
222 (get-buffer (function ((or buffer string)) (or buffer null)))
223 (get-buffer-window
224 (function (&optional (or buffer string) (or symbol (integer 0 0)))
225 (or null window)))
226 (get-file-buffer (function (string) (or null buffer)))
227 (get-largest-window (function (&optional t t t) (or window null)))
228 (get-lru-window (function (&optional t t t) (or window null)))
229 (getenv (function (string &optional frame) (or null string)))
230 (gethash (function (t hash-table &optional t) t))
231 (hash-table-count (function (hash-table) integer))
232 (hash-table-p (function (t) boolean))
233 (identity (function (t) t))
234 (ignore (function (&rest t) null))
235 (int-to-string (function (number) string))
236 (integer-or-marker-p (function (t) boolean))
237 (integerp (function (t) boolean))
238 (interactive-p (function () boolean))
239 (intern-soft (function ((or string symbol) &optional vector) symbol))
240 (invocation-directory (function () string))
241 (invocation-name (function () string))
242 (isnan (function (float) boolean))
243 (keymap-parent (function (cons) (or cons null)))
244 (keymapp (function (t) boolean))
245 (keywordp (function (t) boolean))
246 (last (function (list &optional integer) list))
247 (lax-plist-get (function (list t) t))
248 (ldexp (function (number integer) float))
249 (length (function (t) (integer 0 *)))
250 (length< (function (sequence fixnum) boolean))
251 (length= (function (sequence fixnum) boolean))
252 (length> (function (sequence fixnum) boolean))
253 (line-beginning-position (function (&optional integer) integer))
254 (line-end-position (function (&optional integer) integer))
255 (list (function (&rest t) list))
256 (listp (function (t) boolean))
257 (local-variable-if-set-p (function (symbol &optional buffer) boolean))
258 (local-variable-p (function (symbol &optional buffer) boolean))
259 (locale-info (function ((member codeset days months paper)) (or null string)))
260 (log (function (number number) float))
261 (log10 (function (number) float))
262 (logand (function (&rest (or integer marker)) integer))
263 (logb (function (number) integer))
264 (logcount (function (integer) integer))
265 (logior (function (&rest (or integer marker)) integer))
266 (lognot (function (integer) integer))
267 (logxor (function (&rest (or integer marker)) integer))
268 ;; (lsh (function ((integer ,most-negative-fixnum *) integer) integer)) ?
269 (lsh (function (integer integer) integer))
270 (make-byte-code
271 (function ((or fixnum list) string vector integer &optional string t
272 &rest t)
273 vector))
274 (make-list (function (integer t) list))
275 (make-marker (function () marker))
276 (make-string (function (integer fixnum &optional t) string))
277 (make-symbol (function (string) symbol))
278 (mark (function (&optional t) (or integer null)))
279 (mark-marker (function () marker))
280 (marker-buffer (function (marker) (or buffer null)))
281 (markerp (function (t) boolean))
282 (max (function ((or number marker) &rest (or number marker)) number))
283 (max-char (function (&optional t) fixnum))
284 (member (function (t list) list))
285 (memory-limit (function () integer))
286 (memq (function (t list) list))
287 (memql (function (t list) list))
288 (min (function ((or number marker) &rest (or number marker)) number))
289 (minibuffer-selected-window (function () (or window null)))
290 (minibuffer-window (function (&optional frame) window))
291 (mod
292 (function ((or number marker) (or number marker))
293 (or (integer 0 *) (float 0 *))))
294 (mouse-movement-p (function (t) boolean))
295 (multibyte-char-to-unibyte (function (fixnum) fixnum))
296 (natnump (function (t) boolean))
297 (next-window (function (&optional window t t) window))
298 (nlistp (function (t) boolean))
299 (not (function (t) boolean))
300 (nth (function (integer list) t))
301 (nthcdr (function (integer t) t))
302 (null (function (t) boolean))
303 (number-or-marker-p (function (t) boolean))
304 (number-to-string (function (number) string))
305 (numberp (function (t) boolean))
306 (one-window-p (function (&optional t t) boolean))
307 (overlayp (function (t) boolean))
308 (parse-colon-path (function (string) cons))
309 (plist-get (function (list t &optional t) t))
310 (plist-member (function (list t &optional t) list))
311 (point (function () integer))
312 (point-marker (function () marker))
313 (point-max (function () integer))
314 (point-min (function () integer))
315 (preceding-char (function () fixnum))
316 (previous-window (function (&optional window t t) window))
317 (prin1-to-string (function (t &optional t t) string))
318 (processp (function (t) boolean))
319 (proper-list-p (function (t) (or fixnum null)))
320 (propertize (function (string &rest t) string))
321 (radians-to-degrees (function (number) float))
322 (rassoc (function (t list) list))
323 (rassq (function (t list) list))
324 (read-from-string (function (string &optional integer integer) cons))
325 (recent-keys (function (&optional (or cons null)) vector))
326 (recursion-depth (function () integer))
327 (regexp-opt (function (list) string))
328 (regexp-quote (function (string) string))
329 (region-beginning (function () integer))
330 (region-end (function () integer))
331 (reverse (function (sequence) sequence))
332 (round (function (number &optional number) integer))
333 (safe-length (function (t) integer))
334 (selected-frame (function () frame))
335 (selected-window (function () window))
336 (sequencep (function (t) boolean))
337 (sin (function (number) float))
338 (sqrt (function (number) float))
339 (standard-case-table (function () char-table))
340 (standard-syntax-table (function () char-table))
341 (string (function (&rest fixnum) string))
342 (string-as-multibyte (function (string) string))
343 (string-as-unibyte (function (string) string))
344 (string-equal (function ((or string symbol) (or string symbol)) boolean))
345 (string-lessp (function ((or string symbol) (or string symbol)) boolean))
346 (string-make-multibyte (function (string) string))
347 (string-make-unibyte (function (string) string))
348 (string-search (function (string string &optional integer) (or integer null)))
349 (string-to-char (function (string) fixnum))
350 (string-to-multibyte (function (string) string))
351 (string-to-number (function (string &optional integer) number))
352 (string-to-syntax (function (string) (or cons null)))
353 (string< (function ((or string symbol) (or string symbol)) boolean))
354 (string= (function ((or string symbol) (or string symbol)) boolean))
355 (stringp (function (t) boolean))
356 (subrp (function (t) boolean))
357 (substring
358 (function ((or string vector) &optional integer integer) (or string vector)))
359 (sxhash (function (t) integer))
360 (sxhash-eq (function (t) integer))
361 (sxhash-eql (function (t) integer))
362 (sxhash-equal (function (t) integer))
363 (symbol-function (function (symbol) t))
364 (symbol-name (function (symbol) string))
365 (symbol-plist (function (symbol) list))
366 (symbol-value (function (symbol) t))
367 (symbolp (function (t) boolean))
368 (syntax-table (function () char-table))
369 (syntax-table-p (function (t) boolean))
370 (tan (function (number) float))
371 (this-command-keys (function () string))
372 (this-command-keys-vector (function () vector))
373 (this-single-command-keys (function () vector))
374 (this-single-command-raw-keys (function () vector))
375 (time-convert (function ((or number list) &optional (or symbol integer))
376 (or cons number)))
377 (truncate (function (number &optional number) integer))
378 (type-of (function (t) symbol))
379 (unibyte-char-to-multibyte (function (fixnum) fixnum)) ;; byte is fixnum
380 (upcase (function ((or fixnum string)) (or fixnum string)))
381 (user-full-name (function (&optional integer) (or string null)))
382 (user-login-name (function (&optional integer) (or string null)))
383 (user-original-login-name (function (&optional integer) (or string null)))
384 (user-real-login-name (function () string))
385 (user-real-uid (function () integer))
386 (user-uid (function () integer))
387 (vconcat (function (&rest sequence) vector))
388 (vector (function (&rest t) vector))
389 (vectorp (function (t) boolean))
390 (visible-frame-list (function () list))
391 (wholenump (function (t) boolean))
392 (window-configuration-p (function (t) boolean))
393 (window-live-p (function (t) boolean))
394 (window-valid-p (function (t) boolean))
395 (windowp (function (t) boolean))
396 (zerop (function (number) boolean))
397 ;; Type hints
398 (comp-hint-fixnum (function (t) fixnum))
399 (comp-hint-cons (function (t) cons))
400 ;; Non returning functions
401 (throw (function (t t) nil))
402 (error (function (string &rest t) nil))
403 (signal (function (symbol t) nil)))
404 "Alist used for type propagation.")
405
67(defconst comp-limple-calls '(call 406(defconst comp-limple-calls '(call
68 callref 407 callref
69 direct-call 408 direct-call
@@ -182,6 +521,29 @@ Account for `native-comp-eln-load-path' and `comp-native-version-dir'."
182 (expand-file-name dir invocation-directory)))) 521 (expand-file-name dir invocation-directory))))
183 native-comp-eln-load-path)) 522 native-comp-eln-load-path))
184 523
524;;;###autoload
525(defun comp-function-type-spec (function)
526 "Return the type specifier of FUNCTION.
527
528This function returns a cons cell whose car is the function
529specifier, and cdr is a symbol, either `inferred' or `know'.
530If the symbol is `inferred', the type specifier is automatically
531inferred from the code itself by the native compiler; if it is
532`know', the type specifier comes from `comp-known-type-specifiers'."
533 (let ((kind 'know)
534 type-spec )
535 (when-let ((res (assoc function comp-known-type-specifiers)))
536 (setf type-spec (cadr res)))
537 (let ((f (and (symbolp function)
538 (symbol-function function))))
539 (when (and f
540 (null type-spec)
541 (subr-native-elisp-p f))
542 (setf kind 'inferred
543 type-spec (subr-type f))))
544 (when type-spec
545 (cons type-spec kind))))
546
185(provide 'comp-common) 547(provide 'comp-common)
186 548
187;;; comp-common.el ends here 549;;; comp-common.el ends here
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 017af49b658..c0181aa5cf6 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -181,346 +181,6 @@ For internal use by the test suite only.")
181Each function in FUNCTIONS is run after PASS. 181Each function in FUNCTIONS is run after PASS.
182Useful to hook into pass checkers.") 182Useful to hook into pass checkers.")
183 183
184;; FIXME this probably should not be here but... good for now.
185(defconst comp-known-type-specifiers
186 `(
187 ;; Functions we can trust not to be redefined, or, if redefined,
188 ;; to expose the same type. The vast majority of these are
189 ;; either pure or primitive; the original list is the union of
190 ;; pure + side-effect-free-fns + side-effect-and-error-free-fns:
191 (% (function ((or number marker) (or number marker)) number))
192 (* (function (&rest (or number marker)) number))
193 (+ (function (&rest (or number marker)) number))
194 (- (function (&rest (or number marker)) number))
195 (/ (function ((or number marker) &rest (or number marker)) number))
196 (/= (function ((or number marker) (or number marker)) boolean))
197 (1+ (function ((or number marker)) number))
198 (1- (function ((or number marker)) number))
199 (< (function ((or number marker) &rest (or number marker)) boolean))
200 (<= (function ((or number marker) &rest (or number marker)) boolean))
201 (= (function ((or number marker) &rest (or number marker)) boolean))
202 (> (function ((or number marker) &rest (or number marker)) boolean))
203 (>= (function ((or number marker) &rest (or number marker)) boolean))
204 (abs (function (number) number))
205 (acos (function (number) float))
206 (append (function (&rest t) t))
207 (aref (function (t fixnum) t))
208 (arrayp (function (t) boolean))
209 (ash (function (integer integer) integer))
210 (asin (function (number) float))
211 (assq (function (t list) list))
212 (atan (function (number &optional number) float))
213 (atom (function (t) boolean))
214 (bignump (function (t) boolean))
215 (bobp (function () boolean))
216 (bolp (function () boolean))
217 (bool-vector-count-consecutive
218 (function (bool-vector boolean integer) fixnum))
219 (bool-vector-count-population (function (bool-vector) fixnum))
220 (bool-vector-not (function (bool-vector &optional bool-vector) bool-vector))
221 (bool-vector-p (function (t) boolean))
222 (bool-vector-subsetp (function (bool-vector bool-vector) boolean))
223 (boundp (function (symbol) boolean))
224 (buffer-end (function ((or number marker)) integer))
225 (buffer-file-name (function (&optional buffer) (or string null)))
226 (buffer-list (function (&optional frame) list))
227 (buffer-local-variables (function (&optional buffer) list))
228 (buffer-modified-p
229 (function (&optional buffer) (or boolean (member autosaved))))
230 (buffer-size (function (&optional buffer) integer))
231 (buffer-string (function () string))
232 (buffer-substring
233 (function ((or integer marker) (or integer marker)) string))
234 (bufferp (function (t) boolean))
235 (byte-code-function-p (function (t) boolean))
236 (capitalize (function (or integer string) (or integer string)))
237 (car (function (list) t))
238 (car-less-than-car (function (list list) boolean))
239 (car-safe (function (t) t))
240 (case-table-p (function (t) boolean))
241 (cdr (function (list) t))
242 (cdr-safe (function (t) t))
243 (ceiling (function (number &optional number) integer))
244 (char-after (function (&optional (or marker integer)) (or fixnum null)))
245 (char-before (function (&optional (or marker integer)) (or fixnum null)))
246 (char-equal (function (integer integer) boolean))
247 (char-or-string-p (function (t) boolean))
248 (char-to-string (function (fixnum) string))
249 (char-width (function (fixnum) fixnum))
250 (characterp (function (t &optional t) boolean))
251 (charsetp (function (t) boolean))
252 (commandp (function (t &optional t) boolean))
253 (compare-strings
254 (function (string (or integer marker null) (or integer marker null) string
255 (or integer marker null) (or integer marker null)
256 &optional t)
257 (or (member t) fixnum)))
258 (concat (function (&rest sequence) string))
259 (cons (function (t t) cons))
260 (consp (function (t) boolean))
261 (coordinates-in-window-p
262 (function (cons window)
263 (or cons null
264 (member bottom-divider right-divider mode-line header-line
265 tab-line left-fringe right-fringe vertical-line
266 left-margin right-margin))))
267 (copy-alist (function (list) list))
268 (copy-marker (function (&optional (or integer marker) boolean) marker))
269 (copy-sequence (function (sequence) sequence))
270 (copysign (function (float float) float))
271 (cos (function (number) float))
272 (count-lines
273 (function ((or integer marker) (or integer marker) &optional t) integer))
274 (current-buffer (function () buffer))
275 (current-global-map (function () cons))
276 (current-indentation (function () integer))
277 (current-local-map (function () (or cons null)))
278 (current-minor-mode-maps (function () (or cons null)))
279 (current-time (function () cons))
280 (current-time-string (function (&optional (or number list)
281 (or symbol string cons integer))
282 string))
283 (current-time-zone (function (&optional (or number list)
284 (or symbol string cons integer))
285 cons))
286 (custom-variable-p (function (symbol) t))
287 (decode-char (function (cons t) (or fixnum null)))
288 (decode-time (function (&optional (or number list)
289 (or symbol string cons integer)
290 symbol)
291 cons))
292 (default-boundp (function (symbol) boolean))
293 (default-value (function (symbol) t))
294 (degrees-to-radians (function (number) float))
295 (documentation
296 (function ((or function symbol subr) &optional t) (or null string)))
297 (downcase (function ((or fixnum string)) (or fixnum string)))
298 (elt (function (sequence integer) t))
299 (encode-char (function (fixnum symbol) (or fixnum null)))
300 (encode-time (function (cons &rest t) cons))
301 (eobp (function () boolean))
302 (eolp (function () boolean))
303 (eq (function (t t) boolean))
304 (eql (function (t t) boolean))
305 (equal (function (t t) boolean))
306 (error-message-string (function (list) string))
307 (eventp (function (t) boolean))
308 (exp (function (number) float))
309 (expt (function (number number) number))
310 (fboundp (function (symbol) boolean))
311 (fceiling (function (float) float))
312 (featurep (function (symbol &optional symbol) boolean))
313 (ffloor (function (float) float))
314 (file-directory-p (function (string) boolean))
315 (file-exists-p (function (string) boolean))
316 (file-locked-p (function (string) (or boolean string)))
317 (file-name-absolute-p (function (string) boolean))
318 (file-newer-than-file-p (function (string string) boolean))
319 (file-readable-p (function (string) boolean))
320 (file-symlink-p (function (string) (or boolean string)))
321 (file-writable-p (function (string) boolean))
322 (fixnump (function (t) boolean))
323 (float (function (number) float))
324 (float-time (function (&optional (or number list)) float))
325 (floatp (function (t) boolean))
326 (floor (function (number &optional number) integer))
327 (following-char (function () fixnum))
328 (format (function (string &rest t) string))
329 (format-time-string (function (string &optional (or number list)
330 (or symbol string cons integer))
331 string))
332 (frame-first-window (function ((or frame window)) window))
333 (frame-root-window (function (&optional (or frame window)) window))
334 (frame-selected-window (function (&optional (or frame window)) window))
335 (frame-visible-p (function (frame) (or boolean (member icon))))
336 (framep (function (t) symbol))
337 (fround (function (float) float))
338 (ftruncate (function (float) float))
339 (get (function (symbol symbol) t))
340 (get-buffer (function ((or buffer string)) (or buffer null)))
341 (get-buffer-window
342 (function (&optional (or buffer string) (or symbol (integer 0 0)))
343 (or null window)))
344 (get-file-buffer (function (string) (or null buffer)))
345 (get-largest-window (function (&optional t t t) (or window null)))
346 (get-lru-window (function (&optional t t t) (or window null)))
347 (getenv (function (string &optional frame) (or null string)))
348 (gethash (function (t hash-table &optional t) t))
349 (hash-table-count (function (hash-table) integer))
350 (hash-table-p (function (t) boolean))
351 (identity (function (t) t))
352 (ignore (function (&rest t) null))
353 (int-to-string (function (number) string))
354 (integer-or-marker-p (function (t) boolean))
355 (integerp (function (t) boolean))
356 (interactive-p (function () boolean))
357 (intern-soft (function ((or string symbol) &optional vector) symbol))
358 (invocation-directory (function () string))
359 (invocation-name (function () string))
360 (isnan (function (float) boolean))
361 (keymap-parent (function (cons) (or cons null)))
362 (keymapp (function (t) boolean))
363 (keywordp (function (t) boolean))
364 (last (function (list &optional integer) list))
365 (lax-plist-get (function (list t) t))
366 (ldexp (function (number integer) float))
367 (length (function (t) (integer 0 *)))
368 (length< (function (sequence fixnum) boolean))
369 (length= (function (sequence fixnum) boolean))
370 (length> (function (sequence fixnum) boolean))
371 (line-beginning-position (function (&optional integer) integer))
372 (line-end-position (function (&optional integer) integer))
373 (list (function (&rest t) list))
374 (listp (function (t) boolean))
375 (local-variable-if-set-p (function (symbol &optional buffer) boolean))
376 (local-variable-p (function (symbol &optional buffer) boolean))
377 (locale-info (function ((member codeset days months paper)) (or null string)))
378 (log (function (number number) float))
379 (log10 (function (number) float))
380 (logand (function (&rest (or integer marker)) integer))
381 (logb (function (number) integer))
382 (logcount (function (integer) integer))
383 (logior (function (&rest (or integer marker)) integer))
384 (lognot (function (integer) integer))
385 (logxor (function (&rest (or integer marker)) integer))
386 ;; (lsh (function ((integer ,most-negative-fixnum *) integer) integer)) ?
387 (lsh (function (integer integer) integer))
388 (make-byte-code
389 (function ((or fixnum list) string vector integer &optional string t
390 &rest t)
391 vector))
392 (make-list (function (integer t) list))
393 (make-marker (function () marker))
394 (make-string (function (integer fixnum &optional t) string))
395 (make-symbol (function (string) symbol))
396 (mark (function (&optional t) (or integer null)))
397 (mark-marker (function () marker))
398 (marker-buffer (function (marker) (or buffer null)))
399 (markerp (function (t) boolean))
400 (max (function ((or number marker) &rest (or number marker)) number))
401 (max-char (function (&optional t) fixnum))
402 (member (function (t list) list))
403 (memory-limit (function () integer))
404 (memq (function (t list) list))
405 (memql (function (t list) list))
406 (min (function ((or number marker) &rest (or number marker)) number))
407 (minibuffer-selected-window (function () (or window null)))
408 (minibuffer-window (function (&optional frame) window))
409 (mod
410 (function ((or number marker) (or number marker))
411 (or (integer 0 *) (float 0 *))))
412 (mouse-movement-p (function (t) boolean))
413 (multibyte-char-to-unibyte (function (fixnum) fixnum))
414 (natnump (function (t) boolean))
415 (next-window (function (&optional window t t) window))
416 (nlistp (function (t) boolean))
417 (not (function (t) boolean))
418 (nth (function (integer list) t))
419 (nthcdr (function (integer t) t))
420 (null (function (t) boolean))
421 (number-or-marker-p (function (t) boolean))
422 (number-to-string (function (number) string))
423 (numberp (function (t) boolean))
424 (one-window-p (function (&optional t t) boolean))
425 (overlayp (function (t) boolean))
426 (parse-colon-path (function (string) cons))
427 (plist-get (function (list t &optional t) t))
428 (plist-member (function (list t &optional t) list))
429 (point (function () integer))
430 (point-marker (function () marker))
431 (point-max (function () integer))
432 (point-min (function () integer))
433 (preceding-char (function () fixnum))
434 (previous-window (function (&optional window t t) window))
435 (prin1-to-string (function (t &optional t t) string))
436 (processp (function (t) boolean))
437 (proper-list-p (function (t) (or fixnum null)))
438 (propertize (function (string &rest t) string))
439 (radians-to-degrees (function (number) float))
440 (rassoc (function (t list) list))
441 (rassq (function (t list) list))
442 (read-from-string (function (string &optional integer integer) cons))
443 (recent-keys (function (&optional (or cons null)) vector))
444 (recursion-depth (function () integer))
445 (regexp-opt (function (list) string))
446 (regexp-quote (function (string) string))
447 (region-beginning (function () integer))
448 (region-end (function () integer))
449 (reverse (function (sequence) sequence))
450 (round (function (number &optional number) integer))
451 (safe-length (function (t) integer))
452 (selected-frame (function () frame))
453 (selected-window (function () window))
454 (sequencep (function (t) boolean))
455 (sin (function (number) float))
456 (sqrt (function (number) float))
457 (standard-case-table (function () char-table))
458 (standard-syntax-table (function () char-table))
459 (string (function (&rest fixnum) string))
460 (string-as-multibyte (function (string) string))
461 (string-as-unibyte (function (string) string))
462 (string-equal (function ((or string symbol) (or string symbol)) boolean))
463 (string-lessp (function ((or string symbol) (or string symbol)) boolean))
464 (string-make-multibyte (function (string) string))
465 (string-make-unibyte (function (string) string))
466 (string-search (function (string string &optional integer) (or integer null)))
467 (string-to-char (function (string) fixnum))
468 (string-to-multibyte (function (string) string))
469 (string-to-number (function (string &optional integer) number))
470 (string-to-syntax (function (string) (or cons null)))
471 (string< (function ((or string symbol) (or string symbol)) boolean))
472 (string= (function ((or string symbol) (or string symbol)) boolean))
473 (stringp (function (t) boolean))
474 (subrp (function (t) boolean))
475 (substring
476 (function ((or string vector) &optional integer integer) (or string vector)))
477 (sxhash (function (t) integer))
478 (sxhash-eq (function (t) integer))
479 (sxhash-eql (function (t) integer))
480 (sxhash-equal (function (t) integer))
481 (symbol-function (function (symbol) t))
482 (symbol-name (function (symbol) string))
483 (symbol-plist (function (symbol) list))
484 (symbol-value (function (symbol) t))
485 (symbolp (function (t) boolean))
486 (syntax-table (function () char-table))
487 (syntax-table-p (function (t) boolean))
488 (tan (function (number) float))
489 (this-command-keys (function () string))
490 (this-command-keys-vector (function () vector))
491 (this-single-command-keys (function () vector))
492 (this-single-command-raw-keys (function () vector))
493 (time-convert (function ((or number list) &optional (or symbol integer))
494 (or cons number)))
495 (truncate (function (number &optional number) integer))
496 (type-of (function (t) symbol))
497 (unibyte-char-to-multibyte (function (fixnum) fixnum)) ;; byte is fixnum
498 (upcase (function ((or fixnum string)) (or fixnum string)))
499 (user-full-name (function (&optional integer) (or string null)))
500 (user-login-name (function (&optional integer) (or string null)))
501 (user-original-login-name (function (&optional integer) (or string null)))
502 (user-real-login-name (function () string))
503 (user-real-uid (function () integer))
504 (user-uid (function () integer))
505 (vconcat (function (&rest sequence) vector))
506 (vector (function (&rest t) vector))
507 (vectorp (function (t) boolean))
508 (visible-frame-list (function () list))
509 (wholenump (function (t) boolean))
510 (window-configuration-p (function (t) boolean))
511 (window-live-p (function (t) boolean))
512 (window-valid-p (function (t) boolean))
513 (windowp (function (t) boolean))
514 (zerop (function (number) boolean))
515 ;; Type hints
516 (comp-hint-fixnum (function (t) fixnum))
517 (comp-hint-cons (function (t) cons))
518 ;; Non returning functions
519 (throw (function (t t) nil))
520 (error (function (string &rest t) nil))
521 (signal (function (symbol t) nil)))
522 "Alist used for type propagation.")
523
524(defconst comp-known-func-cstr-h 184(defconst comp-known-func-cstr-h
525 (cl-loop 185 (cl-loop
526 with comp-ctxt = (make-comp-cstr-ctxt) 186 with comp-ctxt = (make-comp-cstr-ctxt)
@@ -3892,29 +3552,6 @@ variable \"NATIVE_DISABLED\" is set, only byte compile."
3892 (delete-directory subdir)))))) 3552 (delete-directory subdir))))))
3893 (message "Cache cleared")) 3553 (message "Cache cleared"))
3894 3554
3895;;;###autoload
3896(defun comp-function-type-spec (function)
3897 "Return the type specifier of FUNCTION.
3898
3899This function returns a cons cell whose car is the function
3900specifier, and cdr is a symbol, either `inferred' or `know'.
3901If the symbol is `inferred', the type specifier is automatically
3902inferred from the code itself by the native compiler; if it is
3903`know', the type specifier comes from `comp-known-type-specifiers'."
3904 (let ((kind 'know)
3905 type-spec )
3906 (when-let ((res (gethash function comp-known-func-cstr-h)))
3907 (setf type-spec (comp-cstr-to-type-spec res)))
3908 (let ((f (and (symbolp function)
3909 (symbol-function function))))
3910 (when (and f
3911 (null type-spec)
3912 (subr-native-elisp-p f))
3913 (setf kind 'inferred
3914 type-spec (subr-type f))))
3915 (when type-spec
3916 (cons type-spec kind))))
3917
3918(provide 'comp) 3555(provide 'comp)
3919 3556
3920;; LocalWords: limplified limplification limplify Limple LIMPLE libgccjit elc eln 3557;; LocalWords: limplified limplification limplify Limple LIMPLE libgccjit elc eln