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

Issue 5846069: [pph] Rename pph_sytmab -> pph_replay

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by Diego Novillo
Modified:
12 years, 1 month 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 (+101 lines, -90 lines) Patch
M gcc/cp/class.c View 1 chunk +1 line, -1 line 0 comments Download
M gcc/cp/decl.c View 1 chunk +1 line, -1 line 0 comments Download
M gcc/cp/pph.h View 2 chunks +7 lines, -7 lines 0 comments Download
M gcc/cp/pph-core.c View 1 chunk +1 line, -1 line 0 comments Download
M gcc/cp/pph-in.c View 7 chunks +39 lines, -35 lines 0 comments Download
M gcc/cp/pph-out.c View 9 chunks +27 lines, -26 lines 0 comments Download
M gcc/cp/pph-streamer.h View 3 chunks +23 lines, -16 lines 0 comments Download
M gcc/cp/semantics.c View 2 chunks +2 lines, -3 lines 0 comments Download

Messages

Total messages: 1
Diego Novillo
12 years, 1 month ago (2012-03-19 19:23:57 UTC) #1
This patch renames pph_symtab, pph_symtab_entry and pph_symtab_action into
pph_replay* to better reflects the semantics of this table.

No functional changes, just a rename.

2012-03-19   Diego Novillo  <dnovillo@google.com>

	* pph-streamer.h (struct pph_replay_entry): Rename from
	pph_symtab_entry.
	Rename field DECL to TO_REPLAY.
	Update all users.
	(struct pph_replay): Rename from pph_symtab.
	(enum pph_replay_action): Rename from pph_symtab_action.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/pph@185539
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/cp/class.c        |    2 +-
 gcc/cp/decl.c         |    2 +-
 gcc/cp/pph-core.c     |    2 +-
 gcc/cp/pph-in.c       |   74 +++++++++++++++++++++++++-----------------------
 gcc/cp/pph-out.c      |   53 ++++++++++++++++++-----------------
 gcc/cp/pph-streamer.h |   39 +++++++++++++++----------
 gcc/cp/pph.h          |   14 ++++----
 gcc/cp/semantics.c    |    4 +-
 8 files changed, 101 insertions(+), 89 deletions(-)

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 3a94bb2..164ee10 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -1865,7 +1865,7 @@ finish_struct_methods (tree t)
     return;
 
   if (pph_writer_enabled_p ())
-    pph_add_type_to_symtab (t, PPH_SYMTAB_FINISH_STRUCT_METHODS);
+    pph_add_type_to_replay (t, PPH_REPLAY_FINISH_STRUCT_METHODS);
 
   len = VEC_length (tree, method_vec);
 
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9a04613..7503000 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5964,7 +5964,7 @@ cp_rest_of_decl_compilation (tree decl, int top_level, int
at_end)
   /* If we are generating a PPH image, add DECL to its symbol table.  */
   if (pph_writer_enabled_p ())
     {
-      pph_add_decl_to_symtab (decl, PPH_SYMTAB_DECLARE, top_level, at_end);
+      pph_add_decl_to_replay (decl, PPH_REPLAY_DECLARE, top_level, at_end);
       return;
     }
 
diff --git a/gcc/cp/pph-core.c b/gcc/cp/pph-core.c
index bdb0272..feaee29 100644
--- a/gcc/cp/pph-core.c
+++ b/gcc/cp/pph-core.c
@@ -1322,7 +1322,7 @@ pph_stream_close_1 (pph_stream *stream, bool flush_p)
   stream->file = NULL;
   VEC_free (pph_cache_entry, heap, stream->cache.v);
   pointer_map_destroy (stream->cache.m);
-  VEC_free (pph_symtab_entry, heap, stream->symtab.v);
+  VEC_free (pph_replay_entry, heap, stream->replay.v);
   VEC_free (pph_stream_ptr, heap, stream->includes.v);
   pointer_set_destroy (stream->includes.m);
 
diff --git a/gcc/cp/pph-in.c b/gcc/cp/pph-in.c
index ee72d77..b032315 100644
--- a/gcc/cp/pph-in.c
+++ b/gcc/cp/pph-in.c
@@ -2832,14 +2832,14 @@ pph_in_tree (pph_stream *stream)
 
 /* Read a symbol table marker from STREAM.  */
 
-static inline enum pph_symtab_action
-pph_in_symtab_action (pph_stream *stream)
-{
-  enum pph_symtab_action m = (enum pph_symtab_action) pph_in_uchar (stream);
-  gcc_assert (m == PPH_SYMTAB_DECLARE
-	      || m == PPH_SYMTAB_EXPAND
-	      || m == PPH_SYMTAB_EXPAND_1
-	      || m == PPH_SYMTAB_FINISH_STRUCT_METHODS);
+static inline enum pph_replay_action
+pph_in_replay_action (pph_stream *stream)
+{
+  enum pph_replay_action m = (enum pph_replay_action) pph_in_uchar (stream);
+  gcc_assert (m == PPH_REPLAY_DECLARE
+	      || m == PPH_REPLAY_EXPAND
+	      || m == PPH_REPLAY_EXPAND_1
+	      || m == PPH_REPLAY_FINISH_STRUCT_METHODS);
   return m;
 }
 
@@ -2879,7 +2879,7 @@ pph_fn_already_expanded (tree fn)
    original header files and out of PPH images.  */
 
 static void
-pph_in_symtab (pph_stream *stream)
+pph_in_replay (pph_stream *stream)
 {
   unsigned i, num;
 
@@ -2888,11 +2888,11 @@ pph_in_symtab (pph_stream *stream)
   num = pph_in_uint (stream);
   for (i = 0; i < num; i++)
     {
-      pph_symtab_entry entry;
+      pph_replay_entry entry;
       struct bitpack_d bp;
 
-      entry.action = pph_in_symtab_action (stream);
-      entry.decl = pph_in_tree (stream);
+      entry.action = pph_in_replay_action (stream);
+      entry.to_replay = pph_in_tree (stream);
       bp = pph_in_bitpack (stream);
       entry.top_level = bp_unpack_value (&bp, 1);
       entry.at_end = bp_unpack_value (&bp, 1);
@@ -2900,30 +2900,32 @@ pph_in_symtab (pph_stream *stream)
       entry.x_processing_template_decl = pph_in_int (stream);
       entry.function_depth = pph_in_int (stream);
 
-      if (entry.action == PPH_SYMTAB_DECLARE)
+      if (entry.action == PPH_REPLAY_DECLARE)
 	{
-          if (pph_decl_already_emitted (entry.decl))
+	  tree decl = entry.to_replay;
+          if (pph_decl_already_emitted (decl))
             continue;
-	  cp_rest_of_decl_compilation (entry.decl, entry.top_level,
-				       entry.at_end);
+	  cp_rest_of_decl_compilation (decl, entry.top_level, entry.at_end);
 	}
-      else if (entry.action == PPH_SYMTAB_EXPAND
-	       || entry.action == PPH_SYMTAB_EXPAND_1)
+      else if (entry.action == PPH_REPLAY_EXPAND
+	       || entry.action == PPH_REPLAY_EXPAND_1)
 	{
 	  bool prev_processing_template_decl, prev_at_eof;
 	  int prev_function_depth;
 	  bool need_cgraph_node_p;
 	  tree prev_current_function_decl;
+	  tree decl;
 
-	  pph_in_struct_function (stream, entry.decl);
+	  decl = entry.to_replay;
+	  pph_in_struct_function (stream, decl);
 	  need_cgraph_node_p = pph_in_bool (stream);
-	  if (pph_fn_already_expanded (entry.decl))
+	  if (pph_fn_already_expanded (decl))
 	    continue;
 
-	  /* ENTRY.DECL was reset to being external by the original
+	  /* DECL was reset to being external by the original
 	     expansion code, so we need to restore its value before
 	     expanding again.  */
-	  DECL_EXTERNAL (entry.decl) = false;
+	  DECL_EXTERNAL (decl) = false;
 
 	  /* Re-establish needed global state before calling the
 	     expanders.  FIXME pph, get rid of this by fixing the
@@ -2938,16 +2940,16 @@ pph_in_symtab (pph_stream *stream)
 
 	  /* Do the expansion.  */
 	  prev_current_function_decl = current_function_decl;
-	  current_function_decl = entry.decl;
-	  push_cfun (DECL_STRUCT_FUNCTION (entry.decl));
+	  current_function_decl = decl;
+	  push_cfun (DECL_STRUCT_FUNCTION (decl));
 
-	  if (entry.action == PPH_SYMTAB_EXPAND)
-	    expand_or_defer_fn (entry.decl);
+	  if (entry.action == PPH_REPLAY_EXPAND)
+	    expand_or_defer_fn (decl);
 	  else
-	    expand_or_defer_fn_1 (entry.decl);
+	    expand_or_defer_fn_1 (decl);
 
 	  if (need_cgraph_node_p)
-	    cgraph_get_create_node (entry.decl);
+	    cgraph_get_create_node (decl);
 
 	  current_function_decl = prev_current_function_decl;
 	  pop_cfun ();
@@ -2957,9 +2959,9 @@ pph_in_symtab (pph_stream *stream)
 	  at_eof = prev_at_eof;
 	  function_depth = prev_function_depth;
 	}
-      else if (entry.action == PPH_SYMTAB_FINISH_STRUCT_METHODS)
+      else if (entry.action == PPH_REPLAY_FINISH_STRUCT_METHODS)
 	{
-	  tree type = entry.decl;
+	  tree type = entry.to_replay;
 
 	  /* If TYPE has a METHOD_VEC, we need to resort it.  Name
 	     lookup in classes relies on the specific ordering of the
@@ -3219,11 +3221,13 @@ pph_read_file_1 (pph_stream *stream)
 
   pph_in_canonical_template_parms (stream);
 
-  /* Read and process the symbol table.  This must be done at the end
-     because we have symbols coming in from children PPH images which
-     must be instantiated in the same order they were instantiated by
-     the original parser.  */
-  pph_in_symtab (stream);
+  /* Read and process the symbol and type re-play table.  This
+     re-executes all the actions done to present symbols and types to
+     the middle end.  This must be done at the end because we have
+     symbols coming in from children PPH images which must be
+     instantiated in the same order they were instantiated by the
+     original parser.  */
+  pph_in_replay (stream);
 
   if (flag_pph_dump_tree)
     pph_dump_global_state (pph_logfile, "after pph read");
diff --git a/gcc/cp/pph-out.c b/gcc/cp/pph-out.c
index 751a6f6..7ba4ee6 100644
--- a/gcc/cp/pph-out.c
+++ b/gcc/cp/pph-out.c
@@ -1903,7 +1903,7 @@ pph_out_tcc_declaration (pph_stream *stream, tree decl)
     case FUNCTION_DECL:
       /* Note that for FUNCTION_DECLs we do not output
 	 DECL_STRUCT_FUNCTION here.  This is emitted at the end of the
-	 PPH file in pph_out_symtab. This way, we will be able to
+	 PPH file in pph_out_replay. This way, we will be able to
 	 re-instantiate them in the same order when reading the image
 	 (the allocation of DECL_STRUCT_FUNCTION has the side effect
 	 of generating function sequence numbers
@@ -2426,13 +2426,13 @@ pph_out_tree (pph_stream *stream, tree expr)
 /* Emit symbol table ACTION to STREAM.  */
 
 static inline void
-pph_out_symtab_action (pph_stream *stream, enum pph_symtab_action action)
+pph_out_replay_action (pph_stream *stream, enum pph_replay_action action)
 {
-  gcc_assert ((action == PPH_SYMTAB_DECLARE
-	       || action == PPH_SYMTAB_EXPAND
-	       || action == PPH_SYMTAB_EXPAND_1
-	       || action == PPH_SYMTAB_FINISH_STRUCT_METHODS)
-              && (enum pph_symtab_action)(unsigned char) action);
+  gcc_assert ((action == PPH_REPLAY_DECLARE
+	       || action == PPH_REPLAY_EXPAND
+	       || action == PPH_REPLAY_EXPAND_1
+	       || action == PPH_REPLAY_FINISH_STRUCT_METHODS)
+              && (enum pph_replay_action)(unsigned char) action);
   pph_out_uchar (stream, action);
 }
 
@@ -2441,10 +2441,10 @@ pph_out_symtab_action (pph_stream *stream, enum
pph_symtab_action action)
    image.  TOP_LEVEL and AT_END are as in rest_of_decl_compilation.  */
 
 void
-pph_add_decl_to_symtab (tree decl, enum pph_symtab_action action,
+pph_add_decl_to_replay (tree decl, enum pph_replay_action action,
 			bool top_level, bool at_end)
 {
-  pph_symtab_entry entry;
+  pph_replay_entry entry;
 
   if (decl == NULL || pph_out_stream == NULL)
     return;
@@ -2452,7 +2452,7 @@ pph_add_decl_to_symtab (tree decl, enum pph_symtab_action
action,
   gcc_assert (DECL_P (decl));
 
   entry.action = action;
-  entry.decl = decl;
+  entry.to_replay = decl;
   entry.top_level = top_level;
   entry.at_end = at_end;
 
@@ -2466,16 +2466,16 @@ pph_add_decl_to_symtab (tree decl, enum
pph_symtab_action action,
   gcc_assert (at_end == at_eof && (at_eof == 0 || at_eof == 1));
   entry.at_eof = at_eof;
 
-  VEC_safe_push (pph_symtab_entry, heap, pph_out_stream->symtab.v, &entry);
+  VEC_safe_push (pph_replay_entry, heap, pph_out_stream->replay.v, &entry);
 }
 
 
 /* Add TYPE to the symbol table, to be re-played according to ACTION.  */
 
 void
-pph_add_type_to_symtab (tree type, enum pph_symtab_action action)
+pph_add_type_to_replay (tree type, enum pph_replay_action action)
 {
-  pph_symtab_entry entry;
+  pph_replay_entry entry;
 
   if (pph_out_stream == NULL)
     return;
@@ -2484,8 +2484,8 @@ pph_add_type_to_symtab (tree type, enum pph_symtab_action
action)
 
   memset (&entry, 0, sizeof (entry));
   entry.action = action;
-  entry.decl = type;
-  VEC_safe_push (pph_symtab_entry, heap, pph_out_stream->symtab.v, &entry);
+  entry.to_replay = type;
+  VEC_safe_push (pph_replay_entry, heap, pph_out_stream->replay.v, &entry);
 }
 
 
@@ -2498,18 +2498,18 @@ pph_add_type_to_symtab (tree type, enum
pph_symtab_action action)
    original header files and out of PPH images.  */
 
 static void
-pph_out_symtab (pph_stream *stream)
+pph_out_replay (pph_stream *stream)
 {
-  pph_symtab_entry *entry;
+  pph_replay_entry *entry;
   unsigned i;
 
-  pph_out_uint (stream, VEC_length (pph_symtab_entry, stream->symtab.v));
-  FOR_EACH_VEC_ELT (pph_symtab_entry, stream->symtab.v, i, entry)
+  pph_out_uint (stream, VEC_length (pph_replay_entry, stream->replay.v));
+  FOR_EACH_VEC_ELT (pph_replay_entry, stream->replay.v, i, entry)
     {
       struct bitpack_d bp;
 
-      pph_out_symtab_action (stream, entry->action);
-      pph_out_tree (stream, entry->decl);
+      pph_out_replay_action (stream, entry->action);
+      pph_out_tree (stream, entry->to_replay);
       bp = bitpack_create (stream->encoder.w.ob->main_stream);
       bp_pack_value (&bp, entry->top_level, 1);
       bp_pack_value (&bp, entry->at_end, 1);
@@ -2517,11 +2517,12 @@ pph_out_symtab (pph_stream *stream)
       pph_out_bitpack (stream, &bp);
       pph_out_int (stream, entry->x_processing_template_decl);
       pph_out_int (stream, entry->function_depth);
-      if (entry->action == PPH_SYMTAB_EXPAND
-	  || entry->action == PPH_SYMTAB_EXPAND_1)
+      if (entry->action == PPH_REPLAY_EXPAND
+	  || entry->action == PPH_REPLAY_EXPAND_1)
 	{
-	  pph_out_struct_function (stream, DECL_STRUCT_FUNCTION (entry->decl));
-	  pph_out_bool (stream, cgraph_get_node (entry->decl) != NULL);
+	  pph_out_struct_function (stream,
+				   DECL_STRUCT_FUNCTION (entry->to_replay));
+	  pph_out_bool (stream, cgraph_get_node (entry->to_replay) != NULL);
 	}
     }
 }
@@ -2666,7 +2667,7 @@ pph_write_file (pph_stream *stream)
   /* Emit the symbol table.  The symbol table must be emitted at the
      end because all the symbols read from children PPH images are not
      known in advance when we start reading this file in the reader.  */
-  pph_out_symtab (stream);
+  pph_out_replay (stream);
 
   if (flag_pph_dump_tree)
     pph_dump_global_state (pph_logfile, "after pph write");
diff --git a/gcc/cp/pph-streamer.h b/gcc/cp/pph-streamer.h
index 78e0d77..84d96a6 100644
--- a/gcc/cp/pph-streamer.h
+++ b/gcc/cp/pph-streamer.h
@@ -129,14 +129,14 @@ typedef struct pph_cache {
 } pph_cache;
 
 
-/* Symbol table entry.  */
-typedef struct pph_symtab_entry
+/* Replay table entry.  */
+typedef struct pph_replay_entry
 {
   /* Registration action to perform by the reader.  */
-  enum pph_symtab_action action;
+  enum pph_replay_action action;
 
-  /* VAR_DECL or FUNCTION_DECL to declare.  */
-  tree decl;
+  /* Symbol or type to process.  */
+  tree to_replay;
 
   /* Values to be passed to rest_of_decl_compilation.  */
   unsigned int top_level : 1;
@@ -148,17 +148,24 @@ typedef struct pph_symtab_entry
   unsigned int at_eof : 1;
   int x_processing_template_decl;
   int function_depth;
-} pph_symtab_entry;
+} pph_replay_entry;
 
-DEF_VEC_O(pph_symtab_entry);
-DEF_VEC_ALLOC_O(pph_symtab_entry,heap);
+DEF_VEC_O(pph_replay_entry);
+DEF_VEC_ALLOC_O(pph_replay_entry,heap);
 
-/* Symbol table for a PPH stream.  */
-typedef struct pph_symtab
+/* Replay table for a PPH stream.  This table represents parsing
+   actions that need to be done to finalize the parsing of a
+   symbol declaration or a type.  These actions transfer the parsed
+   tree to the middle end for code generation and/or layout.
+
+   They need to be done in the PPH reader, since none of the
+   state produced by them are saved in the PPH image (e.g., call graph
+   nodes, method vector layout, etc).  */
+typedef struct pph_replay
 {
   /* Table of all the declarations to register in declaration order.  */
-  VEC(pph_symtab_entry,heap) *v;
-} pph_symtab;
+  VEC(pph_replay_entry,heap) *v;
+} pph_replay;
 
 /* Vector of pph_stream pointers.  */
 typedef struct pph_stream *pph_stream_ptr;
@@ -221,12 +228,12 @@ struct pph_stream {
      resolving external references.  */
   unsigned int in_memory_p : 1;
 
-  /* Symbol table.  This is collected as the compiler instantiates
+  /* Replay table.  This is collected as the compiler instantiates
      symbols and functions.  Once we finish parsing the header file,
      this array is written out to the PPH image.  This way, the reader
-     will be able to instantiate these symbols in the same order that
-     they were instantiated originally.  */
-  pph_symtab symtab;
+     will be able to replay these actions in the same order that
+     they were executed originally.  */
+  pph_replay replay;
 
   /* Transitive closure list of all the images included directly and
      indirectly by this image.  Note that this list only contains PPH
diff --git a/gcc/cp/pph.h b/gcc/cp/pph.h
index 25b3f84..09a0bef 100644
--- a/gcc/cp/pph.h
+++ b/gcc/cp/pph.h
@@ -34,19 +34,19 @@ typedef struct pph_stream pph_stream;
 /* Actions associated with each symbol table entry.  These indicate
    what the reader should do when registering each entry with the
    middle-end.  */
-enum pph_symtab_action {
+enum pph_replay_action {
   /* Declare this symbol with rest_of_decl_compilation.  */
-  PPH_SYMTAB_DECLARE = 0x23,
+  PPH_REPLAY_DECLARE = 0x23,
 
   /* Expand this function with expand_or_defer_fn.  */
-  PPH_SYMTAB_EXPAND,
+  PPH_REPLAY_EXPAND,
 
   /* Expand this function with expand_or_defer_fn_1.  */
-  PPH_SYMTAB_EXPAND_1,
+  PPH_REPLAY_EXPAND_1,
 
   /* Layout the method vector for this type with
      finish_struct_methods.  */
-  PPH_SYMTAB_FINISH_STRUCT_METHODS
+  PPH_REPLAY_FINISH_STRUCT_METHODS
 };
 
 /* Record markers.  */
@@ -164,8 +164,8 @@ extern void pph_out_tree_vec (pph_stream *stream,
VEC(tree,gc) *v);
 extern void pph_out_merge_key_tree (pph_stream *, tree, bool);
 extern void pph_out_record_marker (pph_stream *stream,
 			enum pph_record_marker marker, enum pph_tag tag);
-void pph_add_decl_to_symtab (tree, enum pph_symtab_action, bool, bool);
-void pph_add_type_to_symtab (tree, enum pph_symtab_action);
+void pph_add_decl_to_replay (tree, enum pph_replay_action, bool, bool);
+void pph_add_type_to_replay (tree, enum pph_replay_action);
 
 /* In pph-in.c.  */
 extern unsigned int pph_in_uint (pph_stream *stream);
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index b1820fe..566d8b0 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3721,7 +3721,7 @@ expand_or_defer_fn_1 (tree fn)
   /* If we are generating a PPH image, add FN to its symbol table.  */
   if (pph_writer_enabled_p ())
     {
-      pph_add_decl_to_symtab (fn, PPH_SYMTAB_EXPAND_1, false, at_eof);
+      pph_add_decl_to_replay (fn, PPH_REPLAY_EXPAND_1, false, at_eof);
       return false;
     }
 
@@ -3817,7 +3817,7 @@ expand_or_defer_fn (tree fn)
   /* If we are generating a PPH image, add FN to its symbol table.  */
   if (pph_writer_enabled_p ())
     {
-      pph_add_decl_to_symtab (fn, PPH_SYMTAB_EXPAND, false, at_eof);
+      pph_add_decl_to_replay (fn, PPH_REPLAY_EXPAND, false, at_eof);
       return;
     }
 
-- 
1.7.7.3


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

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