public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, i386, Pointer Bounds Checker 10/x] Partitions
@ 2014-05-28 16:06 Ilya Enkovich
  2014-05-30 17:10 ` Jeff Law
  0 siblings, 1 reply; 7+ messages in thread
From: Ilya Enkovich @ 2014-05-28 16:06 UTC (permalink / raw)
  To: gcc-patches

Hi,

This patch keeps instrumented and original versions together and preserve tranparent alias chain during symbol name privatization.

Bootstrapped and tested on linux-x86_64.

Thanks,
Ilya
--
gcc/

2013-05-28  Ilya Enkovich  <ilya.enkovich@intel.com>

	* lto/lto-partition.c (add_symbol_to_partition_1): Keep original
	and instrumented versions together.
	(privatize_symbol_name): Restore transparent alias chain if required.

diff --git a/gcc/lto/lto-partition.c b/gcc/lto/lto-partition.c
index 1ee5fbb..2967d73 100644
--- a/gcc/lto/lto-partition.c
+++ b/gcc/lto/lto-partition.c
@@ -163,6 +163,11 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node)
       for (e = cnode->callers; e; e = e->next_caller)
 	if (e->caller->thunk.thunk_p)
 	  add_symbol_to_partition_1 (part, e->caller);
+
+      /* Instrumented version is actually the same function.
+	 Therefore put it into the same partition.  */
+      if (cnode->instrumented_version)
+	add_symbol_to_partition_1 (part, cnode->instrumented_version);
     }
 
   add_references_to_partition (part, node);
@@ -745,6 +750,7 @@ privatize_symbol_name (symtab_node *node)
 {
   tree decl = node->decl;
   const char *name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+  cgraph_node *cnode;
 
   /* Our renaming machinery do not handle more than one change of assembler name.
      We should not need more than one anyway.  */
@@ -774,6 +780,18 @@ privatize_symbol_name (symtab_node *node)
     lto_record_renamed_decl (node->lto_file_data, name,
 			     IDENTIFIER_POINTER
 			     (DECL_ASSEMBLER_NAME (decl)));
+  /* We could change name which is a target of transparent alias
+     chain of instrumented function name.  Fix alias chain if so  .*/
+  if ((cnode = dyn_cast <cgraph_node> (node))
+      && !cnode->instrumentation_clone
+      && cnode->instrumented_version
+      && cnode->instrumented_version->orig_decl == decl)
+    {
+      tree iname = DECL_ASSEMBLER_NAME (cnode->instrumented_version->decl);
+
+      gcc_assert (IDENTIFIER_TRANSPARENT_ALIAS (iname));
+      TREE_CHAIN (iname) = DECL_ASSEMBLER_NAME (decl);
+    }
   if (cgraph_dump_file)
     fprintf (cgraph_dump_file,
 	    "Privatizing symbol name: %s -> %s\n",

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

* Re: [PATCH, i386, Pointer Bounds Checker 10/x] Partitions
  2014-05-28 16:06 [PATCH, i386, Pointer Bounds Checker 10/x] Partitions Ilya Enkovich
@ 2014-05-30 17:10 ` Jeff Law
  2014-06-02 11:41   ` Richard Biener
  2014-06-02 11:50   ` Ilya Enkovich
  0 siblings, 2 replies; 7+ messages in thread
From: Jeff Law @ 2014-05-30 17:10 UTC (permalink / raw)
  To: Ilya Enkovich, gcc-patches

On 05/28/14 10:06, Ilya Enkovich wrote:
> Hi,
>
> This patch keeps instrumented and original versions together and preserve tranparent alias chain during symbol name privatization.
>
> Bootstrapped and tested on linux-x86_64.
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2013-05-28  Ilya Enkovich  <ilya.enkovich@intel.com>
>
> 	* lto/lto-partition.c (add_symbol_to_partition_1): Keep original
> 	and instrumented versions together.
This part is OK.  Note lto/ has its own ChangeLog, so put the ChangeLog 
entry there and don't use the "lto/" prefix in the ChangeLog entry.

> 	(privatize_symbol_name): Restore transparent alias chain if required.
What exactly are you doing here?  The comment in the code doesn't really 
make it clear what you are doing or why.

> +  /* We could change name which is a target of transparent alias
> +     chain of instrumented function name.  Fix alias chain if so  .*/
So are you saying that we want to change the name?  Or that it could 
have been changed and we have to adjust something because it was changed?

I'm certainly not as familiar with the LTO stuff as I should be -- what 
is the purpose behing chaining the DECL_ASSEMBLER_NAME nodes?

jeff

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

* Re: [PATCH, i386, Pointer Bounds Checker 10/x] Partitions
  2014-05-30 17:10 ` Jeff Law
@ 2014-06-02 11:41   ` Richard Biener
  2014-06-03 21:24     ` Jeff Law
  2014-06-02 11:50   ` Ilya Enkovich
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Biener @ 2014-06-02 11:41 UTC (permalink / raw)
  To: Jeff Law; +Cc: Ilya Enkovich, GCC Patches

On Fri, May 30, 2014 at 7:10 PM, Jeff Law <law@redhat.com> wrote:
> On 05/28/14 10:06, Ilya Enkovich wrote:
>>
>> Hi,
>>
>> This patch keeps instrumented and original versions together and preserve
>> tranparent alias chain during symbol name privatization.
>>
>> Bootstrapped and tested on linux-x86_64.
>>
>> Thanks,
>> Ilya
>> --
>> gcc/
>>
>> 2013-05-28  Ilya Enkovich  <ilya.enkovich@intel.com>
>>
>>         * lto/lto-partition.c (add_symbol_to_partition_1): Keep original
>>         and instrumented versions together.
>
> This part is OK.  Note lto/ has its own ChangeLog, so put the ChangeLog
> entry there and don't use the "lto/" prefix in the ChangeLog entry.
>
>
>>         (privatize_symbol_name): Restore transparent alias chain if
>> required.
>
> What exactly are you doing here?  The comment in the code doesn't really
> make it clear what you are doing or why.
>
>
>> +  /* We could change name which is a target of transparent alias
>> +     chain of instrumented function name.  Fix alias chain if so  .*/
>
> So are you saying that we want to change the name?  Or that it could have
> been changed and we have to adjust something because it was changed?
>
> I'm certainly not as familiar with the LTO stuff as I should be -- what is
> the purpose behing chaining the DECL_ASSEMBLER_NAME nodes?

Something gross:

/* Nonzero in an IDENTIFIER_NODE if the name is a local alias, whose
   uses are to be substituted for uses of the TREE_CHAINed identifier.  */
#define IDENTIFIER_TRANSPARENT_ALIAS(NODE) \
  (IDENTIFIER_NODE_CHECK (NODE)->base.deprecated_flag)

this should be all moved to the symbol table level.  (and IDENTIFIER_NODE
shouldn't have to have tree_common.chain and thus become smaller).

Richard.


> jeff
>

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

* Re: [PATCH, i386, Pointer Bounds Checker 10/x] Partitions
  2014-05-30 17:10 ` Jeff Law
  2014-06-02 11:41   ` Richard Biener
@ 2014-06-02 11:50   ` Ilya Enkovich
  2014-06-04  6:39     ` Jeff Law
  1 sibling, 1 reply; 7+ messages in thread
From: Ilya Enkovich @ 2014-06-02 11:50 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-patches

On 30 May 11:10, Jeff Law wrote:
> On 05/28/14 10:06, Ilya Enkovich wrote:
> >Hi,
> >
> >This patch keeps instrumented and original versions together and preserve tranparent alias chain during symbol name privatization.
> >
> >Bootstrapped and tested on linux-x86_64.
> >
> >Thanks,
> >Ilya
> >--
> >gcc/
> >
> >2013-05-28  Ilya Enkovich  <ilya.enkovich@intel.com>
> >
> >	* lto/lto-partition.c (add_symbol_to_partition_1): Keep original
> >	and instrumented versions together.
> This part is OK.  Note lto/ has its own ChangeLog, so put the
> ChangeLog entry there and don't use the "lto/" prefix in the
> ChangeLog entry.
> 
> >	(privatize_symbol_name): Restore transparent alias chain if required.
> What exactly are you doing here?  The comment in the code doesn't
> really make it clear what you are doing or why.
> 
> >+  /* We could change name which is a target of transparent alias
> >+     chain of instrumented function name.  Fix alias chain if so  .*/
> So are you saying that we want to change the name?  Or that it could
> have been changed and we have to adjust something because it was
> changed?
> 
> I'm certainly not as familiar with the LTO stuff as I should be --
> what is the purpose behing chaining the DECL_ASSEMBLER_NAME nodes?

I'm just adjusting renaming to support alias chains.  LTO renames functions to avoid two static functions with the same assembler name.  Instrumented functions have names chained with original names using IDENTIFIER_TRANSPARENT_ALIAS.  If name of the original function is privatized, then IDENTIFIER_TRANSPARENT_ALIAS still points to the old name which is wrong.  My patch fixes it.

> 
> jeff
> 

Here is fixed ChangeLog.

Thanks,
Ilya
--
gcc/lto

2014-06-02  Ilya Enkovich  <ilya.enkovich@intel.com>

	* lto-partition.c (add_symbol_to_partition_1): Keep original
	and instrumented versions together.
	(privatize_symbol_name): Restore transparent alias chain if required.

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

* Re: [PATCH, i386, Pointer Bounds Checker 10/x] Partitions
  2014-06-02 11:41   ` Richard Biener
@ 2014-06-03 21:24     ` Jeff Law
  2014-06-04  9:51       ` Richard Biener
  0 siblings, 1 reply; 7+ messages in thread
From: Jeff Law @ 2014-06-03 21:24 UTC (permalink / raw)
  To: Richard Biener; +Cc: Ilya Enkovich, GCC Patches

On 06/02/14 05:41, Richard Biener wrote:
>
> this should be all moved to the symbol table level.  (and IDENTIFIER_NODE
> shouldn't have to have tree_common.chain and thus become smaller).
Which ought to be independent of the pointer checking work.  There's 
been some proposals for making first class symbol tables in GCC, but 
nothing that's made any progress at this point.  Maybe I'll sick David 
on it at some point.

jeff

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

* Re: [PATCH, i386, Pointer Bounds Checker 10/x] Partitions
  2014-06-02 11:50   ` Ilya Enkovich
@ 2014-06-04  6:39     ` Jeff Law
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff Law @ 2014-06-04  6:39 UTC (permalink / raw)
  To: Ilya Enkovich; +Cc: gcc-patches

On 06/02/14 05:50, Ilya Enkovich wrote:
> On 30 May 11:10, Jeff Law wrote:
>> On 05/28/14 10:06, Ilya Enkovich wrote:
>>> Hi,
>>>
>>> This patch keeps instrumented and original versions together and preserve tranparent alias chain during symbol name privatization.
>>>
>>> Bootstrapped and tested on linux-x86_64.
>>>
>>> Thanks,
>>> Ilya
>>> --
>>> gcc/
>>>
>>> 2013-05-28  Ilya Enkovich  <ilya.enkovich@intel.com>
>>>
>>> 	* lto/lto-partition.c (add_symbol_to_partition_1): Keep original
>>> 	and instrumented versions together.
>> This part is OK.  Note lto/ has its own ChangeLog, so put the
>> ChangeLog entry there and don't use the "lto/" prefix in the
>> ChangeLog entry.
>>
>>> 	(privatize_symbol_name): Restore transparent alias chain if required.
>> What exactly are you doing here?  The comment in the code doesn't
>> really make it clear what you are doing or why.
>>
>>> +  /* We could change name which is a target of transparent alias
>>> +     chain of instrumented function name.  Fix alias chain if so  .*/
>> So are you saying that we want to change the name?  Or that it could
>> have been changed and we have to adjust something because it was
>> changed?
>>
>> I'm certainly not as familiar with the LTO stuff as I should be --
>> what is the purpose behing chaining the DECL_ASSEMBLER_NAME nodes?
>
> I'm just adjusting renaming to support alias chains.  LTO renames functions to avoid two static functions with the same assembler name.  Instrumented functions have names chained with original names using IDENTIFIER_TRANSPARENT_ALIAS.  If name of the original function is privatized, then IDENTIFIER_TRANSPARENT_ALIAS still points to the old name which is wrong.  My patch fixes it.
>
>>
>> jeff
>>
>
> Here is fixed ChangeLog.
>
> Thanks,
> Ilya
> --
> gcc/lto
>
> 2014-06-02  Ilya Enkovich  <ilya.enkovich@intel.com>
>
> 	* lto-partition.c (add_symbol_to_partition_1): Keep original
> 	and instrumented versions together.
> 	(privatize_symbol_name): Restore transparent alias chain if required.
OK.  This is fine once all the other pointer checking bits are approved.

jeff


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

* Re: [PATCH, i386, Pointer Bounds Checker 10/x] Partitions
  2014-06-03 21:24     ` Jeff Law
@ 2014-06-04  9:51       ` Richard Biener
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Biener @ 2014-06-04  9:51 UTC (permalink / raw)
  To: Jeff Law; +Cc: Ilya Enkovich, GCC Patches

On Tue, Jun 3, 2014 at 11:24 PM, Jeff Law <law@redhat.com> wrote:
> On 06/02/14 05:41, Richard Biener wrote:
>>
>>
>> this should be all moved to the symbol table level.  (and IDENTIFIER_NODE
>> shouldn't have to have tree_common.chain and thus become smaller).
>
> Which ought to be independent of the pointer checking work.  There's been
> some proposals for making first class symbol tables in GCC, but nothing
> that's made any progress at this point.  Maybe I'll sick David on it at some
> point.

You probably missed that we now have such symbol table (ok, it still
lacks labels and CONST_DECLs).

Richard.

> jeff
>

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

end of thread, other threads:[~2014-06-04  9:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-28 16:06 [PATCH, i386, Pointer Bounds Checker 10/x] Partitions Ilya Enkovich
2014-05-30 17:10 ` Jeff Law
2014-06-02 11:41   ` Richard Biener
2014-06-03 21:24     ` Jeff Law
2014-06-04  9:51       ` Richard Biener
2014-06-02 11:50   ` Ilya Enkovich
2014-06-04  6:39     ` Jeff Law

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).