[Openmcl-devel] Openmcl/SLIME problem

Gary Byers gb at clozure.com
Thu Feb 28 18:48:02 PST 2008


This should actually work more reliably in the next release: if we get
a number-of-args error on function entry, then we can't really act as
if a stack frame has been built and arguments and local variables have
well-defined locations in stack-frame slots or registers.  The hard
part about backporting that change to 1.1 involves reliably detecting
that we're at a "haven't really finished entering the function" point.

One thing that -can- be done in 1.1 is to ignore/suppress errors
that might occur when poking around in a partial stack frame. it'd
be nicer to get an accurate idea of what the too many/too few args
were in cases like this, but it's better to lie (return NIL) than
to just blow up.

On Fri, 29 Feb 2008, Takehiko Abe wrote:

> Neil Baylis wrote:
>
>> I run into a problem when running SLIME with Clozure Common Lisp
>> (a.k.a.  openmcl).
>>
>> When I call a function with the wrong number of args, the error
>> message is unhelpful. When I do the same running openmcl directly
>> (not via SLIME) it works correctly. Here's a transcript:
>
> I tried the same and it appeared to work correctly. However,
>
> ;; Welcome to Clozure Common Lisp Version 1.1-r (LinuxX8664)!
> ;; ? (defun foo (a b) (+ a b))
> ;; FOO
> ;; ? (foo 1)
> ;; > Error: Too few arguments in call to #<Compiled-function FOO
> ;; >        1 arguments provided, at least 2 required.
> ;; > While executing: FOO, in process listener(1).
> ;; > Type :POP to abort, :R for a list of available restarts.
> ;; > Type :? for other options.
> ;; 1> (:f 0)
> ;; (2AAAAACBBAC0) : 0 (FOO ? ?) 15#<error printing args and locals>
>
> Note the #<error printing args and locals>.
>
> Slime tries to print this "args and locals" and that triggers an
> error in openmcl.
>
> The error is signaled in ccl::arguments-and-locals:
>
> ;; ; SLIME 2007-06-28
> ;; CL-USER> (defun foo (a b) (+ a b))
> ;; FOO
> ;; CL-USER> (foo 1)
> ;; > Error: value -2 is not of the expected type UNSIGNED-BYTE.
> ;; > While executing: NBUTLAST, in process repl-thread(5).
> ;; > Type :POP to abort, :R for a list of available restarts.
> ;; > Type :? for other options.
> ;; 1> :b
> ;;
> ;; (2AAAABD47098) : 0 (NBUTLAST NIL [...]) 237
> ;; (2AAAABD470E0) : 1 (ARGUMENTS-AND-LOCALS
> ;;                      NIL
> ;;                      5864064454420
> ;;                      #<Compiled-function FOO #x30004104FE6F>
> ;;                      15
> ;;                      [...]) 1085
>
> NBUTLAST is called with (nil -2) because ccl::variables-in-scope
> returns nil:
>
> (defun arguments-and-locals (context cfp lfun pc &optional unavailable)
>   (multiple-value-bind (vars map-indices) (variables-in-scope lfun pc)
>     (collect ((args)
> 	      (locals))
>       (multiple-value-bind (valid req opt rest keys)
> 			   (arg-names-from-map lfun pc)
> 	(when valid
> 	  (let* ((nargs (+ (length req) ...))
> 		 (nlocals (- (length vars) nargs))
> 		 (local-vars (nthcdr nargs vars))
> 		 (local-indices (nthcdr nargs map-indices))
> 		 (arg-vars (nbutlast vars nlocals))
> 		 (arg-indices (nbutlast map-indices nlocals)))
> 	    ...
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list