[usocket-devel] Re: some inline in usocket.lisp (trunk)
Chun Tian (binghe)
binghe.lisp at gmail.com
Sun Jul 27 18:50:54 UTC 2008
And there's bugs in backend/cmucl.lisp, fixed version:
(defun %add-waiter (wait-list waiter)
(push (socket waiter) (wait-list-%wait wait-list)))
(defun %remove-waiter (wait-list waiter)
(setf (wait-list-%wait wait-list)
(remove (socket waiter) (wait-list-%wait wait-list))))
Diff:
(defun %add-waiter (wait-list waiter)
- (declare (ignore wait-list waiter))
(push (socket waiter) (wait-list-%wait wait-list)))
(defun %remove-waiter (wait-list waiter)
- (declare (ignore wait-list waiter))
(setf (wait-list-%wait wait-list)
- (remove (socket waiter) (wait-list-%wait waiter))))
+ (remove (socket waiter) (wait-list-%wait wait-list))))
--binghe
在 2008-7-28,上午2:48, Chun Tian (binghe) 写道:
> Hi, Erik
>
> See this:
>
> (declaim (inline %setup-wait-list
> %add-waiter
> %remove-waiter))
>
> When usocket.lisp compiled, these three haven't be defined, how can
> compiler inline them?
>
> I just found, with these inline declaim, CMUCL even not to call the
> real %remove-waiter in remove-waiter:
>
> (defun remove-waiter (wait-list input)
> (%remove-waiter wait-list input)
> (setf (wait-list-waiters wait-list)
> (remove input (wait-list-waiters wait-list))
> (wait-list input) nil)
> (remhash (socket input) (wait-list-map wait-list)))
>
> CMUCL give me this:
>
> * (snmp:snmp-get "binghe-debian.local" "sysDescr.0")
>
> Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
> #<USOCKET:DATAGRAM-USOCKET {487AD7C5}> is not of type
> USOCKET::WAIT-LIST
> [Condition of type TYPE-ERROR]
>
> Restarts:
> 0: [ABORT] Return to Top-Level.
>
> Debug (type H for help)
>
> (USOCKET:REMOVE-WAITER
> #S(USOCKET::WAIT-LIST
> :%WAIT (11)
> :WAITERS (#)
> :MAP #<HASH-TABLE :TEST EQL :WEAK-P NIL :COUNT 1 {487B0EFD}>)
> #<USOCKET:DATAGRAM-USOCKET {487AD7C5}>)
> Source: (%REMOVE-WAITER WAIT-LIST INPUT)
> 0] 0
>
> I set up a format in %remove-waiter, and didn't got any output, so
> to confirm %remove-waiter wasn't be called, just because the inline
> declaim. Without these declaims, everything goes well again:
>
> * (snmp:snmp-get "binghe-debian.local" "sysDescr.0")
> XXX: #S(USOCKET::WAIT-LIST
> :%WAIT (12)
> :WAITERS (#<USOCKET:DATAGRAM-USOCKET {4953EC4D}>)
> :MAP #<HASH-TABLE :TEST EQL :WEAK-P NIL :COUNT 1
> {4954C0CD}>), #<USOCKET:DATAGRAM-USOCKET
> {4953EC4D
> }>
> "Linux binghe-debian.local 2.6.25-2-amd64 #1 SMP Fri Jun 27 00:16:12
> UTC 2008 x86_64"
>
> So I think this is a misuse of inline, and at least break CMUCL.
> Hope you can remove it.
>
> Regards,
>
> Chun Tian (binghe)
>
More information about the usocket-devel
mailing list