Custom Query (1030 matches)
Results (979 - 981 of 1030)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #1280 | fixed | Cannot INLINE functions created by MACROLET | ||
| Description |
A function defined with MACROLET that is declaimed as INLINE doesn't seem to actually inline at the call site. If you manually write the definition out without the MACROLET, inlining works as expected. I have tried locally declaring the function as INLINE at the call site, and I have also tried doing a DECLAIM INLINE outside of the MACROLET, all to no avail. See the interactions below to reproduce. File def.lisp (defpackage :foo
(:use :cl)
(:export fun))
(in-package :foo)
(macrolet ((def (name op)
`(progn
(declaim (inline ,name))
(defun ,name (a b)
(,op a b)))))
(def fun +))
File use.lisp (in-package :cl-user) (defun bar (a b) (declare (optimize speed (safety 0) (debug 0) (space 0))) (foo:fun a (* a b))) REPL interaction (note the line marked with !!!!...!!) CL-USER> (lisp-implementation-type) "Clozure Common Lisp" CL-USER> (lisp-implementation-version) "Version 1.11-dev-r16361M-trunk (LinuxARM32)" CL-USER> (load (compile-file "def.lisp")) #P"def.lafsl" CL-USER> (load (compile-file "use.lisp")) #P"use.lafsl" CL-USER> (disassemble #'bar) ;; Source: "use.lisp.newest":23-122 (mov imm0 (:$ 19)) (stmdb (:! sp) (imm0 vsp fn lr)) (mov fn temp2) (stmdb (:! vsp) (arg_z arg_y)) ;[12] ;;; (* a b) (sploadlr .SPbuiltin-times) ;[16] (blx lr) ;;; (foo:fun a (* a b)) (ldr arg_y (:@ vsp (:$ 4))) ;[24] (mov nargs (:$ 8)) (ldr temp1 (:@ fn 'FOO:FUN)) ; *** !!!!!!!!!!!!!! (ldmia (:! sp) (imm0 vsp fn lr)) (ldr temp2 (:@ temp1 (:$ 6))) ;[40] (ldr pc (:@ temp2 (:$ -2))) ;;; #<no source text> NIL |
|||
| #1282 | fixed | sertting a large number of macro characters doen't scale well | ||
| Description |
People have reported that it can be prohibitively slow to call SET-MACRO-CHARACTER on all potential Unicode characters. I'm not surprised by this, but I'm not sure that there's a good reason to make it impractical for someone who wants to do this to do so, either. changing the data structures that CCL uses to associate characters with functions can affect things like SET-SYNTAX-FROM-CHAR and COPY-READTABLE as well as SET-MACRO-CHARACTER and (poossibly) SET-DISPATCH-MACRO-CHARACTER. |
|||
| #1286 | invalid | Cannot INLINE functions created by MACROLET - again? | ||
| Description |
Intro: generating a declaim-inline declaration and a function definition via macrolet somehow gets in the way of inlining. Detailed minimal example below. This looks very similar to the following Clozure CL bug, whence the "again?" in the summary comes from. http://trac.clozure.com/ccl/ticket/1280
Example with 3 files, package.lisp, a.lisp, and b.lisp: package.lisp:
(in-package :cl-user)
(defpackage a
(:use :cl)
(:export #:***f*** #:///f///)) ; easy to see in disassembly
(defpackage b
(:use :cl)
(:export #:g #:g2))
a.lisp:
(in-package #:a)
(macrolet ((define-op (name op)
`(progn
(declaim (inline ,op))
(defun ,name (x y)
(,op x y)))))
(define-op ***f*** +))
(declaim (inline ///f///))
(defun ///f/// (x y)
(+ x y))
b.lisp:
(in-package #:b)
(defun g (x y)
(flet ((h ()
(a:***f*** x y)))
#'h))
(defun g2 (x y)
(flet ((h ()
(a:///f/// x y)))
#'h))
Session with results: ; SLIME 2015-06-01
CL-USER> (progn
(load "package.lisp")
(load (compile-file "a.lisp"))
(load (compile-file "b.lisp")))
#P"b.lx64fsl"
CL-USER> (disassemble (b:g 1 2))
L0
(leaq (@ (:^ L0) (% rip)) (% fn)) ; [0]
(cmpl ($ 16) (% nargs)) ; [7]
(jne L81) ; [10]
(pushq (% rbp)) ; [12]
(movq (% rsp) (% rbp)) ; [13]
(pushq (% arg_y)) ; [16]
(pushq (% arg_z)) ; [17]
;;; (a:***f*** x y)
(leaq (@ (:^ L61) (% fn)) (% temp0)) ; [18]
(pushq (% temp0)) ; [25]
(movq (% arg_z) (% arg_y)) ; [26]
(movq (@ -8 (% rbp)) (% arg_z)) ; [29]
(movl ($ 16) (% nargs)) ; [33]
(movq (@ 'A:***F*** (% fn)) (% temp0)) ; [38]
(pushq (@ #x12FB8)) ; [45]
(jmpq (@ 10 (% temp0))) ; [52]
L61
(leaq (@ (:^ L0) (% rip)) (% fn)) ; [61]
(jmpq (@ .SPNVALRET)) ; [68]
;;; #<no source text>
L81
(uuo-error-wrong-number-of-args) ; [81]
NIL
CL-USER> (disassemble (b:g2 1 2))
L0
(leaq (@ (:^ L0) (% rip)) (% fn)) ; [0]
(cmpl ($ 16) (% nargs)) ; [7]
(jne L81) ; [10]
(pushq (% rbp)) ; [12]
(movq (% rsp) (% rbp)) ; [13]
(pushq (% arg_y)) ; [16]
(pushq (% arg_z)) ; [17]
;;; (a:///f/// x y)
(leaq (@ (:^ L61) (% fn)) (% temp0)) ; [18]
(pushq (% temp0)) ; [25]
(movq (% arg_z) (% arg_y)) ; [26]
(movq (@ -8 (% rbp)) (% arg_z)) ; [29]
(movl ($ 16) (% nargs)) ; [33]
(movq (@ '+ (% fn)) (% temp0)) ; [38]
(pushq (@ #x12FB8)) ; [45]
(jmpq (@ 10 (% temp0))) ; [52]
L61
(leaq (@ (:^ L0) (% rip)) (% fn)) ; [61]
(jmpq (@ .SPNVALRET)) ; [68]
;;; #<no source text>
L81
(uuo-error-wrong-number-of-args) ; [81]
NIL
Summary: g's #'h does NOT get a:***f*** inlined g2's #'h DOES get a:///f/// inlined |
|||
