[llvm-commits] [llvm-gcc-4.2] r98890 - in /llvm-gcc-4.2/trunk: gcc/objc/ChangeLog.apple gcc/objc/objc-act.c gcc/testsuite/ChangeLog.apple gcc/testsuite/objc.dg/arm-scalar-atomic-copyStruct.m libstdc++-v3/libsupc++/eh_personality.cc

Jim Grosbach grosbach at apple.com
Thu Mar 18 15:40:06 PDT 2010


Author: grosbach
Date: Thu Mar 18 17:40:06 2010
New Revision: 98890

URL: http://llvm.org/viewvc/llvm-project?rev=98890&view=rev
Log:
Merge fix for 6671703. On ARM, large scalar atomic objective C properties should
use objc_copyStruct() for @synthesized getter/setter methods.


Added:
    llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/arm-scalar-atomic-copyStruct.m
Modified:
    llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple
    llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
    llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple
    llvm-gcc-4.2/trunk/libstdc++-v3/libsupc++/eh_personality.cc

Modified: llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple?rev=98890&r1=98889&r2=98890&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/ChangeLog.apple Thu Mar 18 17:40:06 2010
@@ -1,3 +1,10 @@
+2019-03-17  Jim Grosbach <grosbach at apple.com>
+
+        Radar 6671703
+	* objc-act.c (objc_synthesize_new_getter, objc_synthesize_new_setter):
+	On ARM, for atomic access to any type of larger than 4 bytes, use
+	objc_copyStruct().
+
 2009-05-06  Fariborz Jahanian <fjahanian at apple.com>
 
         Radar 6083666

Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=98890&r1=98889&r2=98890&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Thu Mar 18 17:40:06 2010
@@ -16570,13 +16570,21 @@
         /* APPLE LOCAL end radar 5376125 */
 
 	/* Handle struct-valued functions */
-	if ((TREE_CODE (ret_type) == RECORD_TYPE || TREE_CODE (ret_type) == UNION_TYPE)
+        /* APPLE LOCAL begin 6671703 ARM 64-bit atomic properties */
+        if (
+#ifdef TARGET_ARM
+          (IS_ATOMIC (property)
+           && TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ret_type)) > 4) ||
+#endif
+          ((TREE_CODE (ret_type) == RECORD_TYPE
+            || TREE_CODE (ret_type) == UNION_TYPE)
             /* APPLE LOCAL radar 5080710 */
             && (TREE_ADDRESSABLE (ret_type) || targetm.calls.return_in_memory  (ret_type, 0))
-	    && (IS_ATOMIC (property) || 
-		(isStrong = ((flag_objc_gc || flag_objc_gc_only) 
-			     && aggregate_contains_objc_pointer (ret_type)))))
-	  {
+	    && (IS_ATOMIC (property) ||
+		(isStrong = ((flag_objc_gc || flag_objc_gc_only)
+			     && aggregate_contains_objc_pointer (ret_type))))))
+        /* APPLE LOCAL end 6671703 ARM 64-bit atomic properties */
+        {
 	    /* struct something tmp; 
 	       objc_copyStruct (&tmp, &structIvar, sizeof (struct something), isAtomic, false);
 	       return tmp;
@@ -16732,11 +16740,18 @@
         TREE_USED (rhs) = 1;
       /* APPLE LOCAL end radar 5232840 */
       ivar_type = TREE_TYPE (lhs);
-      if ((TREE_CODE (ivar_type) == RECORD_TYPE || TREE_CODE (ivar_type) == UNION_TYPE)
+      /* APPLE LOCAL begin 6671703 ARM 64-bit atomic properties */
+      if (
+#ifdef TARGET_ARM
+        (IS_ATOMIC (property)
+         && TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ivar_type)) > 4) ||
+#endif
+       ((TREE_CODE (ivar_type) == RECORD_TYPE || TREE_CODE (ivar_type) == UNION_TYPE)
           /* APPLE LOCAL begin radar 5080710 */
           && IS_ATOMIC (property)
-          && (TREE_ADDRESSABLE (ivar_type) || targetm.calls.return_in_memory  (ivar_type, 0)))
+          && (TREE_ADDRESSABLE (ivar_type) || targetm.calls.return_in_memory  (ivar_type, 0))))
           /* APPLE LOCAL end radar 5080710 */
+      /* APPLE LOCAL end 6671703 ARM 64-bit atomic properties */
         {
 	  /* objc_copyStruct (&structIvar, &value, sizeof (struct something), true, false); */
 	  tree func_params;

Modified: llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple?rev=98890&r1=98889&r2=98890&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple (original)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/ChangeLog.apple Thu Mar 18 17:40:06 2010
@@ -1,3 +1,8 @@
+2010-03-18  Jim Grosbach <grosbach at apple.com>
+
+        Radar 6671703
+	* objc.dg/arm-scalar-atomic-copyStruct.m: New.
+
 2009-11-03  Stuart Hastings  <stuart at apple.com>
 
 	Radar 6951876

Added: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/arm-scalar-atomic-copyStruct.m
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/arm-scalar-atomic-copyStruct.m?rev=98890&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/arm-scalar-atomic-copyStruct.m (added)
+++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/arm-scalar-atomic-copyStruct.m Thu Mar 18 17:40:06 2010
@@ -0,0 +1,38 @@
+/* APPLE LOCAL file 6671703 use objc_copyStruct() for big scalars */
+/* { dg-do compile { target arm*-*-darwin* } } */
+/* { dg-options "-O0" } */
+
+#import <Foundation/NSObject.h>
+
+
+ at interface myClass : NSObject {
+  unsigned long long _i64;
+}
+
+ at property (readwrite) unsigned long long i64;
+
+ at end
+
+ at implementation myClass
+ at synthesize i64 = _i64;
+
+
+
+ at end
+
+extern int printf(const char *fmt, ...);
+
+void foo(myClass *obj)
+{
+  printf ("%llx\n", obj.i64);
+}
+
+int main()
+{
+  myClass *obj = [[myClass alloc] init];
+  obj.i64 = 0xfeedface55555555LL;
+  foo (obj);
+  return 0;
+}
+
+/* { dg-final { scan-assembler-times "blx\tL_objc_copyStruct.stub" 2 } } */

Modified: llvm-gcc-4.2/trunk/libstdc++-v3/libsupc++/eh_personality.cc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libstdc%2B%2B-v3/libsupc%2B%2B/eh_personality.cc?rev=98890&r1=98889&r2=98890&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/libstdc++-v3/libsupc++/eh_personality.cc (original)
+++ llvm-gcc-4.2/trunk/libstdc++-v3/libsupc++/eh_personality.cc Thu Mar 18 17:40:06 2010
@@ -52,6 +52,34 @@
   unsigned char call_site_encoding;
 };
 
+struct SjLj_Function_Context
+{
+  /* This is the chain through all registered contexts.  It is
+     filled in by _Unwind_SjLj_Register.  */
+  struct SjLj_Function_Context *prev;
+
+  /* This is assigned in by the target function before every call
+     to the index of the call site in the lsda.  It is assigned by
+     the personality routine to the landing pad index.  */
+  int call_site;
+
+  /* This is how data is returned from the personality routine to
+     the target function's handler.  */
+  _Unwind_Word data[4];
+
+  /* These are filled in once by the target function before any
+     exceptions are expected to be handled.  */
+  _Unwind_Personality_Fn personality;
+  void *lsda;
+
+  void *jbuf[];
+};
+
+struct _Unwind_Context
+{
+  struct SjLj_Function_Context *fc;
+};
+
 static const unsigned char *
 parse_lsda_header (_Unwind_Context *context, const unsigned char *p,
 		   lsda_header_info *info)





More information about the llvm-commits mailing list