]> gcc.gnu.org Git - gcc.git/commitdiff
In libobjc/: 2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
authorNicola Pero <nicola.pero@meta-innovation.com>
Sun, 17 Oct 2010 11:01:31 +0000 (11:01 +0000)
committerNicola Pero <nicola@gcc.gnu.org>
Sun, 17 Oct 2010 11:01:31 +0000 (11:01 +0000)
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

gcc/ChangeLog
gcc/doc/objc.texi
libobjc/ChangeLog
libobjc/init.c
libobjc/linking.m

index e65867d080938caaaf1e3990764f3100bd9b9839..47254d31f12f436a69acd15fc6951b19da26465e 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2010-10-16  Jan Hubicka  <jh@suse.cz>
 
        PR middle-end/44206
index 87c985d1e679a27f55821da4f0a47f77e3354922..f0fab6be827ade4ce00328ca1898f89454a8da2a 100644 (file)
@@ -107,24 +107,27 @@ instead of @code{+initialize}.
 @node What you can and what you cannot do in +load
 @subsection What you can and what you cannot do in @code{+load}
 
-The @code{+load} implementation in the GNU runtime guarantees you the following
-things:
+@code{+load} is to be used only as a last resort.  Because it is
+executed very early, most of the Objective-C runtime machinery will
+not be ready when @code{+load} is executed; hence @code{+load} works
+best for executing C code that is independent on the Objective-C
+runtime.
+
+The @code{+load} implementation in the GNU runtime guarantees you the
+following things:
 
 @itemize @bullet
 
 @item
 you can write whatever C code you like;
 
-@item
-you can send messages to Objective-C constant strings (@code{@@"this is a
-constant string"});
-
 @item
 you can allocate and send messages to objects whose class is implemented
 in the same file;
 
 @item
-the @code{+load} implementation of all super classes of a class are executed before the @code{+load} of that class is executed;
+the @code{+load} implementation of all super classes of a class are
+executed before the @code{+load} of that class is executed;
 
 @item
 the @code{+load} implementation of a class is executed before the
@@ -144,6 +147,10 @@ allocation of or sending messages to arbitrary objects;
 allocation of or sending messages to objects whose classes have a
 category implemented in the same file;
 
+@item
+sending messages to Objective-C constant strings (@code{@@"this is a
+constant string"});
+
 @end itemize
 
 You should make no assumptions about receiving @code{+load} in sibling
index 1d2b2948605c34cdf2f4d11ce111329d2796cc05..6e70ac762eaf0789cada9b336476382b5fd67a15 100644 (file)
@@ -1,3 +1,12 @@
+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.
+       
 2010-10-16  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * objc/runtime.h: Updated comments.
index dd8789c9cac04aa3b2629b5f18f444a59073aece..d87a587a8affbaa5f61ded088fc2c088e754f7d2 100644 (file)
@@ -444,8 +444,7 @@ class_is_subclass_of_class (Class class, Class superclass)
    their superclasses are not yet known to the runtime.  */
 static struct objc_list *unresolved_classes = 0;
 
-/* Extern function used to reference the Object and NXConstantString
-   classes.  */
+/* Extern function used to reference the Object class.  */
 
 extern void __objc_force_linking (void);
 
@@ -755,11 +754,9 @@ objc_send_load (void)
        return;
     }
 
-  /* Special check to allow creating and sending messages to constant
-     strings in +load methods. If these classes are not yet known,
-     even if all the other classes are known, delay sending of +load.  */
-  if (! objc_lookup_class ("NXConstantString") ||
-      ! objc_lookup_class ("Object"))
+  /* Special check.  If 'Object', which is used by meta-classes, has
+     not been loaded yet, delay sending of +load.  */
+  if (! objc_lookup_class ("Object"))
     return;
 
   /* Iterate over all modules in the __objc_module_list and call on
index e94c8ea8c4b8247fffabfcbab2281f29e8859e13..4438a668ce49cda7162d8ecee8e489e5cdaecd7e 100644 (file)
@@ -27,12 +27,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include <objc/Object.h>
 #include <objc/NXConstStr.h>
 
-/* Generate references to Object and NXConstanstString classes since they are
-   needed by the runtime system to run correctly.  */
+/* Generate references to Object class since it is needed by the
+   runtime system to run correctly.  */
 
 void __objc_linking (void)
 {
   [Object name];
-  [NXConstantString name];
 }
 
This page took 0.128106 seconds and 5 git commands to generate.