aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emacs-lisp/comp.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/comp.el')
-rw-r--r--lisp/emacs-lisp/comp.el363
1 files changed, 0 insertions, 363 deletions
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index f56eb4ed6b0..cd25b796b5b 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)
@@ -3947,29 +3607,6 @@ variable \"NATIVE_DISABLED\" is set, only byte compile."
3947 (delete-directory subdir)))))) 3607 (delete-directory subdir))))))
3948 (message "Cache cleared")) 3608 (message "Cache cleared"))
3949 3609
3950;;;###autoload
3951(defun comp-function-type-spec (function)
3952 "Return the type specifier of FUNCTION.
3953
3954This function returns a cons cell whose car is the function
3955specifier, and cdr is a symbol, either `inferred' or `know'.
3956If the symbol is `inferred', the type specifier is automatically
3957inferred from the code itself by the native compiler; if it is
3958`know', the type specifier comes from `comp-known-type-specifiers'."
3959 (let ((kind 'know)
3960 type-spec )
3961 (when-let ((res (gethash function comp-known-func-cstr-h)))
3962 (setf type-spec (comp-cstr-to-type-spec res)))
3963 (let ((f (and (symbolp function)
3964 (symbol-function function))))
3965 (when (and f
3966 (null type-spec)
3967 (subr-native-elisp-p f))
3968 (setf kind 'inferred
3969 type-spec (subr-type f))))
3970 (when type-spec
3971 (cons type-spec kind))))
3972
3973(provide 'comp) 3610(provide 'comp)
3974 3611
3975;; LocalWords: limplified limplification limplify Limple LIMPLE libgccjit elc eln 3612;; LocalWords: limplified limplification limplify Limple LIMPLE libgccjit elc eln