[Openmcl-devel] File compilation error

Bill St. Clair billstclair at gmail.com
Thu Nov 12 07:38:13 PST 2009


As you've discovered, you can't store a lock in a fasl file.

Try this instead:

(defun test-function ()
  (macrolet ((test-macro ()
               (let ((lock (gensym "lock")))
                 `(let ((,lock (load-time-value (bordeaux-threads:make-lock))))
                    (print ,lock)))))
    (test-macro)))

The load-time-value delays the evaluation of the make-lock invocation
until the fasl file is loaded.

-Bill

On Thu, Nov 12, 2009 at 10:20 AM, Valentin Baciu <valentin at syntactic.org> wrote:
> Hello,
> I am using CCL (Version 1.4-r13166M  (WindowsX8632)) and cannot compile the
> following file:
> ;; (asdf:oos 'asdf:load-op :bordeaux-threads)
> (defun test-function ()
>   (macrolet ((test-macro ()
>                (let ((lock (gensym "lock")))
>                  `(let ((,lock ,(bordeaux-threads:make-lock)))
>                     (print ,lock)))))
>     (test-macro)))
> I can load the file using (load "test.lisp"), but when I try to eval
> (compile-file "test.lisp") I get the backtrace reproduced bellow. I guess
> that the error is related to the macro-expansion of 'test-macro being saved
> to the fasl file, but I don't know how to fix it.
> Can't dump #<RECURSIVE-LOCK [ptr @ #x1199AC0] #x9135196> - unknown type
>    [Condition of type SIMPLE-ERROR]
> Restarts:
>  0: [RETRY-COMPILE-FILE] Retry compiling #P"d:/tmp/test.lisp"
>  1: [SKIP-COMPILE-FILE] Skip compiling and loading #P"d:/tmp/test.lisp"
>  2: [ABORT] Return to SLIME's top level.
>  3: [ABORT-BREAK] Reset this thread
>  4: [ABORT] Kill this thread
> Backtrace:
>   0: (CCL::FASL-UNKNOWN #<RECURSIVE-LOCK [ptr @ #x1199AC0] #x9135196>)
>   1: (CCL::FASL-SCAN-CLFUN #<Compiled-function TEST-FUNCTION (Non-Global)
>  #x91345AE>)
>   2: (CCL::FASL-SCAN ((23 21) (47 #1="d:/tmp/test.lisp") ..))))
>   3: (CCL::FASL-SCAN-FORMS-AND-DUMP-FILE ((23 21) (47 #1="d:/tmp/test.lisp")
> ..))) "d:/tmp/test.wx32fsl" #<CCL::LEXICAL-ENVIRONMENT #x913E1F6>)
>   4: (CCL::%COMPILE-FILE "d:/tmp/test.lisp" "d:/tmp/test.wx32fsl" T NIL NIL
> T T NIL T :DEFER NIL #<BACKEND WIN32 #x85782E6> :DEFAULT NIL 0)
>   5: (COMPILE-FILE #P"d:/tmp/test.lisp" :OUTPUT-FILE #P"d:/tmp/test.wx32fsl"
> :VERBOSE T :PRINT NIL :LOAD T :FEATURES NIL :TARGET :WIN32
> :SAVE-LOCAL-SYMBOLS T :SAVE-DOC-STRINGS T :SAVE-DEFINITIONS NIL :SAVE..
>   6: (#<Anonymous Function #x8BFB046> #<COMPILED-LEXICAL-CLOSURE #x913EC66>)
>   7: ((:INTERNAL SWANK:COMPILE-FILE-FOR-EMACS))
>   8: (SWANK::MEASURE-TIME-INTERVAL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL
> SWANK:COMPILE-FILE-FOR-EMACS) #x90BA186>)
>   9: (SWANK::COLLECT-NOTES #<COMPILED-LEXICAL-CLOSURE (:INTERNAL
> SWANK:COMPILE-FILE-FOR-EMACS) #x90BA186>)
>  10: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<COMPILED-LEXICAL-CLOSURE
> (:INTERNAL SWANK:COMPILE-FILE-FOR-EMACS) #x90BA1B6>)
>  11: (CCL::CALL-CHECK-REGS SWANK:COMPILE-FILE-FOR-EMACS "d:/tmp/test.lisp" T
> NIL)
>  12: (SWANK::EVAL-FOR-EMACS (SWANK:COMPILE-FILE-FOR-EMACS "d:/tmp/test.lisp"
> T 'NIL) "COMMON-LISP-USER" 65)
>  13: ((:INTERNAL SWANK::SPAWN-WORKER-THREAD))
>  14: (#<Anonymous Function #x8C07576> #<Compiled-function
> SWANK:SWANK-DEBUGGER-HOOK #x8CC696E> #<Compiled-function (:INTERNAL
> SWANK::SPAWN-WORKER-THREAD) (Non-Global)  #x8C552D6>)
>  15: (SWANK::CALL-WITH-BINDINGS ((*STANDARD-OUTPUT* .
> #<SWANK-BACKEND::SLIME-OUTPUT-STREAM #x8D2422E>) (*STANDARD-INPUT* .
> #<SWANK-BACKEND::SLIME-INPUT-STREAM #x8D24466>) ..)))
> #<COMPILED-LEXICAL-CLOSURE (..
>  16: (SWANK::CALL-WITH-CONNECTION #<CONNECTION #x8D053BE>
> #<Compiled-function (:INTERNAL SWANK::SPAWN-WORKER-THREAD) (Non-Global)
>  #x8C552D6>)
>  17: (SWANK::CALL-WITH-BINDINGS NIL #<COMPILED-LEXICAL-CLOSURE (:INTERNAL
> SWANK::SPAWN-WORKER-THREAD) #x90BA426>)
>  18: (CCL::RUN-PROCESS-INITIAL-FORM #<PROCESS worker(28) [Active] #x90B4C3E>
> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL CCL::%PROCESS-RUN-FUNCTION)
> #x90B4AFE>))
>  19: ((:INTERNAL (CCL::%PROCESS-PRESET-INTERNAL (PROCESS))) #<PROCESS
> worker(28) [Active] #x9002276> (#<COMPILED-LEXICAL-CLOSURE (:INTERNAL
> CCL::%PROCESS-RUN-FUNCTION) #x9002136>))
>  20: ((:INTERNAL CCL::THREAD-MAKE-STARTUP-FUNCTION))
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list