diff mbox

[pph] Update streaming of cxx_binding and c_language_function

Message ID 20110530200629.GA27918@google.com
State New
Headers show

Commit Message

Diego Novillo May 30, 2011, 8:06 p.m. UTC
This patch updates the streaming of these two structures to
reflect changes in trunk.

Tested and submitted together with the latest merge.


Diego.


 	ALLOC_AND_REGISTER.
 	(pph_stream_read_label_binding): Likewise.
 	(pph_stream_read_class_binding): Likewise.
 	Do not memcpy into cb->base.  Assign to it directly.
 	(pph_stream_read_c_language_function): Call
 	pph_stream_read_tree_vec instead of pph_input_tree.
 	* pph-streamer-out.c (pph_stream_write_class_binding): Do not
 	write &cb->base.  Write cb->base.
 	(pph_stream_write_c_language_function): Call
 	pph_stream_write_tree_vec instead of pph_output_tree_or_ref.

---
 gcc/cp/ChangeLog.pph      |   14 ++++++++++++++
 gcc/cp/pph-streamer-in.c  |   21 ++++++---------------
 gcc/cp/pph-streamer-out.c |    4 ++--
 3 files changed, 22 insertions(+), 17 deletions(-)
diff mbox

Patch

diff --git a/gcc/cp/ChangeLog.pph b/gcc/cp/ChangeLog.pph
index 0331089..05db431 100644
--- a/gcc/cp/ChangeLog.pph
+++ b/gcc/cp/ChangeLog.pph
@@ -1,3 +1,17 @@ 
+2011-05-30  Diego Novillo  <dnovillo@google.com>
+
+	* pph-streamer-in.c (pph_stream_read_cxx_binding_1): Call
+	ALLOC_AND_REGISTER.
+	(pph_stream_read_label_binding): Likewise.
+	(pph_stream_read_class_binding): Likewise.
+	Do not memcpy into cb->base.  Assign to it directly.
+	(pph_stream_read_c_language_function): Call
+	pph_stream_read_tree_vec instead of pph_input_tree.
+	* pph-streamer-out.c (pph_stream_write_class_binding): Do not
+	write &cb->base.  Write cb->base.
+	(pph_stream_write_c_language_function): Call
+	pph_stream_write_tree_vec instead of pph_output_tree_or_ref.
+
 2011-05-27  Lawrence Crowl  <crowl@google.com>
 
 	* cp-objcp-common.c (cp_tree_size): Remove case TREE_BINFO.
diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index d9b9f1d..b6f7da7 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -338,14 +338,12 @@  pph_stream_read_cxx_binding_1 (pph_stream *stream)
 
   value = pph_input_tree (stream);
   type = pph_input_tree (stream);
-  cb = cxx_binding_make (value, type);
+  ALLOC_AND_REGISTER (stream, ix, cb, cxx_binding_make (value, type));
   cb->scope = pph_stream_read_binding_level (stream);
   bp = pph_input_bitpack (stream);
   cb->value_is_inherited = bp_unpack_value (&bp, 1);
   cb->is_local = bp_unpack_value (&bp, 1);
 
-  pph_stream_register_shared_data (stream, cb, ix);
-
   return cb;
 }
 
@@ -368,9 +366,7 @@  pph_stream_read_cxx_binding (pph_stream *stream)
       curr = prev;
     }
 
-  /* Read the current binding at the end.  Note that we do not need
-     to call pph_stream_register_shared_data as it is already done
-     by pph_stream_read_cxx_binding_1.  */
+  /* Read the current binding at the end.  */
   cb = pph_stream_read_cxx_binding_1 (stream);
   if (cb)
     cb->previous = curr;
@@ -394,13 +390,10 @@  pph_stream_read_class_binding (pph_stream *stream)
   else if (marker == PPH_RECORD_SHARED)
     return (cp_class_binding *) pph_stream_read_shared_data (stream, ix);
 
-  cb = ggc_alloc_cleared_cp_class_binding ();
-  memcpy (&cb->base, pph_stream_read_cxx_binding (stream),
-	  sizeof (cxx_binding));
+  ALLOC_AND_REGISTER (stream, ix, cb, ggc_alloc_cleared_cp_class_binding ());
+  cb->base = pph_stream_read_cxx_binding (stream);
   cb->identifier = pph_input_tree (stream);
 
-  pph_stream_register_shared_data (stream, cb, ix);
-
   return cb;
 }
 
@@ -420,12 +413,10 @@  pph_stream_read_label_binding (pph_stream *stream)
   else if (marker == PPH_RECORD_SHARED)
     return (cp_label_binding *) pph_stream_read_shared_data (stream, ix);
 
-  lb = ggc_alloc_cleared_cp_label_binding ();
+  ALLOC_AND_REGISTER (stream, ix, lb, ggc_alloc_cleared_cp_label_binding ());
   lb->label = pph_input_tree (stream);
   lb->prev_value = pph_input_tree (stream);
 
-  pph_stream_register_shared_data (stream, lb, ix);
-
   return lb;
 }
 
@@ -511,7 +502,7 @@  pph_stream_read_c_language_function (pph_stream *stream)
 
   ALLOC_AND_REGISTER (stream, ix, clf,
 		      ggc_alloc_cleared_c_language_function ());
-  clf->x_stmt_tree.x_cur_stmt_list = pph_input_tree (stream);
+  clf->x_stmt_tree.x_cur_stmt_list = pph_stream_read_tree_vec (stream);
   clf->x_stmt_tree.stmts_are_full_exprs_p = pph_input_uint (stream);
 
   return clf;
diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c
index a5a8dec..77d5ec0 100644
--- a/gcc/cp/pph-streamer-out.c
+++ b/gcc/cp/pph-streamer-out.c
@@ -367,7 +367,7 @@  pph_stream_write_class_binding (pph_stream *stream, cp_class_binding *cb,
   if (!pph_start_record (stream, cb))
     return;
 
-  pph_stream_write_cxx_binding (stream, &cb->base, ref_p);
+  pph_stream_write_cxx_binding (stream, cb->base, ref_p);
   pph_output_tree_or_ref (stream, cb->identifier, ref_p);
 }
 
@@ -497,7 +497,7 @@  pph_stream_write_c_language_function (pph_stream *stream,
   if (!pph_start_record (stream, clf))
     return;
 
-  pph_output_tree_or_ref (stream, clf->x_stmt_tree.x_cur_stmt_list, ref_p);
+  pph_stream_write_tree_vec (stream, clf->x_stmt_tree.x_cur_stmt_list, ref_p);
   pph_output_uint (stream, clf->x_stmt_tree.stmts_are_full_exprs_p);
 }