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: [mudflap] fix alpha failures


rth wrote:

> The largest problem here is that in mudflap_enqueue_decl and 
> mudflap_enqueue_constant we were not using the original decl
> or constant object, but rather fooling around with labels and
> creating new fake decls. [...]

I don't understand fully why this hacking is no longer necessary.  It
was at one point because of the timing and details of the emission of
literals and globals into the assembly output.  The emitted
registration code needed to refer to the runtime address of these
objects, but at the time a simple ADDR_EXPR reference to the
possibly-processed tree node did not work.

Anyway, your recent changes caused some subtle regressions.  One is
that string literals synthesized to describe an instrumented variable
or source location have become registered with the runtime, which is a
big waste of time and space.  Unfortunately it isn't trivially
testable in the test suite, requiring tree dumps or runtime traces to
see.  The attached patch unbreaks this.

There is still a problem associated with an interaction between the
callgraph code, tree dumping, and the timing of the emission of
mudflap's static registration function. Try

% g++ -fmudflap -fdump-tree-all something.cxx

- FChE


2004-01-08  Frank Ch. Eigler  <fche@redhat.com>

	* tree-mudflap.c (mf_build_string): Properly mf_mark string.
	(mf_varname_tree): Remove redundant marking.
	* tree-optimize.c (tree_rest_of_compilation): Skip mudflap processing
	of mf_marked functions.
	* c-mudflap.c (mflang_flush_calls): mf_mark synthetic function.

2004-01-08  Frank Ch. Eigler  <fche@redhat.com>

	* cp-mudflap.c (mflang_flush_calls): mf_mark synthetic function.


Index: c-mudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/c-mudflap.c,v
retrieving revision 1.1.2.9
diff -u -w -s -p -r1.1.2.9 c-mudflap.c
--- c-mudflap.c	1 Jan 2004 03:21:27 -0000	1.1.2.9
+++ c-mudflap.c	8 Jan 2004 19:52:00 -0000
@@ -1,7 +1,7 @@
 /* Mudflap: narrow-pointer bounds-checking by tree rewriting:
    C front-end interface.
 
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Frank Ch. Eigler <fche@redhat.com>
    and Graydon Hoare <graydon@redhat.com>
 
@@ -81,6 +81,7 @@ mflang_flush_calls (tree enqueued_call_s
 
   DECL_STATIC_CONSTRUCTOR (current_function_decl) = 1;
   TREE_PUBLIC (current_function_decl) = 0;
+  mf_mark (current_function_decl);
 
   body = c_begin_compound_stmt ();
   pushlevel (0);
Index: tree-mudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-mudflap.c,v
retrieving revision 1.1.2.62
diff -u -w -s -p -r1.1.2.62 tree-mudflap.c
--- tree-mudflap.c	3 Jan 2004 23:02:02 -0000	1.1.2.62
+++ tree-mudflap.c	8 Jan 2004 19:52:00 -0000
@@ -1,5 +1,5 @@
 /* Mudflap: narrow-pointer bounds-checking by tree rewriting.
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Frank Ch. Eigler <fche@redhat.com>
    and Graydon Hoare <graydon@redhat.com>
 
@@ -90,7 +90,7 @@ static tree
 mf_build_string (const char *string)
 {
   size_t len = strlen (string);
-  tree result = build_string (len + 1, string);
+  tree result = mf_mark (build_string (len + 1, string));
 
   TREE_TYPE (result)
       = build_array_type (char_type_node,
@@ -102,7 +102,7 @@ mf_build_string (const char *string)
 
   result = build1 (ADDR_EXPR, build_pointer_type (char_type_node), result);
 
-  return result;
+  return mf_mark (result);
 }
 
 /* Perform the declaration-related mudflap tree transforms on the
@@ -321,7 +321,7 @@ mf_varname_tree (tree decl)
   result = mf_build_string (buf_contents);
   pp_clear_output_area (buf);
 
-  return mf_mark (result);
+  return result;
 }
 
 
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 1.1.4.103
diff -u -w -s -p -r1.1.4.103 tree-optimize.c
--- tree-optimize.c	7 Jan 2004 23:44:15 -0000	1.1.4.103
+++ tree-optimize.c	8 Jan 2004 19:52:01 -0000
@@ -1,5 +1,5 @@
 /* Control and data flow functions for trees.
-   Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Diego Novillo <dnovillo@redhat.com>
 
 This file is part of GCC.
@@ -421,7 +421,7 @@ tree_rest_of_compilation (tree fndecl, b
   dump_function (TDI_useless, fndecl);
 
   /* Mudflap-instrument any relevant declarations.  */
-  if (flag_mudflap)
+  if (flag_mudflap && ! mf_marked_p (fndecl))
     mudflap_c_function_decls (fndecl);
 
   /* Lower the structured statements.  */
@@ -438,7 +438,7 @@ tree_rest_of_compilation (tree fndecl, b
   lower_eh_constructs (&DECL_SAVED_TREE (fndecl));
 
   /* Mudflap-instrument any relevant operations.  */
-  if (flag_mudflap)
+  if (flag_mudflap && ! mf_marked_p (fndecl))
     {
       /* Invoke the SSA tree optimizer.  */
       if (optimize >= 1 && !flag_disable_tree_ssa)
Index: cp/cp-mudflap.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/Attic/cp-mudflap.c,v
retrieving revision 1.1.2.11
diff -u -w -s -p -r1.1.2.11 cp-mudflap.c
--- cp/cp-mudflap.c	1 Jan 2004 03:21:28 -0000	1.1.2.11
+++ cp/cp-mudflap.c	8 Jan 2004 19:52:01 -0000
@@ -1,7 +1,7 @@
 /* Mudflap: narrow-pointer bounds-checking by tree rewriting:
    C++ front-end interface.
 
-   Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
    Contributed by Frank Ch. Eigler <fche@redhat.com>
    and Graydon Hoare <graydon@redhat.com>
 
@@ -78,6 +78,7 @@ mflang_flush_calls (tree enqueued_call_s
 
   TREE_PUBLIC (current_function_decl) = 0;
   DECL_ARTIFICIAL (current_function_decl) = 1;
+  mf_mark (current_function_decl);
 
   /* Generate the body, one statement at a time.  */
   body = begin_compound_stmt (/*has_no_scope=*/false);


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