> it is either resolved statically or at runtime
Just tell Lisp which calls to statically resolve, inline, optimize. Overwrite the global default.
(defun foo (a) (declare (inline +) (optimize (speed 3)) (type (integer 0 100) a)) (* 10 (+ 3 a)))
* (disassemble #'foo) ; disassembly for FOO ; Size: 32 bytes. Origin: #x7006DC8544 ; FOO ; 44: 40190091 ADD NL0, R0, #6 ; 48: 5C0180D2 MOVZ TMP, #10 ; 4C: 0A7C1C9B MUL R0, NL0, TMP ; 50: FB031AAA MOV CSP, CFP ; 54: 5A7B40A9 LDP CFP, LR, [CFP] ; 58: BF0300F1 CMP NULL, #0 ; 5C: C0035FD6 RET ; 60: E00120D4 BRK #15 ; Invalid argument count trap
> it is either resolved statically or at runtime
Just tell Lisp which calls to statically resolve, inline, optimize. Overwrite the global default.
Above tells Lisp to inline the + function, optimize for speed and declares the type of a to be an integer in the range 0 to 100. As you can see in the machine code, Lisp then uses the native machine code ADD and MUL instructions.