Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(14315)

Issue 4517103: [google] Minor cleanups (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 11 months ago by Diego Novillo
Modified:
12 years, 8 months ago
Reviewers:
CC:
Lawrence Crowl, gcc-patches_gcc.gnu.org
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -28 lines) Patch
M gcc/cp/pph-streamer-in.c View 3 chunks +2 lines, -15 lines 0 comments Download
M gcc/cp/pph-streamer-out.c View 3 chunks +1 line, -13 lines 0 comments Download

Messages

Total messages: 1
Diego Novillo
12 years, 11 months ago (2011-05-24 18:29:03 UTC) #1
This patch is in preparation of an extension to the tree sharing code
in the streamer to also support non-trees.

The new code to stream struct lang_identifier runs into memory
problems on some extreme cases.  I have a C test case that generates
thousands of bindings with 100,000 declarations in them.  All these
are shared, but the streaming code does not realize that and dies
trying to write everything out.

The handling of IDENTIFIER_NODE did not need to also save the type,
name and length of the identifier.  All that is already handled in
common code.

This fixes 1 failure in the testsuite.

Tested on x86_64.


Diego.


	* pph-streamer-in.c (pph_stream_read_tree): For IDENTIFIER_NODE,
	only read fields in struct lang_identifier.
	Remove FIXME pph markers.
	* pph-streamer-out.c (pph_stream_write_tree): For IDENTIFIER_NODE,
	only write fields in struct lang_identifier.
	Remove FIXME pph markers.

diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index d40fd17..c914f86 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -824,7 +824,6 @@ pph_stream_read_tree (struct lto_input_block *ib
ATTRIBUTE_UNUSED,
   if (DECL_P (expr))
     {
       DECL_INITIAL (expr) = pph_input_tree (stream);
-      /* FIXME pph: DECL_NAME (expr) = pph_input_tree (stream); */
 
       if (TREE_CODE (expr) == FUNCTION_DECL
 	  || TREE_CODE (expr) == NAMESPACE_DECL
@@ -864,14 +863,7 @@ pph_stream_read_tree (struct lto_input_block *ib
ATTRIBUTE_UNUSED,
     }
   else if (TREE_CODE (expr) == IDENTIFIER_NODE)
     {
-      const char *str;
-      struct lang_identifier *id = LANG_IDENTIFIER_CAST(expr);
-      TREE_TYPE (expr) = pph_input_tree (stream);
-      str = pph_input_string (stream);
-      /* FIXME pph: There must be a better way.  */
-      IDENTIFIER_NODE_CHECK (expr)->identifier.id.str
-          = (const unsigned char *)str;
-      IDENTIFIER_LENGTH (expr) = strlen (str);
+      struct lang_identifier *id = LANG_IDENTIFIER_CAST (expr);
       id->namespace_bindings = pph_stream_read_cxx_binding (stream);
       id->bindings = pph_stream_read_cxx_binding (stream);
       id->class_template_info = pph_input_tree (stream);
@@ -904,11 +896,6 @@ pph_stream_read_tree (struct lto_input_block *ib
ATTRIBUTE_UNUSED,
   else if (TREE_CODE (expr) == TEMPLATE_INFO)
     {
       TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (expr)
-          = pph_stream_read_tree_vec (stream);
+          = pph_stream_read_qual_use_vec (stream);
     }
-  else if (TREE_CODE (expr) == TREE_LIST)
-    ; /* FIXME pph: already handled?  */
-  else if (flag_pph_debug >= 2)
-    fprintf (pph_logfile, "PPH: unimplemented read of %s\n",
-             tree_code_name[TREE_CODE (expr)]);
 }
diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c
index a744ae8..1fd9a23 100644
--- a/gcc/cp/pph-streamer-out.c
+++ b/gcc/cp/pph-streamer-out.c
@@ -825,9 +825,6 @@ pph_stream_write_tree (struct output_block *ob, tree expr,
bool ref_p)
   if (DECL_P (expr))
     {
       pph_output_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p, 3);
-      /* FIXME pph:
-      pph_output_tree_or_ref_1 (stream, DECL_NAME (expr), ref_p, 3);
-      */
 
       if (TREE_CODE (expr) == FUNCTION_DECL
 	  || TREE_CODE (expr) == NAMESPACE_DECL
@@ -874,10 +871,7 @@ pph_stream_write_tree (struct output_block *ob, tree expr,
bool ref_p)
     }
   else if (TREE_CODE (expr) == IDENTIFIER_NODE)
     {
-      struct lang_identifier *id = LANG_IDENTIFIER_CAST(expr);
-      pph_output_tree_or_ref_1 (stream, TREE_TYPE (expr), ref_p, 3);
-      pph_output_string_with_length (stream, IDENTIFIER_POINTER (expr),
-                                             IDENTIFIER_LENGTH (expr));
+      struct lang_identifier *id = LANG_IDENTIFIER_CAST (expr);
       pph_stream_write_cxx_binding (stream, id->namespace_bindings, ref_p);
       pph_stream_write_cxx_binding (stream, id->bindings, ref_p);
       pph_output_tree_or_ref_1 (stream, id->class_template_info, ref_p, 3);
@@ -907,18 +901,12 @@ pph_stream_write_tree (struct output_block *ob, tree expr,
bool ref_p)
       pph_output_tree_or_ref_1 (stream, DECL_TEMPLATE_RESULT (expr), ref_p, 3);
       pph_output_tree_or_ref_1 (stream, DECL_TEMPLATE_PARMS (expr), ref_p, 3);
       pph_output_tree_or_ref_1 (stream, DECL_CONTEXT (expr), ref_p, 3);
-      /* FIXME pph: what of bit DECL_MEMBER_TEMPLATE_P (expr) */
     }
   else if (TREE_CODE (expr) == TEMPLATE_INFO)
     {
       pph_stream_write_qual_use_vec (stream,
           TI_TYPEDEFS_NEEDING_ACCESS_CHECKING (expr), ref_p);
     }
-  else if (TREE_CODE (expr) == TREE_LIST)
-    ; /* FIXME pph: already handled?  */
-  else if (flag_pph_debug >= 2)
-    fprintf (pph_logfile, "PPH: unimplemented write of %s\n",
-             tree_code_name[TREE_CODE (expr)]);
 }
 
 

--
This patch is available for review at http://codereview.appspot.com/4517103
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b