(cl-defstruct (comp-func (:copier nil))
"LIMPLE representation of a function."
- (symbol-name nil
- :documentation "Function's symbol name.")
- (c-func-name nil :type string
- :documentation "The function name in the native world.")
+ (name nil :type symbol
+ :documentation "Function symbol name.")
+ (c-name nil :type string
+ :documentation "The function name in the native world.")
(byte-func nil
:documentation "Byte compiled version.")
(doc nil :type string
"Log function FUNC.
VERBOSITY is a number between 0 and 3."
(when (>= comp-verbose verbosity)
- (comp-log (format "\nFunction: %s\n" (comp-func-symbol-name func)) verbosity)
+ (comp-log (format "\nFunction: %s\n" (comp-func-name func)) verbosity)
(cl-loop for block-name being each hash-keys of (comp-func-blocks func)
using (hash-value bb)
do (comp-log (concat "<" (symbol-name block-name) ">\n") verbosity)
(let ((edges (comp-func-edges func)))
(when (> comp-verbose 2)
(comp-log (format "\nEdges in function: %s\n"
- (comp-func-symbol-name func))
+ (comp-func-name func))
0))
(mapc (lambda (e)
(when (> comp-verbose 2)
(cl-defgeneric comp-spill-lap-function ((function-name symbol))
"Byte compile FUNCTION-NAME spilling data from the byte compiler."
(let* ((f (symbol-function function-name))
- (func (make-comp-func :symbol-name function-name
- :c-func-name (comp-c-func-name
- function-name
- "F"))))
+ (func (make-comp-func :name function-name
+ :c-name (comp-c-func-name function-name"F"))))
(when (byte-code-function-p f)
(signal 'native-compiler-error
"can't native compile an already bytecompiled function"))
(setf (comp-func-byte-func func)
- (byte-compile (comp-func-symbol-name func)))
+ (byte-compile (comp-func-name func)))
(let ((lap (alist-get nil byte-to-native-lap)))
(cl-assert lap)
(comp-log lap 1)
for doc = (when (>= (length data) 5) (aref data 4))
for lap = (alist-get name byte-to-native-lap)
for lambda-list = (aref data 0)
- for func = (make-comp-func :symbol-name name
+ for func = (make-comp-func :name name
:byte-func data
:doc doc
- :c-func-name (comp-c-func-name
- name
- "F")
+ :c-name (comp-c-func-name name "F")
:args (comp-decrypt-lambda-list lambda-list)
:lap lap
:frame-size (comp-byte-frame-size data))
(let* ((name (byte-to-native-function-name form))
(f (gethash name (comp-ctxt-funcs-h comp-ctxt)))
(args (comp-func-args f))
- (c-name (comp-func-c-func-name f))
+ (c-name (comp-func-c-name f))
(doc (comp-func-doc f)))
(cl-assert (and name f))
(comp-emit (comp-call 'comp--register-subr
(defun comp-limplify-top-level ()
"Create a limple function doing the business for top level forms.
This will be called at load-time."
- (let* ((func (make-comp-func :symbol-name 'top-level-run
- :c-func-name "top_level_run"
- :args (make-comp-args :min 0 :max 0)
- :frame-size 0))
+ (let* ((func (make-comp-func :name 'top-level-run
+ :c-name "top_level_run"
+ :args (make-comp-args :min 0 :max 0)
+ :frame-size 0))
(comp-func func)
(comp-pass (make-comp-limplify
:curr-block (make--comp-block -1 0 'top-level)
;; Prologue
(comp-make-curr-block 'entry (comp-sp))
(comp-emit-annotation (concat "Lisp function: "
- (symbol-name (comp-func-symbol-name func))))
+ (symbol-name (comp-func-name func))))
(if (comp-args-p args)
(cl-loop for i below (comp-args-max args)
do (cl-incf (comp-sp))
(defun comp-add-func-to-ctxt (func)
"Add FUNC to the current compiler contex."
- (puthash (comp-func-symbol-name func)
+ (puthash (comp-func-name func)
func
(comp-ctxt-funcs-h comp-ctxt)))
(signal 'native-ice
(list "block does not end with a branch"
bb
- (comp-func-symbol-name comp-func)))))
+ (comp-func-name comp-func)))))
finally (setf (comp-func-edges comp-func)
(nreverse (comp-func-edges comp-func)))
;; Update edge refs into blocks.
(defun comp-call-optim-func ()
"Perform the trampoline call optimization for the current function."
(cl-loop
- with self = (comp-func-symbol-name comp-func)
+ with self = (comp-func-name comp-func)
for b being each hash-value of (comp-func-blocks comp-func)
do (cl-loop
for insn-cell on (comp-block-insns b)
;; exist and gets nuked.
(let ((nuke-list (cl-set-difference l-vals r-vals)))
(comp-log (format "Function %s\nl-vals %s\nr-vals %s\nNuking ids: %s\n"
- (comp-func-symbol-name comp-func)
+ (comp-func-name comp-func)
l-vals
r-vals
nuke-list)
declare_function (Lisp_Object func)
{
gcc_jit_function *gcc_func;
- char *c_name = SSDATA (CALL1I (comp-func-c-func-name, func));
+ char *c_name = SSDATA (CALL1I (comp-func-c-name, func));
Lisp_Object args = CALL1I (comp-func-args, func);
bool nargs = (CALL1I (comp-nargs-p, args));
USE_SAFE_ALLOCA;
c_name, 2, param, 0);
}
- Fputhash (CALL1I (comp-func-symbol-name, func),
+ Fputhash (CALL1I (comp-func-name, func),
make_mint_ptr (gcc_func),
comp.exported_funcs_h);
USE_SAFE_ALLOCA;
EMACS_INT frame_size = XFIXNUM (CALL1I (comp-func-frame-size, func));
- comp.func = xmint_pointer (Fgethash (CALL1I (comp-func-symbol-name, func),
+ comp.func = xmint_pointer (Fgethash (CALL1I (comp-func-name, func),
comp.exported_funcs_h, Qnil));
gcc_jit_lvalue *frame_array =
if (err)
xsignal3 (Qnative_ice,
build_string ("failing to compile function"),
- CALL1I (comp-func-symbol-name, func),
+ CALL1I (comp-func-name, func),
build_string (err));
SAFE_FREE ();