public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: FDO patch -- make ic related vars TLS if target allows
@ 2012-12-28 16:26 David Edelsohn
  2012-12-28 19:09 ` Xinliang David Li
  0 siblings, 1 reply; 6+ messages in thread
From: David Edelsohn @ 2012-12-28 16:26 UTC (permalink / raw)
  To: Xinliang David Li, Jan Hubicka; +Cc: GCC Patches

David,

Support for native TLS on AIX exposed a problem with this patch.  A
similar problem exists on Solaris 9.

Some helper functions for TLS on AIX and Solaris 9 only are provided
by libpthread. Promoting ic related variables to TLS breaks profiling
of non-pthread appications.  I completely agree with reducing race
conditions and improving support for profiling of pthread
applications, but why should this change be enabled for applications
not built and run as multi-threaded? This feature should test more
than the existence of target TLS support.

Thanks, David

^ permalink raw reply	[flat|nested] 6+ messages in thread
* FDO patch -- make ic related vars TLS if target allows
@ 2011-04-27 18:17 Xinliang David Li
  2011-04-28 13:06 ` Jan Hubicka
  2011-05-17 16:08 ` H.J. Lu
  0 siblings, 2 replies; 6+ messages in thread
From: Xinliang David Li @ 2011-04-27 18:17 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jan Hubicka

[-- Attachment #1: Type: text/plain, Size: 444 bytes --]

Hi please review the trivial patch below. It reduces race conditions
in value profiling. Another trivial change (to initialize
function_list struct) is also included.

Bootstrapped and regression tested on x86-64/linux.

Thanks,

David


2011-04-27  Xinliang David Li  <davidxl@google.com>

	* tree-profile.c (init_ic_make_global_vars): Set
	tls attribute on ic vars.
	* coverage.c (coverage_end_function): Initialize
	function_list with zero.

[-- Attachment #2: tls.p --]
[-- Type: text/x-pascal, Size: 1638 bytes --]

Index: coverage.c
===================================================================
--- coverage.c	(revision 172977)
+++ coverage.c	(working copy)
@@ -608,7 +608,7 @@ coverage_end_function (void)
     {
       struct function_list *item;
 
-      item = XNEW (struct function_list);
+      item = XCNEW (struct function_list);
 
       *functions_tail = item;
       functions_tail = &item->next;
Index: tree-profile.c
===================================================================
--- tree-profile.c	(revision 172977)
+++ tree-profile.c	(working copy)
@@ -44,6 +44,8 @@ along with GCC; see the file COPYING3.  
 #include "value-prof.h"
 #include "cgraph.h"
 #include "profile.h"
+#include "target.h"
+#include "output.h"
 
 static GTY(()) tree gcov_type_node;
 static GTY(()) tree gcov_type_tmp_var;
@@ -80,6 +82,10 @@ init_ic_make_global_vars (void)
   TREE_PUBLIC (ic_void_ptr_var) = 0;
   DECL_ARTIFICIAL (ic_void_ptr_var) = 1;
   DECL_INITIAL (ic_void_ptr_var) = NULL;
+  if (targetm.have_tls)
+    DECL_TLS_MODEL (ic_void_ptr_var) =
+      decl_default_tls_model (ic_void_ptr_var);
+
   varpool_finalize_decl (ic_void_ptr_var);
   varpool_mark_needed_node (varpool_node (ic_void_ptr_var));
 
@@ -92,6 +98,10 @@ init_ic_make_global_vars (void)
   TREE_PUBLIC (ic_gcov_type_ptr_var) = 0;
   DECL_ARTIFICIAL (ic_gcov_type_ptr_var) = 1;
   DECL_INITIAL (ic_gcov_type_ptr_var) = NULL;
+  if (targetm.have_tls)
+    DECL_TLS_MODEL (ic_gcov_type_ptr_var) =
+      decl_default_tls_model (ic_gcov_type_ptr_var);
+
   varpool_finalize_decl (ic_gcov_type_ptr_var);
   varpool_mark_needed_node (varpool_node (ic_gcov_type_ptr_var));
 }

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-28 19:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-28 16:26 FDO patch -- make ic related vars TLS if target allows David Edelsohn
2012-12-28 19:09 ` Xinliang David Li
2012-12-28 19:47   ` David Edelsohn
  -- strict thread matches above, loose matches on Subject: below --
2011-04-27 18:17 Xinliang David Li
2011-04-28 13:06 ` Jan Hubicka
2011-05-17 16:08 ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).