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]

Re: [trans-mem] optimize exception object memory


On 07/19/2010 02:22 PM, Aldy Hernandez wrote:
> +      /* If the address escapes the function, it also escapes the thread.  */
> +      retval = mem_non_local;
> +
> +      /* Unlesss... it's one of our special thread private calls.  */
> +      if (stmt && is_gimple_call (stmt)
> +	  && (fndecl = gimple_call_fndecl (stmt)))
> +	{
> +	  const char *name = IDENTIFIER_POINTER (DECL_NAME (fndecl));
> +	  if (!strcmp (name, "_ITM_cxa_allocate_exception")
> +	      || !strcmp (name, "_ITM_cxa_begin_catch"))

Wouldn't it be better to invent a new attribute that users could put
on their own functions as well?  I'm not sure what the best name might
be, but perhaps just "thread_local"?

The commentary would then be

  /* If the address has been declared to be thread-local, believe it.  */
...
  /* Otherwise, we have to assume that any address that escapes the
     function also escapes the thread.  */

Bonus points if we can figure out a way to apply this idea to 
function arguments, as opposed to just function returns as above.


r~


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