Patchwork PATCH committed: 64-bit Apple Objective-C runtime support

login
register
mail settings
Submitter Nicola Pero
Date Feb. 19, 2011, 1:06 a.m.
Message ID <1298077577.9744989@192.168.4.58>
Download mbox | patch
Permalink /patch/83670/
State New
Headers show

Comments

Nicola Pero - Feb. 19, 2011, 1:06 a.m.
> I'm not entirely sure why it does that

Upon reflection, it is fairly obvious.  It does that to prevent duplicate output
from -print-runtime-info. ;-)

Here is a patch that adds explanationatory comments for this so we don't have
to rediscover these details next time we look at the code.

Ok to commit ?

Thanks
Mike Stump - Feb. 19, 2011, 1:12 a.m.
On Feb 18, 2011, at 5:06 PM, Nicola Pero wrote:
> Upon reflection, it is fairly obvious.  It does that to prevent duplicate output
> from -print-runtime-info. ;-)
> 
> Here is a patch that adds explanationatory comments for this so we don't have
> to rediscover these details next time we look at the code.
> 
> Ok to commit ?

Ok.

Patch

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 170297)
+++ ChangeLog   (working copy)
@@ -1,5 +1,10 @@ 
 2011-01-19  Nicola Pero  <nicola.pero@meta-innovation.com>
 
+       * objc-act.c (objc_init, generate_struct_by_value_array): Updated
+       comments.
+
+2011-01-19  Nicola Pero  <nicola.pero@meta-innovation.com>
+
        * objc-gnu-runtime-abi-01.c (objc_generate_v1_gnu_metadata): Do
        not generate metadata if there is nothing to put into it.
 
Index: objc-act.c
===================================================================
--- objc-act.c  (revision 170297)
+++ objc-act.c  (working copy)
@@ -330,8 +330,9 @@ 
   int aggregate_in_mem[32];
   int found = 0;
 
-  /* ??? as an example, m64/ppc/Darwin can pass up to 8*long+13*double in regs.
-     Presumably no platform passes 32 byte structures in a register.  */
+  /* Presumably no platform passes 32 byte structures in a register.  */
+  /* ??? As an example, m64/ppc/Darwin can pass up to 8*long+13*double
+     in registers.  */
   for (i = 1; i < 32; i++)
     {
       char buffer[5];
@@ -379,8 +380,24 @@ 
 #endif
     return false;
 
+  /* print_struct_values is triggered by -print-runtime-info (used
+     when building libobjc, with an empty file as input).  It does not
+     require any ObjC setup, and it never returns.
+
+     -fcompare-debug is used to check the compiler output; we are
+     executed twice, once with flag_compare_debug set, and once with
+     it not set.  If the flag is used together with
+     -print-runtime-info, we want to print the runtime info only once,
+     else it would be output in duplicate.  So we check
+     flag_compare_debug to output it in only one of the invocations.
+
+     As a side effect, this also that means -fcompare-debug
+     -print-runtime-info will run the compiler twice, and compare the
+     generate assembler file; the first time the compiler exits
+     immediately (producing no file), and the second time it compiles
+     an empty file.  This checks, as a side effect, that compiling an
+     empty file produces no assembler output.  */
   if (print_struct_values && !flag_compare_debug)
-    /* This routine does not require any ObjC set-up and never returns.  */
     generate_struct_by_value_array ();
 
   /* Set up stuff used by FE parser and all runtimes.  */