Patchwork [ObjC/Darwin,1/3] Fix wrong code gen for m64 Objective-C

login
register
mail settings
Submitter Nicola Pero
Date Feb. 17, 2011, 9:35 p.m.
Message ID <1297978512.839122592@192.168.4.58>
Download mbox | patch
Permalink /patch/83487/
State New
Headers show

Comments

Nicola Pero - Feb. 17, 2011, 9:35 p.m.
>> - which is to add two required flags to c-family/c.opt (for which I also need
>> approval)
>
> The c.opt change (note the ChangeLog entry has a "c.opts" typo) is OK if 
> the options are also documented in invoke.texi.

Thanks Joseph

Iain is going away for the weekend, but Mike, Iain and I agreed in private discussions
that if this work is to go in, it needs to go in ASAP so it gets as much testing and
exposure as possible before the pending GCC 4.6 release.

So I committed the following patch.  The documentation is mine.  Please review it and let
me know if there is anything to tidy up.  I documented the -fobjc-nilcheck flag for what
I understood of it by looking at the implementation in Iain's pending patch.  If anyone
knows any better, please review and let me have any corrections or suggestions.

I'll now work on committing the latest version of Iain's big patch.

Thanks

Patch

Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi     (revision 170254)
+++ doc/invoke.texi     (working copy)
@@ -208,10 +208,12 @@  Objective-C and Objective-C++ Dialects}.
 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
 -fgnu-runtime  -fnext-runtime @gol
 -fno-nil-receivers @gol
+-fobjc-abi-version=@var{n} @gol
 -fobjc-call-cxx-cdtors @gol
 -fobjc-direct-dispatch @gol
 -fobjc-exceptions @gol
 -fobjc-gc @gol
+-fobjc-nilcheck @gol
 -fobjc-std=objc1 @gol
 -freplace-objc-classes @gol
 -fzero-link @gol
@@ -2555,9 +2557,20 @@  used.
 Assume that all Objective-C message dispatches (@code{[receiver
 message:arg]}) in this translation unit ensure that the receiver is
 not @code{nil}.  This allows for more efficient entry points in the
-runtime to be used.  Currently, this option is only available in
-conjunction with the NeXT runtime on Mac OS X 10.3 and later.
+runtime to be used.  This option is only available in conjunction with
+the NeXT runtime and ABI version 0 or 1.
 
+@item -fobjc-abi-version=@var{n}
+@opindex fobjc-abi-version
+Use version @var{n} of the Objective-C ABI for the selected runtime.
+This option is currently supported only for the NeXT runtime.  In that
+case, Version 0 is the traditional (32-bit) ABI without support for
+properties and other Objective-C 2.0 additions.  Version 1 is the
+traditional (32-bit) ABI with support for properties and other
+Objective-C 2.0 additions.  Version 2 is the modern (64-bit) ABI.  If
+nothing is specified, the default is Version 0 on 32-bit target
+machines, and Version 2 on 64-bit target machines.
+
 @item -fobjc-call-cxx-cdtors
 @opindex fobjc-call-cxx-cdtors
 For each Objective-C class, check if any of its instance variables is a
@@ -2605,6 +2618,16 @@  programs.  This option is only available with the
 GNU runtime has a different garbage collection implementation that
 does not require special compiler flags.
 
+@item -fobjc-nilcheck
+@opindex fobjc-nilcheck
+For the NeXT runtime with version 2 of the ABI, check for a nil
+receiver in method invocations before doing the actual method call.
+This is the default and can be disabled using
+@option{-fno-objc-nilcheck}.  Class methods and super calls are never
+checked for nil in this way no matter what this flag is set to.
+Currently this flag does nothing when the GNU runtime, or an older
+version of the NeXT runtime ABI, is used.
+
 @item -fobjc-std=objc1
 @opindex fobjc-std
 Conform to the language syntax of Objective-C 1.0, the language
Index: c-family/c.opt
===================================================================
--- c-family/c.opt      (revision 170254)
+++ c-family/c.opt      (working copy)
@@ -853,6 +853,10 @@  fnothrow-opt
 C++ ObjC++ Optimization Var(flag_nothrow_opt)
 Treat a throw() exception specification as noexcept to improve code size
 
+fobjc-abi-version=
+ObjC ObjC++ Joined Report RejectNegative UInteger Var(flag_objc_abi)
+Specify which ABI to use for Objective-C family code and meta-data generation.
+
 ; Generate special '- .cxx_construct' and '- .cxx_destruct' methods
 ; to initialize any non-POD ivars in Objective-C++ classes.
 fobjc-call-cxx-cdtors
@@ -873,6 +877,10 @@  fobjc-gc
 ObjC ObjC++ Var(flag_objc_gc)
 Enable garbage collection (GC) in Objective-C/Objective-C++ programs
 
+fobjc-nilcheck
+ObjC ObjC++ Var(flag_objc_nilcheck,1)
+Enable inline checks for nil receivers with the NeXT runtime and ABI version 2.
+
 ; Nonzero means that we generate NeXT setjmp based exceptions.
 fobjc-sjlj-exceptions
 ObjC ObjC++ Var(flag_objc_sjlj_exceptions) Init(-1)
Index: c-family/ChangeLog
===================================================================
--- c-family/ChangeLog  (revision 170254)
+++ c-family/ChangeLog  (working copy)
@@ -1,3 +1,8 @@ 
+2011-02-17  Iain Sandoe  <iains@gcc.gnu.org>
+
+       * c.opt (fobjc-abi-version=) New.
+       (fobjc-nilcheck): New.
+
 2011-02-03  Nathan Froyd  <froydnj@codesourcery.com>
 
        PR c++/46890
Index: ChangeLog
===================================================================
--- ChangeLog   (revision 170254)
+++ ChangeLog   (working copy)
@@ -1,3 +1,10 @@ 
+2011-02-17  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       * doc/invoke.texi (fobjc-abi-version): Documented.
+       (fobjc-nilcheck): Documented.
+       (fno-nil-receiver): Updated documentation to refer to the NeXT ABI
+       version.
+
 2011-02-17  Joseph Myers  <joseph@codesourcery.com>
 
        PR driver/47390