This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: PATCH for front end parts of C++ transactional memory TS


This patch implements the front end bits of the transactional memory technical specification: apart from parsing, that means treating transaction_safe as part of the type and dealing with conversions, mangling and such.

Since the transaction_safe attribute now affects type identity, I needed to change the C front end to allow declarations of built-ins to change whether the function is declared transaction_safe. Joseph, is that hunk (copied at the bottom) OK?

After this patch the compiler sorrys out on atomic_cancel because cancel-and-throw hasn't been implemented yet. RTH, will you be able to poke at that any time soon?

The patch also doesn't attempt to do anything about the library. The second patch sets transaction_safe on various built-ins, but without the library support this just means references to undefined symbols. The third patch is a beginning of libstdc++ support, which may or may not be useful to Jonathan or Torvald in completing that support.

I'm thinking to check in the first patch as is soon, and leave the rest for other people to take care of later.

Any thoughts?

diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c
index a110226..ce8406a 100644
--- a/gcc/c/c-decl.c
+++ b/gcc/c/c-decl.c
@@ -1659,7 +1659,19 @@ match_builtin_function_types (tree newtype, tree oldtype)
     }

   trytype = build_function_type (newrettype, tryargs);
-  return build_type_attribute_variant (trytype, TYPE_ATTRIBUTES (oldtype));
+
+  /* Allow declaration to change transaction_safe attribute.  */
+  tree oldattrs = TYPE_ATTRIBUTES (oldtype);
+  tree oldtsafe = lookup_attribute ("transaction_safe", oldattrs);
+  tree newattrs = TYPE_ATTRIBUTES (newtype);
+  tree newtsafe = lookup_attribute ("transaction_safe", newattrs);
+  if (oldtsafe && !newtsafe)
+    oldattrs = remove_attribute ("transaction_safe", oldattrs);
+  else if (newtsafe && !oldtsafe)
+    oldattrs = tree_cons (get_identifier ("transaction_safe"),
+                         NULL_TREE, oldattrs);
+
+  return build_type_attribute_variant (trytype, oldattrs);
 }

 /* Subroutine of diagnose_mismatched_decls.  Check for function type

Attachment: tm.patch.gz
Description: application/gzip

Attachment: tm-builtins.patch.gz
Description: application/gzip

Attachment: tm-libstc++.patch.gz
Description: application/gzip


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]