[Openmcl-devel] Mystery warning: Redefining STRUCT :OBJC_METHOD fields to be. Bug in record-fields-match?

Gary Byers gb at clozure.com
Thu Aug 16 09:32:24 PDT 2007


One way to reproduce this is:

? (use-interface-dir :cocoa)
#<INTERFACE-DIR ..>
? (ccl::load-record :objc_method) ; read the structure type from database
#<FOREIGN-RECORD-TYPE (:STRUCT :OBJC_METHOD ...)>
? (make-load-form *) ; return a form that, when evaluated, will
                      ; return something "equivalent" to its argument.
                      ; (This is necessary when certain types of objects
                      ; are referenced as constants in code compiled
                      ; by COMPILE-FILE.)
(CCL::PARSE-FOREIGN-TYPE '(:STRUCT :OBJC_METHOD (:METHOD-NAME ...)))
? (eval *)           ; try to reconstruct the foreign type object

The fairly new (a few months old ...) typed-pointer mechanism 
(MAKE-RECORD, RLET ...) compiles into code which references foreign
type objects as constants; when those type objects are saved to and
loaded from FASL files, the result -should- be "equivalent" to the
original; in this case, it should involve a harmless "equivalent"
redefinition of the :OBJC_METHOD structure type.

CCL::LOAD-RECORD and CCL::PARSE-FOREIGN-TYPE of a record type specifier
should do about the same thing (and return "equivalent" results), but
they do it in different ways.  They differ in at least one way: when
reading the encoded representation of "pointer to void"", CCL::LOAD-RECORD
actually creates a pointer to NIL (which, somewhat confusingly, prints
as "(:* :VOID)").  CCL::PARSE-FOREIGN-TYPE processes the (:* :VOID)
and creates a pointer to ... :VOID.  CCL::RECORD-FIELDS-MATCH notices
this this difference and warns about it (but the difference isn't
apparent in the printed representation of the field types in the 
warning message.)

CCL::LOAD-RECORD should really treat "pointer to VOID" the same way
that CCL::PARSE-FOREIGN-TYPE does.  The fact that it doesn't isn't
really significant in any way that I can think of, but the different
representation is enough to generate the warning here.  You're right
in thinking that the warning is merely annoying in this case.


On Thu, 16 Aug 2007, Daniel Dickison wrote:

> I have a fairly complex program which bridges a portable Common Lisp
> windowing interface and OpenMCL's Cocoa interface.  I consistently
> get the following warning when loading the system:
>
> ; Warning: Redefining STRUCT :OBJC_METHOD fields to be:
> ;          (#<FOREIGN-RECORD-FIELD #<FOREIGN-POINTER-TYPE (:*
> ;                                                          (:STRUCT
> ;                                                           :OBJC_SELECT
> OR)) #x8D0820E> :METHOD_NAME 32 at 0>
> ;           #<FOREIGN-RECORD-FIELD #<FOREIGN-POINTER-TYPE (:*
> ;                                                          (:SIGNED
> ;                                                           8))
> #x8BF5D5E> :METHOD_TYPES 32 at 32>
> ;           #<FOREIGN-RECORD-FIELD #<FOREIGN-POINTER-TYPE (:*
> ;                                                          (:*
> ;                                                           :VOID))
> #x8D081AE> :METHOD_IMP 32 at 64>)
> ;          were
> ;          (#<FOREIGN-RECORD-FIELD #<FOREIGN-POINTER-TYPE (:*
> ;                                                          (:STRUCT
> ;                                                           :OBJC_SELECT
> OR)) #x88E5006> :METHOD_NAME 32 at 0>
> ;           #<FOREIGN-RECORD-FIELD #<FOREIGN-POINTER-TYPE (:*
> ;                                                          (:SIGNED
> ;                                                           8))
> #x88ED03E> :METHOD_TYPES 32 at 32>
> ;           #<FOREIGN-RECORD-FIELD #<FOREIGN-POINTER-TYPE (:*
> ;                                                          (:*
> ;                                                           :VOID))
> #x88ECF56> :METHOD_IMP 32 at 64>)
> ; While executing: CCL::PARSE-FOREIGN-RECORD-TYPE, in process worker(7).
>
> The code then works fine, so it seems to be harmless.  The program is
> loaded from several different files, if that make any difference.
> The warning seems to happen when it loads one of the later FASL files
> (not during compilation).
>
> As you can see, the 2 struct field types appear to match in name,
> type, size and offset, so I'm guessing there's a bug in ccl::record-
> fields-match, but I can't find it.  I can send the code or backtrace
> if that will help.
>
> Thanks for any help!
>
> Daniel
>
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list