[Openmcl-devel] Missing header(s) for OpenGL FFI?

Gary Byers gb at clozure.com
Sun Aug 13 02:27:31 PDT 2006



On Sun, 13 Aug 2006, Phil wrote:

> I made the change and, after confirming that it still works with old 
> interfaces, the results were as you expected using the new interfaces.


What I expected is for the problem that you mentioned earlier to have
nothing to do with what interfaces you've been using.

> Here's the backtrace:

Of another problem entirely.

As near as I can tell, you've introduced a declaration for a "display"
method on a class named "DOMCSSStyleDeclaration" (presumably by loading
WebKit.)  Unlike the "display" methods on NSWindow and NSView that
the bridge already knows about - which return :VOID - the "display"
method on DOMCSSStyleDeclaration returns an NSString.  In order to
compile (SEND x 'display), the bridge needs to know whether X
is a DOMCSSStyleDeclaration or something else.

As I tried to explain in a reply to someone else a few days ago, the
code used by the WebKit example to make the classes defined in an
add-on/framework library like WebKit doesn't work correctly.  (It
usually works well enough for the WebKit demo to be able to create
a primitive web browser, but it doesn't really process all of the
classes that're introduced by loading the new framework.  (Which
new classes get "processed" - introduced to CLOS, basically - and
which don't is entirely arbitrary; it may depend on the order
in which elements in an ObjC hash table are traversed, or something
equally unpredictable.)

So, SEND tries to generate code which tests X for
DOMCSSStyleDeclaration-ness, and finds that it has no knowledge of
the class DOMCSSStyleDeclaration.

You can probably get the WebKit example to force all classes to be
processed by calling RESET-OBJC-CLASS-COUNT just before the call to
MAP-OBJC-CLASSES in the function CHECK-FOR-WEBKIT in
"ccl:examples;webkit.lisp".  You may run into other problems,
and it's unfortunately the case that trying to load an add-on
framework on top of Cocoa basically doesn't work reliably in 1.0;
if it seems to, that's largely an accident.


>
> Class #<A Mac Pointer #xA5CE091C> isn't recognized.
>   [Condition of type SIMPLE-ERROR]
>
> Restarts:
>  0: [RETRY-LOAD] Retry loading "/tmp/util-cocoa-graph.lisp"
>  1: [SKIP-LOAD] Skip loading "/tmp/util-cocoa-graph.lisp"
>  2: [LOAD-OTHER] Load other file instead of "/tmp/util-cocoa-graph.lisp"
>  3: [ABORT-REQUEST] Abort handling SLIME request.
>  4: [ABORT-BREAK] Reset this process
>  5: [ABORT] Kill this process
>
> Backtrace:
>  0: (CCL::CANONICALIZE-REGISTERED-CLASS #<A Mac Pointer #xA5CE091C>)
>  1: (CCL::GET-OBJC-METHOD-INFO-CLASS #<CCL::DESTRUCTURE-STATE #x16947BE>)
>  2: (CCL::METHOD-CLASS-NAME #<OBJC-METHOD-INFO -[DOMCSSStyleDeclaration 
> display] #x91806B6>)
>  3: (CCL::BUILD-SEND-CASE '((#<OBJC-METHOD-INFO -[DOMCSSStyleDeclaration 
> #1=display] #x91806B6>) (#<OBJC-METHOD-INFO -[NSWindow #1#] #x918075E> 
> #<OBJC-METHOD-INFO -[NSView #1#] #x918071E>)) 'NIL 'NIL '#:G8765 "display" 
> 'NIL 'NIL)
>  4: (CCL::BUILD-AMBIGUOUS-SEND-FORM #S(CCL::OBJC-MESSAGE-INFO :MESSAGE-NAME 
> #1="display" :METHODS (#2=#<OBJC-METHOD-INFO -[DOMCSSStyleDeclaration #1#] 
> #x91806B6> #4=#<OBJC-METHOD-INFO -[NSView #1#] #x918071E> 
> #3=#<OBJC-METHOD-INFO -[NSWindow #1#] #x918075E>) :AMBIGUOUS-METHODS ((#2#) 
> (#3# #4#)) :REQ-ARGS 0 :FLAGS ...) 'NIL 'NIL 'THIS "display" 'NIL 'NIL 'NIL 
> 'NIL)
>  5: (CCL::SEND '(CCL::SEND THIS "display") #<CCL::LEXICAL-ENVIRONMENT 
> #x92E6EB6>)
>  6: (FUNCALL #<Compiled-function CCL::SEND Macroexpander #x83D72DE>)
>  7: (MACROEXPAND-1 '(CCL::SEND THIS "display") 'CCL::SEND)
>  8: (CCL::NX-TRANSFORM '(CCL::SEND THIS "display") #<CCL::LEXICAL- 
> ENVIRONMENT #x92E6EB6>)
>  9: (CCL::NX1-TYPED-FORM '(CCL::SEND THIS "display") #<CCL::LEXICAL- 
> ENVIRONMENT #x92E6EB6>)
> 10: (CCL::NX1-FORM '(CCL::SEND THIS "display"))
> 11: (CCL::NX1-FORMLIST '((SETF (SLOT-VALUE THIS #) (MAKE-TICKER-CHART # 
> :BEGIN-DATE #)) (CCL::SEND THIS "display")))
> 12: (CCL::NX1-PROGN-BODY 'NIL)
> 13: (CCL::NX1-ENV-BODY '((SETF (SLOT-VALUE THIS #) (MAKE-TICKER-CHART # 
> :BEGIN-DATE #)) (CCL::SEND THIS "display")) 'NIL)
> 14: (CCL::NX1-FLET '(FLET ((CALL-NEXT-METHOD # # #) (NEXT-METHOD-P NIL #)) 
> (DECLARE (INLINE CALL-NEXT-METHOD NEXT-METHOD-P)) (SETF (SLOT-VALUE THIS #) 
> (MAKE-TICKER-CHART # :BEGIN-DATE #)) (CCL::SEND THIS "display")) 
> #<CCL::LEXICAL-ENVIRONMENT #x92E6F96>)
> 15: (CCL::NX1-COMBINATION #<CCL::LEXICAL-ENVIRONMENT #x92E6F96> '(FLET 
> ((CALL-NEXT-METHOD # # #) (NEXT-METHOD-P NIL #)) (DECLARE (INLINE 
> CALL-NEXT-METHOD NEXT-METHOD-P)) (SETF (SLOT-VALUE THIS #) (MAKE-TICKER-CHART 
> # :BEGIN-DATE #)) (CCL::SEND THIS "display")))
> 16: (CCL::NX1-FORM '(FLET ((CALL-NEXT-METHOD # # #) (NEXT-METHOD-P NIL #)) 
> (DECLARE (INLINE CALL-NEXT-METHOD NEXT-METHOD-P)) (SETF (SLOT-VALUE THIS #) 
> (MAKE-TICKER-CHART # :BEGIN-DATE #)) (CCL::SEND THIS "display")))
> 17: (CCL::NX1-BLOCK '(BLOCK UPDATE-CHART (FLET (# #) (DECLARE #) (SETF # #) 
> (CCL::SEND THIS "display"))) #<CCL::LEXICAL-ENVIRONMENT #x92E7076>)
> 18: (CCL::NX1-COMBINATION #<CCL::LEXICAL-ENVIRONMENT #x92E7076> '(BLOCK 
> UPDATE-CHART (FLET (# #) (DECLARE #) (SETF # #) (CCL::SEND THIS "display"))))
> 19: (CCL::NX1-FORM '(BLOCK UPDATE-CHART (FLET (# #) (DECLARE #) (SETF # #) 
> (CCL::SEND THIS "display"))))
> 20: (CCL::NX1-ENV-BODY '((BLOCK UPDATE-CHART (FLET # # # #))) '(NIL NIL))
> 21: (CCL::NX1-LAMBDA '((DECLARE (IGNORABLE THIS))) 'NIL '(NFUNCTION 
> UPDATE-CHART (LAMBDA (CCL::&METHOD #:NEXT-METHOD-CONTEXT THIS) (DECLARE #) 
> (BLOCK UPDATE-CHART #))))
> 22: (CCL::NX1-COMPILE-LAMBDA 'UPDATE-CHART '(LAMBDA (CCL::&METHOD 
> #:NEXT-METHOD-CONTEXT THIS) (DECLARE (IGNORABLE THIS)) (BLOCK UPDATE-CHART 
> (FLET # # # #))) #<CCL::AFUNC #x92E70EE>)
> 23: (CCL::NX1-REF-INNER-FUNCTION 'UPDATE-CHART '(LAMBDA (CCL::&METHOD 
> #:NEXT-METHOD-CONTEXT THIS) (DECLARE (IGNORABLE THIS)) (BLOCK UPDATE-CHART 
> (FLET # # # #))) #<CCL::DESTRUCTURE-STATE #x1694876>)
> 24: (CCL::NX1-NFUNCTION '(NFUNCTION UPDATE-CHART (LAMBDA (CCL::&METHOD 
> #:NEXT-METHOD-CONTEXT THIS) (DECLARE #) (BLOCK UPDATE-CHART #))) 
> #<CCL::LEXICAL-ENVIRONMENT #x92E71D6>)
> 25: (CCL::NX1-COMBINATION #<CCL::LEXICAL-ENVIRONMENT #x92E71D6> '(NFUNCTION 
> UPDATE-CHART (LAMBDA (CCL::&METHOD #:NEXT-METHOD-CONTEXT THIS) (DECLARE #) 
> (BLOCK UPDATE-CHART #))))
> 26: (CCL::NX1-FORM '(NFUNCTION UPDATE-CHART (LAMBDA (CCL::&METHOD 
> #:NEXT-METHOD-CONTEXT THIS) (DECLARE #) (BLOCK UPDATE-CHART #))))
> 27: (CCL::NX1-ARGLIST '('UPDATE-CHART (LIST 'CHART-OPENGL-VIEW) :FUNCTION 
> (NFUNCTION UPDATE-CHART (LAMBDA # # #)) :QUALIFIERS 'NIL :LAMBDA-LIST 
> '(THIS)) 3)
> 28: (CCL::NX1-CALL-FORM 'CCL::ENSURE-METHOD 'NIL 'CCL::ENSURE-METHOD 'NIL)
> 29: (CCL::NX1-CALL 'CCL::ENSURE-METHOD 'CCL::ENSURE-METHOD 
> '(CCL::ENSURE-METHOD 'UPDATE-CHART (LIST 'CHART-OPENGL-VIEW) :FUNCTION 
> (NFUNCTION UPDATE-CHART (LAMBDA # # #)) :QUALIFIERS 'NIL :LAMBDA-LIST 
> '(THIS)) '(CCL::*NX-METHOD-WARNING-NAME*))
> 30: (CCL::NX1-TYPED-CALL 'CCL::ENSURE-METHOD '('UPDATE-CHART (LIST 
> 'CHART-OPENGL-VIEW) :FUNCTION (NFUNCTION UPDATE-CHART (LAMBDA # # #)) 
> :QUALIFIERS 'NIL :LAMBDA-LIST '(THIS)))
> 31: (CCL::NX1-COMBINATION #<CCL::LEXICAL-ENVIRONMENT #x92E71D6> 
> '(CCL::ENSURE-METHOD 'UPDATE-CHART (LIST 'CHART-OPENGL-VIEW) :FUNCTION 
> (NFUNCTION UPDATE-CHART (LAMBDA # # #)) :QUALIFIERS 'NIL :LAMBDA-LIST 
> '(THIS)))
> 32: (CCL::NX1-FORM '(CCL::ENSURE-METHOD 'UPDATE-CHART (LIST 'CHART- 
> OPENGL-VIEW) :FUNCTION (NFUNCTION UPDATE-CHART (LAMBDA # # #)) :QUALIFIERS 
> 'NIL :LAMBDA-LIST '(THIS)))
> 33: (CCL::NX1-CATCH-BODY '((CCL::ENSURE-METHOD 'UPDATE-CHART (LIST #) 
> :FUNCTION (NFUNCTION UPDATE-CHART #) :QUALIFIERS 'NIL :LAMBDA-LIST '#)))
> 34: (CCL::NX1-COMPILER-LET '(COMPILER-LET ((CCL::*NX-METHOD-WARNING-NAME* #)) 
> (CCL::ENSURE-METHOD 'UPDATE-CHART (LIST #) :FUNCTION (NFUNCTION UPDATE-CHART 
> #) :QUALIFIERS 'NIL :LAMBDA-LIST '#)) #<CCL::LEXICAL-ENVIRONMENT #x92E726E>)
> 35: (CCL::NX1-COMBINATION #<CCL::LEXICAL-ENVIRONMENT #x92E726E> 
> '(COMPILER-LET ((CCL::*NX-METHOD-WARNING-NAME* #)) (CCL::ENSURE-METHOD 
> 'UPDATE-CHART (LIST #) :FUNCTION (NFUNCTION UPDATE-CHART #) :QUALIFIERS 'NIL 
> :LAMBDA-LIST '#)))
> 36: (CCL::NX1-FORM '(COMPILER-LET ((CCL::*NX-METHOD-WARNING-NAME* #)) 
> (CCL::ENSURE-METHOD 'UPDATE-CHART (LIST #) :FUNCTION (NFUNCTION UPDATE-CHART 
> #) :QUALIFIERS 'NIL :LAMBDA-LIST '#)))
> 37: (CCL::NX1-PROGN '(PROGN (COMPILER-LET (#) (CCL::ENSURE-METHOD # # 
> :FUNCTION # :QUALIFIERS # :LAMBDA-LIST #))) #<CCL::LEXICAL-ENVIRONMENT 
> #x92E726E>)
> 38: (CCL::NX1-COMBINATION #<CCL::LEXICAL-ENVIRONMENT #x92E726E> '(PROGN 
> (COMPILER-LET (#) (CCL::ENSURE-METHOD # # :FUNCTION # :QUALIFIERS # 
> :LAMBDA-LIST #))))
> 39: (CCL::NX1-FORM '(PROGN (COMPILER-LET (#) (CCL::ENSURE-METHOD # # 
> :FUNCTION # :QUALIFIERS # :LAMBDA-LIST #))))
> 40: (CCL::NX1-ENV-BODY '((PROGN (COMPILER-LET # #))) '(NIL NIL))
> 41: (CCL::NX1-LAMBDA 'NIL '(LAMBDA NIL (PROGN (COMPILER-LET # #))) 'NIL)
> 42: (CCL::NX1-COMPILE-LAMBDA 'NIL '(LAMBDA NIL (PROGN (COMPILER-LET # #))) 
> #<CCL::AFUNC #x92E72D6>)
> 43: (CCL::COMPILE-NAMED-FUNCTION '(LAMBDA NIL (PROGN (COMPILER-LET # #))) 
> 'NIL #<CCL::LEXICAL-ENVIRONMENT #x92E738E> 'NIL 'T)
> 44: (CCL::COMPILE-USER-FUNCTION '(LAMBDA NIL (PROGN (COMPILER-LET # #))) 'NIL 
> #<CCL::LEXICAL-ENVIRONMENT #x92E738E>)
> 45: (CCL::CHEAP-EVAL-IN-ENVIRONMENT '(DEFMETHOD UPDATE-CHART ((THIS 
> CHART-OPENGL-VIEW)) (SETF (SLOT-VALUE THIS #) (MAKE-TICKER-CHART # 
> :BEGIN-DATE #)) (CCL::SEND THIS "display")) 'NIL)
> 46: (CCL::LOAD-FROM-STREAM #P"/private/tmp/util-cocoa-graph.lisp" #<SVAR 
> *LOAD-TRUENAME* 228 #x80C49D6>)
> 47: (CCL::%LOAD "/tmp/util-cocoa-graph.lisp" 'NIL ':ERROR ':DEFAULT 
> '(#<RESTART CCL::RETRY-LOAD #x1694A76> #<RESTART CCL::SKIP-LOAD #x1694A9E> 
> #<RESTART CCL::LOAD-OTHER #x1694AC6>))
> 48: (LOAD "/tmp/util-cocoa-graph.lisp")
> 49: (CCL::CALL-CHECK-REGS 'LOAD)
> 50: (SWANK::EVAL-REGION "(load \"/tmp/util-cocoa-graph.lisp\")
> " 'T)
> 51: (#<Anonymous Function #x9141906> "(load \"/tmp/util-cocoa-graph.lisp\")
> ")
> 52: (SWANK::CALL-WITH-BUFFER-SYNTAX #<COMPILED-LEXICAL-CLOSURE #x924CC3E>)
> 53: (CCL::CALL-CHECK-REGS 'SWANK:LISTENER-EVAL)
> 54: (#<Anonymous Function #x91446C6> '(SWANK:LISTENER-EVAL "(load \"/ 
> tmp/util-cocoa-graph.lisp\")
> ") 44 "COMMON-LISP-USER")
> 55: (#<STANDARD-METHOD SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK (T T)> 
> #<Compiled-function SWANK:SWANK-DEBUGGER-HOOK #x914063E> #<COMPILED- 
> LEXICAL-CLOSURE #x924CC5E>)
> 56: (FUNCALL 'SWANK::EVAL-FOR-EMACS)
> 57: (#<Anonymous Function #x911335E>)
> 58: (#<STANDARD-METHOD SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK (T T)> 
> #<Compiled-function SWANK:SWANK-DEBUGGER-HOOK #x914063E> #<Anonymous Function 
> #x911335E>)
> 59: (SWANK::CALL-WITH-REDIRECTED-IO #<COMPILED-LEXICAL-CLOSURE #x924CC7E> 
> #<CONNECTION  #x916BF06>)
> 60: (SWANK::CALL-WITH-CONNECTION #<CONNECTION  #x916BF06> #<Anonymous 
> Function #x911335E>)
> 61: (SWANK::HANDLE-REQUEST #<CONNECTION  #x916BF06>)
> 62: (#<Anonymous Function #x910F54E> #<CONNECTION  #x916BF06>)
> 63: (#<STANDARD-METHOD SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK (T T)> 
> #<Compiled-function SWANK:SWANK-DEBUGGER-HOOK #x914063E> #<COMPILED- 
> LEXICAL-CLOSURE #x924D02E>)
> 64: (SWANK::CALL-WITH-REDIRECTED-IO #<COMPILED-LEXICAL-CLOSURE #x924D016> 
> 'NIL)
> 65: (SWANK::CALL-WITH-CONNECTION #<CONNECTION  #x916BF06> #<COMPILED- 
> LEXICAL-CLOSURE #x924D02E>)
> 66: (SWANK::CALL-WITH-BINDINGS 'NIL #<COMPILED-LEXICAL-CLOSURE #x924D046>)
> 67: (CCL::RUN-PROCESS-INITIAL-FORM '(#<COMPILED-LEXICAL-CLOSURE #x924AEDE>) 
> #<PROCESS new-repl-thread(22) [Active] #x924AF16>)
> 68: (#<Anonymous Function #x80DB2DE> '(#<COMPILED-LEXICAL-CLOSURE #x924AEDE>) 
> 0)
> 69: (#<Anonymous Function #x80CE5EE> 1021504 #<LISP-THREAD new-repl-thread 
> [tcr @ #x3E5900] #x924B00E>)
>
> On Aug 13, 2006, at 1:48 AM, Gary Byers wrote:
>
>> 
>> It seems that you can actually provoke the bug just by doing:
>> 
>> ? (require "COCOA")
>> [...]
>> ? (%int-to-ptr #xc000000) ; other values whose addresses are greater
>>                           ; than the highest library address in use
>> 			  ; will also fail.
>> 
>> The set of interfaces you're using doesn't have too much to do with
>> this bug, but it might (in some way) somehow affect where #_malloc
>> and things like that decide to put things.  That probably isn't easy
>> to predict, and of course this shouldn't crash.
>> 
>> In the file "ccl:examples;objc-runtime.lisp", there's a function
>> called POINTER-IN-CFSTRING-SECTION-P; it's defined within a LET*
>> along with a few other functions.  It starts out by doing:
>> 
>>     (let* ((addr (%ptr-to-int ptr))
>>            (min 0)
>>            (max (length cfstring-sections-vector)))
>> 
>> MAX really wants to be the index of the last element instead of the
>> length of the vector, so the last binding should be something like:
>> 
>>            (max (1- (length cfstring-sections-vector))))
>> 
>
>



More information about the Openmcl-devel mailing list