Custom Query (1030 matches)
Results (373 - 375 of 1030)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #1269 | fixed | Lambdas don't optimize | ||
| Description |
Optimization works on defun forms like the following: (defun fptest1 (a b)
(declare (optimize (speed 3) (safety 1) (debug 1))
(single-float a b))
(+ a b))
(disassemble 'fptest1)
We can see from the disassembly that it's using the addss* instruction and not calling .SPBUILTIN-PLUS, so we know the optimization is happening. [*addss is X86. The ARM equivalent is fadds.] But lambda forms like the following don't optimize in CCL: (defun fptest8 ()
(declare (optimize (speed 3) (safety 0) (debug 0)))
(lambda (a b)
(declare (optimize (speed 3) (safety 0) (debug 0))
(single-float a b))
(+ a b)))
(disassemble (fptest8))
Because the disassembly contains the telltale line (jmpq (@ .SPBUILTIN-PLUS)), we know that optimization isn't happening. However, the following works: (defparameter fptest14
(lambda (a b)
(declare (optimize (speed 3) (safety 1) (debug 1))
(single-float a b))
(+ a b)))
(disassemble fptest14)
As you can see, the resulting disassembly has no call to .SPBUILTIN-PLUS but rather it calls (addss (% fp1) (% fp0)), indicating optimization is happening. So using a global variable rather than a defun seems to be a partial workaround for anonymous functions, but not closures. |
|||
| #1317 | fixed | LOAD-TIME-VALUE constantness issue | ||
| Description |
The following code works fine in ccl-1.9: (in-package :cl-user)
(defun abc ()
(let* ((body
'(let ((cache (load-time-value (cons (cons nil nil) nil))))
(let ((fn #'(lambda () t)))
(setf (car cache) (cons fn t))
(values (funcall (caar cache))))))
(thunk (compile nil `(lambda () ,body))))
(disassemble thunk)
(funcall thunk)))
(print (abc))
but fails with "Error of type CCL::INVALID-MEMORY-ACCESS: Fault during read of memory address #x0" error on (funcall (caar cache)) form in trunk and ccl-1.10. The code was distilled from a piece of code utilizing LOAD-TIME-VALUE cache pattern as in http://random-state.net/log/3507100003.html (I used it in a compiler macro) The problem can be currently worked around by commenting out (multiple-value-bind ...) form in (def-acode-rewrite acode-rewrite-cxr ...) in compiler/acode-rewrite.lisp: http://trac.clozure.com/ccl/browser/trunk/source/compiler/acode-rewrite.lisp?rev=16571#L567 Disassembly output before applying the workaround. Looks like the compiler treats (load-time-value (cons (cons nil nil) nil)) as a read-only constant value that cannot be changed: (recover-fn-from-rip) ; [7]
(testl (% nargs) (% nargs)) ; [14]
(jne L149) ; [16]
(pushq (% rbp)) ; [22]
(movq (% rsp) (% rbp)) ; [23]
(movq (@ '#<Anonymous Function #x302000B53A9F> (% fn)) (% arg_z)) ; [26]
(pushq (% arg_z)) ; [33]
(movq (@ '((NIL)) (% fn)) (% arg_y)) ; [34]
(pushq (% arg_y)) ; [41]
(movq (@ -8 (% rbp)) (% arg_y)) ; [42]
(movl ($ #x1302E) (% arg_z.l)) ; [46]
(subq ($ 13) (@ (% gs) #xD8)) ; [51]
(movq (@ (% gs) #xD8) (% temp0)) ; [61]
(cmpq (@ (% gs) #xE0) (% temp0)) ; [70]
(ja L76) ; [79]
(uuo-alloc) ; [81]
L76
(andb ($ #xF0) (@ (% gs) #xD8)) ; [83]
(movq (% arg_y) (@ 5 (% temp0))) ; [92]
(movq (% arg_z) (@ -3 (% temp0))) ; [96]
(movq (% temp0) (% arg_z)) ; [100]
(popq (% arg_y)) ; [103]
(lisp-call (@ .SPRPLACA)) ; [109]
(recover-fn-from-rip) ; [116]
(xorl (% nargs) (% nargs)) ; [123]
(movq (@ 'NIL (% fn)) (% temp0)) ; [125]
(lisp-call (@ 10 (% temp0))) ; [137]
(recover-fn-from-rip) ; [140]
(leaveq) ; [147]
(retq) ; [148]
L149
(uuo-error-wrong-number-of-args)
Disassembly output after applying the workaround: (recover-fn-from-rip) ; [7]
(testl (% nargs) (% nargs)) ; [14]
(jne L193) ; [16]
(pushq (% rbp)) ; [22]
(movq (% rsp) (% rbp)) ; [23]
(movq (@ '#<Anonymous Function #x302000B0A71F> (% fn)) (% arg_z)) ; [26]
(pushq (% arg_z)) ; [33]
(movq (@ '((NIL)) (% fn)) (% arg_y)) ; [34]
(pushq (% arg_y)) ; [41]
(movq (@ -8 (% rbp)) (% arg_y)) ; [42]
(movl ($ #x1302E) (% arg_z.l)) ; [46]
(subq ($ 13) (@ (% gs) #xD8)) ; [51]
(movq (@ (% gs) #xD8) (% temp0)) ; [61]
(cmpq (@ (% gs) #xE0) (% temp0)) ; [70]
(ja L76) ; [79]
(uuo-alloc) ; [81]
L76
(andb ($ #xF0) (@ (% gs) #xD8)) ; [83]
(movq (% arg_y) (@ 5 (% temp0))) ; [92]
(movq (% arg_z) (@ -3 (% temp0))) ; [96]
(movq (% temp0) (% arg_z)) ; [100]
(popq (% arg_y)) ; [103]
(lisp-call (@ .SPRPLACA)) ; [109]
(recover-fn-from-rip) ; [116]
(movq (@ '((NIL)) (% fn)) (% arg_z)) ; [123]
(movq (@ 5 (% arg_z)) (% arg_z)) ; [130]
(movl (% arg_z.l) (% imm0.l)) ; [134]
(andl ($ 7) (% imm0.l)) ; [136]
(cmpl ($ 3) (% imm0.l)) ; [139]
(jne L201) ; [142]
(movq (@ 5 (% arg_z)) (% arg_z)) ; [144]
(pushq (% arg_z)) ; [148]
(movq (@ -16 (% rbp)) (% temp0)) ; [149]
(xorl (% nargs) (% nargs)) ; [153]
(movl (% temp0.l) (% imm0.l)) ; [155]
(andl ($ 15) (% imm0.l)) ; [157]
(cmpl ($ 14) (% imm0.l)) ; [160]
(cmovgq (% temp0) (% temp1)) ; [163]
(jl L209) ; [167]
(cmoveq (@ 10 (% temp0)) (% temp1)) ; [169]
(lisp-call (% temp1)) ; [177]
(recover-fn-from-rip) ; [180]
(addq ($ 8) (% rsp)) ; [187]
(leaveq) ; [191]
(retq) ; [192]
L193
(uuo-error-wrong-number-of-args) ; [200]
L201
(uuo-error-reg-not-list (% arg_z)) ; [208]
L209
(uuo-error-not-callable) ; [216]
|
|||
| #1360 | fixed | Miscompilation on ARM | ||
| Description |
CCL trunk, distilled from ITERATE load error. Note (BOUNDP 'VERSION) instead of "Current version of Iterate", DOC variable gets mixed up with another value. CL-USER> (defun zzz (WHOLE ENVIRON)
(DECLARE
(IGNORABLE WHOLE ENVIRON))
(BLOCK DEFCONST
(LET* ((ARGS
(CCL::PREPARE-TO-DESTRUCTURE
(CDR WHOLE)
'(NAME VALUE &OPTIONAL DOC)
2
3))
(NAME (POP ARGS))
(VALUE (POP ARGS))
(DOC
(IF
ARGS
(POP ARGS)
'NIL)))
(LIST*
'UNLESS
(LIST*
(LIST*
'BOUNDP
(LIST (LIST* 'QUOTE (LIST NAME))))
(LIST
(IF
DOC
(LIST*
'DEFCONSTANT
(LIST*
NAME
(LIST* VALUE (LIST DOC))))
(LIST*
'DEFCONSTANT
(LIST*
NAME
(LIST VALUE))))))))))
ZZZ
CL-USER> (print (zzz '(defconst version "1.4" "Current version of Iterate") nil))
(UNLESS (BOUNDP 'VERSION) (DEFCONSTANT VERSION "1.4" (BOUNDP 'VERSION)))
Original macro: (defmacro defconst (name value &optional doc)
`(eval-when (:compile-toplevel :load-toplevel :execute)
(unless (boundp ',name)
,(if doc
`(defconstant ,name ,value ,doc)
`(defconstant ,name ,value)))))
|
|||
