In libobjc/:
2011-10-09 Nicola Pero <nicola.pero@meta-innovation.com>
PR libobjc/49883
* init.c (__objc_exec_class): Work around a bug in clang's code
generation. Clang sets the class->info field to values different
from 0x1 or 0x2 (the only allowed values in the traditional GNU
Objective-C runtime ABI) to store some additional information, but
this breaks backwards compatibility. Wipe out all the bits in the
fields other than the first two upon loading a class.
2011-10-09 Nicola Pero <nicola.pero@meta-innovation.com>
* class.c (objc_lookup_class): Added back for compatibility with
clang which seems to emit calls to it.
From-SVN: r179721
In libobjc/:
2010-12-26 Nicola Pero <nicola.pero@meta-innovation.com>
* init.c (create_tree_of_subclasses_inherited_from): Use
class_superclass_of_class instead of assuming a class is
unresolved when it could be resolved. Tidied up code.
(__objc_tree_insert_class): Enhanced DEBUG_PRINTF.
(objc_tree_insert_class): Tidied up loop; return immediately upon
inserting a class.
(__objc_exec_class): Do not set __objc_class_tree_list.
In gcc/testsuite/:
2010-12-26 Nicola Pero <nicola.pero@meta-innovation.com>
* objc.dg/special/special.exp: Added load-category-2 and
load-category-3 tests.
* objc.dg/special/load-category-2.h: New.
* objc.dg/special/load-category-2.m: New.
* objc.dg/special/load-category-2a.m: New.
* objc.dg/special/load-category-3.h: New.
* objc.dg/special/load-category-3.m: New.
* objc.dg/special/load-category-3a.m: New.
From-SVN: r168251
In libobjc/:
2010-12-23 Nicola Pero <nicola.pero@meta-innovation.com>
* init.c (create_tree_of_subclasses_inherited_from): Updated
DEBUG_PRINTF messages.
(__objc_tree_insert_class): Same.
(__objc_send_load_using_method_list): Same.
(__objc_send_load): Same.
(__objc_exec_class): Same. In particular, do not print the module
name since it is no longer used.
* sendmsg.c (__objc_send_initialize): Added DEBUG_PRINTFs for
tracking +initialize calls.
(__objc_update_dispatch_table_for_class): Added DEBUG_PRINTFs for
tracking updates of dispatch tables.
(__objc_install_dispatch_table_for_class): Same.
From-SVN: r168215
In libobjc/:
2010-12-22 Nicola Pero <nicola.pero@meta-innovation.com>
* init.c (duplicate_classes): New.
(__objc_exec_class): Initialize duplicate_classes.
(__objc_create_classes_tree): Ignore classes in the
duplicate_classes table.
(__objc_call_load_callback): Same.
(__objc_init_class): If a duplicate class is found, add it to
duplicate_classes instead of aborting. Return YES if the class is
not a duplicate, and NO if it is.
* objc-private/runtime.h (__objc_init_class): Updated prototype.
From-SVN: r168183
In libobjc/:
2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
PR libobjc/18764
* class.c (__objc_add_class_to_hash): Return YES if the class was
added, and NO if it already existed.
* init.c (__objc_init_class): If __objc_add_class_to_hash returns
NO, then abort the program with an error message.
* objc-private/runtime.h (__objc_add_class_to_hash): Updated
declaration.
From-SVN: r168139
In libobjc/:
2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
* init.c (_objc_load_callback): Initialize with 0.
(__objc_call_callback): Renamed to __objc_call_load_callback.
Check _objc_load_callback only once, and if it is not set, return
immediately.
(objc_send_load): Updated call to __objc_call_callback.
From-SVN: r168133
In libobjc/:
2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
PR libobjc/16110
* init.c (__objc_send_message_in_list): Renamed to
__objc_send_load_using_method_list. Do not take an 'op' argument.
Register the 'load' selector if needed.
(__objc_send_load): Do not register the 'load' selector. Updated
call to __objc_send_message_in_list.
(__objc_create_classes_tree): Add the class of any claimed
category that was loaded in the module to the list of classes for
which we try to execute +load.
In gcc/testsuite/:
2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
PR libobjc/16110
* objc.dg/special/special.exp: Added new test.
* objc.dg/special/load-category-1.m: New.
* objc.dg/special/load-category-1a.m: New.
* objc.dg/special/load-category-1.h: New.
From-SVN: r168122
In libobjc/:
2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-private/common.h: When DEBUG is defined, include <stdio.h>.
Updated comments.
* init.c (__objc_tree_insert_class): Use %p, not %x, when printing
a pointer using DEBUG_PRINTF.
From-SVN: r168119
In libobjc/:
2010-12-21 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-private/module-abi-8.h (struct objc_symtab): Declare 'refs'
to be 'struct objc_selector *' and not 'SEL'.
* init.c (__objc_exec_class): Call
__objc_register_selectors_from_module instead of iterating over
each selector and calling __sel_register_typed_name for each.
* objc-private/selector.h: Declare
__objc_register_selectors_from_module instead of
__sel_register_typed_name.
* selector.c (__objc_register_selectors_from_module): New.
(__sel_register_typed_name): Made static.
From-SVN: r168113
In libobjc/:
2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
* init.c (__objc_exec_class): Call __objc_resolve_class_links (),
if appropriate, after loading the module.
From-SVN: r168065
In libobjc/:
2010-12-19 Nicola Pero <nicola.pero@meta-innovation.com>
* init.c: Include objc-private/selector.h. Do not declare
__sel_register_typed_name.
* objc-private/selector.h (__sel_register_typed_name): Declare.
* selector.c: Include objc-private/selector.h.
From-SVN: r168039
2010-12-17 Nicola Pero <nicola.pero@meta-innovation.com>
* init.c: Include objc/runtime.h and objc-private/module-abi-8.h
instead of objc/objc-api.h.
(init_check_module_version): Take a 'struct objc_module *'
argument instead of 'Module_t'. Use 'struct objc_module *'
instead of 'Module_t'.
(__objc_created_classes_tree): Take a 'struct objc_module *'
argument instead of 'Module_t'; use 'struct objc_symtab *' instead
of 'Symtab_t'.
(__objc_call_callback): Take a 'struct objc_module *' argument
instead of 'Module_t'; use 'struct objc_symtab *' instead of
'Symtab_t' and 'struct objc_category *' instead of 'Category_t'.
(_objc_load_callback): Take a 'struct objc_category *' argument
instead of 'Category *'.
(class_superclass_of_class): Use objc_getClass() instead of
objc_lookup_class().
(create_tree_of_subclasses_inherited_from): Same change (also, use
an explicit 'if' instead of '?').
(objc_init_statics): Same change.
(objc_send_load): Same change.
(__objc_init_protocol): same change.
(__objc_send_message_in_list): Take a 'struct objc_method_list *'
argument instead of 'MethodList_t'. Use 'struct objc_method *'
instead of 'Method_t'.
(__objc_send_load): Use 'struct objc_method_list *' instead of
'MethodList_t'. Use sel_registerName() instead of
sel_register_name().
(__objc_exec_class): Take a 'struct objc_module *' argument
instead of 'Module_t'. Use 'struct objc_symtab *' instead of
'Symtab_t'. Use objc_getClass() instead of objc_lookup_class().
Use 'struct objc_category *' instead of 'Category_t'.
From-SVN: r168000
In libobjc/:
2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
* init.c (objc_send_load): Do not wait for NXConstantString to be
registered before executing +load. There is no point if
-fconstant-string-class=xxx is used when compiling all modules,
as is the case for almost all users.
* linking.m (__objc_linking): Do not try to forcefully link in
NXConstantString.
In gcc/:
2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
* doc/objc.texi (What you can and what you cannot do in +load):
Document that sending messages to constant string objects in +load
is not guaranteed to work.
From-SVN: r165583
In libobjc/:
2010-10-16 Nicola Pero <nicola.pero@meta-innovation.com>
* objc/runtime.h: Updated comments.
(class_addMethod): New.
(class_addIvar): New.
(class_replaceMethod): New.
(objc_allocateClassPair): New.
(objc_registerClassPair): New.
(objc_disposeClassPair): New.
* class.c (objc_allocateClassPair): New.
(objc_registerClassPair): New.
(objc_disposeClassPair): New.
(class_getSuperclass): Return Nil if a class is in construction.
* init.c (__objc_exec_class): Call __objc_init_class.
(__objc_init_class): New.
* ivars.c (class_copyIvarList): Return NULL if class is in
construction. Do not lock the runtime mutex.
(class_getInstanceVariable): Return NULL if class is in
construction. Do not lock the runtime mutex.
(class_addIvar): New.
* sendmsg.c (class_addMethod): New.
(class_replaceMethod): New.
* objc-private/module-abi-8.h (__CLS_SETNOTINFO): New.
(_CLS_IN_CONSTRUCTION): New.
(CLS_IS_IN_CONSTRUCTION): New.
(CLS_SET_IN_CONSTRUCTION): New.
(CLS_SET_NOT_IN_CONSTRUCTION): New.
* objc-private/runtime.h (__objc_init_class): New.
From-SVN: r165563
In libobjc/:
2010-10-14 Nicola Pero <nicola.pero@meta-innovation.com>
* init.c (__objc_init_protocol): New function which fixes up a
protocol's class pointer, registers it with the runtime, register
all protocol selectors and registers associated protocols too.
(objc_init_statics): Detect if we are initializing protocols, and
if so, use __objc_init_protocol instead of only fixing up the
class pointer.
(__objc_init_protocls): Use __objc_init_protocol.
* objc-private/module-abi-8.h: Updated comments.
* objc-private/runtime.h
(__objc_register_selectors_from_description_list): New.
* selector.c (__objc_register_selectors_from_description_list):
New. (struct objc_method_description_list): Declare.
* Protocol.m ([-descriptionForInstanceMethod:]): Use sel_get_name
when accessing the name of a method, which is now correctly a SEL.
([-descriptionForClassMethod:]): Same change.
* protocols.c (protocol_getMethodDescription): Same change.
* objc/runtime.h: Updated comments.
(sel_registerTypedName): Fixed typo in function name.
From-SVN: r165499
In libobjc/:
2010-10-13 Nicola Pero <nicola.pero@meta-innovation.com>
PR libobjc/23214
* init.c (objc_init_statics): Do not skip the initialization of a
statics list if the first object has already been initialized; in
the case of Protocols, while the first one may have been
initialized, some others may not have been initialized yet.
In gcc/testsuite/:
2010-10-13 Nicola Pero <nicola.pero@meta-innovation.com>
PR libobjc/23214
* objc.dg/pr23214.m: New.
From-SVN: r165414
2010-10-12 Nicola Pero <nicola.pero@meta-innovation.com>
* archive.c: Do not include objc/objc.h.
* class.c: Do not include objc/objc.h.
* encoding.c: Include objc/runtime.h, ctype.h and
objc-private/module-abi-8.h instead of objc/objc-api.h and
objc/encoding.h.
* error.c: Do not include objc/objc.h.
* gc.c: Include tconfig.h and objc/encoding.h only if
OBJC_WITH_GC.
* hash.c: Include objc/runtime.h and objc/thr.h instead of
objc/objc-api.h. Do not include objc/objc.h.
* init.c: Do not include objc/objc.h.
* ivars.c: Include objc/runtime.h, objc-private/module-abi-8.h and
objc/thr.h instead of objc/objc-api.h. Do not include
objc/objc.h.
* linking.m: Tidied comment.
* memory.c: Include objc/runtime.h instead of objc/objc-api.h.
Do not include objc/objc.h.
* objects.c: Do not include objc/objc.h.
* objc-sync.c: Include objc/runtime.h instead of objc/objc-api.h.
* protocols.c: Do not include objc/objc.h.
* sarray.c: Include objc/runtime.h instead of objc/objc-api.h. Do
not include objc/objc.h.
* selector.c: Do not include objc/objc.h.
* sendmsg.c: Do not include objc/objc.h.
* thr.c: Include objc/runtime.h instead of objc/objc-api.h.
Do not include objc/objc.h.
* objc/objc-decls.h: Reindented code.
* objc/runtime.h Include objc-decls.h. Updated comments.
(objc_malloc): New.
(objc_atomic_malloc): New.
(objc_calloc): New.
(objc_realloc): New.
(objc_free): New.
* objc-private/runtime.h: Updated comments.
From-SVN: r165386
* objc/hash.h: Moved into objc/deprecated/hash.h; objc/hash.h
replaced with a placeholder including the file from the
deprecated/ directory.
* objc/objc-api.h: Updated includes.
* objc/typedstream.h: Updated includes.
* objc-private/hash.h: New file (private copy of hash.h).
* objc/objc-list.h: Moved into objc/deprecated/objc-list.h;
objc/objc-list.h replaced with a placeholder including the file
from the deprecated/ directory.
* objc-private/objc-list.h: New file (private copy of objc-list.h).
* init.c: Include objc-private/hash.h and objc-private/objc-list.h
instead of objc/hash.h and objc/objc-list.h.
* selector.c: Same change.
* class.c: Added include <string.h>, which used to be implicitly included
when hash.h was included.
* exception.c: Same change.
* objects.c: Same change.
* sarray.c: Same change.
* sendmsg.c: Same change.
* Makefile.in (OBJC_DEPRECATED_H): Added hash.h and objc-list.h.
(OBJC_H): Removed hash.h and objc-list.h
From-SVN: r164373
In libobjc/:
Implemented objc_sync_enter() and objc_sync_exit(), which are
required by @synchronized() to work.
* objc-sync.c: New file.
* objc/objc-sync.h: New file.
* objc-private/objc-sync.h: New file.
* init.c (__objc_exec_class): Call __objc_sync_init() during the
Objective-C runtime startup.
* Makefile.in: Added objc-sync.c and objc-sync.h.
* configure.ac: Added GCC_CHECK_TLS.
* acinclude.m4: Include ../config/enable.m4 and ../config/tls.m4.
* configure: Regenerated.
* config.h.in: Regenerated.
From-SVN: r164276
* objc/deprecated/objc_error.h: New file.
* objc/objc-api.h: Include deprecated/objc_error.h instead of
defining objc_error and related.
* error.c: New file. Added _objc_abort function which replaces
objc_error. No change in functionality as they both print an
error and abort.
* misc.c: File removed. Code moved into memory.c and error.c.
* memory.c: New file.
* objc-private/error.h: New file.
* archive.c: Include objc-private/error.h and use _objc_abort
instead of objc_error everywhere.
* class.c: Same change.
* encoding.c: Same change.
* init.c: Same change, and simplified init_check_module_version.
* memory.c: Same change.
* sendmsg.c: Same change.
* thr.c: Same change.
* Makefile.in (OBJ_DEPRECATED_H): Added objc_error.h.
(OBJ_H): Reordered list.
(OBJS): Removed misc.lo, added memory.lo and error.lo.
(OBJS_GC): Removed misc_gc.lo, added memory_gc.lo and error_gc.lo.
(misc_gc.lo): Rule removed.
(error_gc.lo): Rule added.
(memory_gc.lo): Rule added.
From-SVN: r164223
* objc/objc.h (__GNU_LIBOBJC__): New #define providing an easy way
to check the API version. Added some comments.
* objc-private/common.h: New file.
* NXConstStr.m: Include objc-private/common.h.
* Object.m: Same change.
* Protocol.m: Same change.
* archive.c: Same change.
* class.c: Same change.
* encoding.c: Same change.
* exception.c: Same change.
* gc.c: Same change.
* hash.c: Same change.
* init.c: Same change.
* libobjc_entry.c: Same change.
* linking.m: Same change.
* misc.c: Same change (and added a comment).
* nil_method.c: Same change.
* objects.c: Same change.
* sarray.c: Same change.
* selector.c: Same change.
* sendmsg.c: Same change.
* thr.c: Same change.
From-SVN: r164218
* objc/runtime.h: Moved to objc-private/runtime.h. Do not include
all the objc/*.h files.
* objc-private/runtime.h: New file.
* archive.c: Include objc-private/runtime.h (and required objc/*.h
files) instead of objc/runtime.h.
* class.c: Same change.
* hash.c: Same change.
* init.c: Same change.
* misc.c: Same change.
* nil_method.c: Same change.
* objects.c: Same change.
* sarray.c: Same change.
* selector.c: Same change.
* sendmsg.c: Same change.
* thr.c: Same change.
From-SVN: r164213
2001-06-06 Richard Frith-Macdonald <rrfm@gnu.org>
* init.c (__objc_send_message_in_list): When setting a new entry
in __objc_load_methods use the method IMP as key, but check to see
if the method is in the hashtable by looking at the IMP also.
Also ... call the method after adding it to the hashtable rather
than before ... thus preventing an obscure possibility of infinite
recursion if a +load method itself loads a subclass.
From-SVN: r43052
(__objc_send_message_in_list): When setting a new entry in
__objc_load_methods use the method name as key, not the method IMP
(reported by Richard Frith-Macdonald <richard@brainstorm.co.uk>).
From-SVN: r42561