On 7 Jan 2010, at 14:35, Quentin Mathé wrote:

> Hi David,
> class_getSuperclass() seems to be correctly implemented in
> ObjectiveC2.framework but not in libobjc2.
> In libobjc2, it calls class_get_super_class() which doesn't work with
> a metaclass as argument.

Please read the commit log or the code.  class_get_super_class() in  
libobjc2 does work correctly with metaclasses and unresolved classes.

I made this change because I noticed that the runtime was using  
class_get_super_class() in a few places and expecting it to actually  
work, where it was in fact only working in the common case and failing  
in unusual ones.  Exception handling is one example of this; throwing  
an instance of an unresolved class (easy to do if you throw a constant  
string) will fail with the GCC runtime.  The new runtime does not have  
this problem.

> I think several similar new libobjc2 functions are currently broken
> when you pass a metaclass because they call the old libobjc1 API which
> doesn't accept metaclasses as classes.
> Unless libobjc2 has changed the semantic of CLS_ISCLASS, CLS_ISCLASS
> (aMetaclass) counterintuitively returns false. Since the old libobjc1
> API checks the argument with CLS_ISCLASS in functions such as
> class_get_super_class() or class_get_instance_size(), new APIs such as
> class_getSuperclass() and class_getInstanceSize() are not equivalent.

I've fixed class_getInstanceSize to just return the instance_size  
field.  Please report any other failures.

David

-- Sent from my IBM 1620


_______________________________________________
Etoile-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-discuss

Répondre à