diff mbox series

Do not stream unnecessary BINFO fields

Message ID 20180621131253.GF84841@kam.mff.cuni.cz
State New
Headers show
Series Do not stream unnecessary BINFO fields | expand

Commit Message

Jan Hubicka June 21, 2018, 1:12 p.m. UTC
Hi,
this patch drops streaming of binfo bits we do not need.  We only care
about BINFO_TYPE, BINFO_VTABLE, BASES and BINFO_OFFSET.

Bootstrapped/regtested x86_64-linux, OK?

Honza

	* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream
	BINFO_BASE_ACCESSES and BINFO_VPTR_FIELD.
	* tree-streamer-in.c (streamer_read_tree_bitfields): Likewise.
	(lto_input_ts_binfo_tree_pointers): Likewise.
	* tree-streamer-out.c (streamer_write_tree_bitfields,
	write_ts_binfo_tree_pointers): Likewise.
	* tree.c (free_lang_data_in_binfo): Clear BINFO_VPTR_FIELD.

Comments

Richard Biener June 21, 2018, 1:36 p.m. UTC | #1
On Thu, 21 Jun 2018, Jan Hubicka wrote:

> Hi,
> this patch drops streaming of binfo bits we do not need.  We only care
> about BINFO_TYPE, BINFO_VTABLE, BASES and BINFO_OFFSET.
> 
> Bootstrapped/regtested x86_64-linux, OK?

OK.

Richard.

> Honza
> 
> 	* lto-streamer-out.c (DFS::DFS_write_tree_body): Do not stream
> 	BINFO_BASE_ACCESSES and BINFO_VPTR_FIELD.
> 	* tree-streamer-in.c (streamer_read_tree_bitfields): Likewise.
> 	(lto_input_ts_binfo_tree_pointers): Likewise.
> 	* tree-streamer-out.c (streamer_write_tree_bitfields,
> 	write_ts_binfo_tree_pointers): Likewise.
> 	* tree.c (free_lang_data_in_binfo): Clear BINFO_VPTR_FIELD.
> Index: lto-streamer-out.c
> ===================================================================
> --- lto-streamer-out.c	(revision 261841)
> +++ lto-streamer-out.c	(working copy)
> @@ -954,15 +947,10 @@ DFS::DFS_write_tree_body (struct output_
>  	DFS_follow_tree_edge (t);
>        DFS_follow_tree_edge (BINFO_OFFSET (expr));
>        DFS_follow_tree_edge (BINFO_VTABLE (expr));
> -      DFS_follow_tree_edge (BINFO_VPTR_FIELD (expr));
> -
> -      /* The number of BINFO_BASE_ACCESSES has already been emitted in
> -	 EXPR's bitfield section.  */
> -      FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_ACCESSES (expr), i, t)
> -	DFS_follow_tree_edge (t);
>  
> -      /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
> -	 and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
> +      /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX,
> +	 BINFO_BASE_ACCESSES and BINFO_VPTR_INDEX; these are used
> +	 by C++ FE only.  */
>      }
>  
>    if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
> @@ -1347,11 +1329,9 @@ hash_tree (struct streamer_tree_cache_d
>  	visit (b);
>        visit (BINFO_OFFSET (t));
>        visit (BINFO_VTABLE (t));
> -      visit (BINFO_VPTR_FIELD (t));
> -      FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_ACCESSES (t), i, b)
> -	visit (b);
>        /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
> -	 and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
> +	 BINFO_BASE_ACCESSES and BINFO_VPTR_INDEX; these are used
> +	 by C++ FE only.  */
>      }
>  
>    if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
> Index: tree-streamer-in.c
> ===================================================================
> --- tree-streamer-in.c	(revision 261841)
> +++ tree-streamer-in.c	(working copy)
> @@ -532,13 +532,6 @@ streamer_read_tree_bitfields (struct lto
>    if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
>      cl_optimization_stream_in (&bp, TREE_OPTIMIZATION (expr));
>  
> -  if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
> -    {
> -      unsigned HOST_WIDE_INT length = bp_unpack_var_len_unsigned (&bp);
> -      if (length > 0)
> -	vec_safe_grow (BINFO_BASE_ACCESSES (expr), length);
> -    }
> -
>    if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
>      {
>        unsigned HOST_WIDE_INT length = bp_unpack_var_len_unsigned (&bp);
> @@ -969,7 +960,6 @@ static void
>  lto_input_ts_binfo_tree_pointers (struct lto_input_block *ib,
>  				  struct data_in *data_in, tree expr)
>  {
> -  unsigned i;
>    tree t;
>  
>    /* Note that the number of slots in EXPR was read in
> @@ -987,17 +977,10 @@ lto_input_ts_binfo_tree_pointers (struct
>  
>    BINFO_OFFSET (expr) = stream_read_tree (ib, data_in);
>    BINFO_VTABLE (expr) = stream_read_tree (ib, data_in);
> -  BINFO_VPTR_FIELD (expr) = stream_read_tree (ib, data_in);
>  
> -  /* The vector of BINFO_BASE_ACCESSES is pre-allocated during
> -     unpacking the bitfield section.  */
> -  for (i = 0; i < vec_safe_length (BINFO_BASE_ACCESSES (expr)); i++)
> -    {
> -      tree a = stream_read_tree (ib, data_in);
> -      (*BINFO_BASE_ACCESSES (expr))[i] = a;
> -    }
> -  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
> -     and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
> +  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX,
> +     BINFO_BASE_ACCESSES and BINFO_VPTR_INDEX; these are used by C++ FE
> +     only.  */
>  }
>  
>  
> Index: tree-streamer-out.c
> ===================================================================
> --- tree-streamer-out.c	(revision 261841)
> +++ tree-streamer-out.c	(working copy)
> @@ -468,9 +468,6 @@ streamer_write_tree_bitfields (struct ou
>    if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
>      cl_optimization_stream_out (&bp, TREE_OPTIMIZATION (expr));
>  
> -  if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
> -    bp_pack_var_len_unsigned (&bp, vec_safe_length (BINFO_BASE_ACCESSES (expr)));
> -
>    if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
>      bp_pack_var_len_unsigned (&bp, CONSTRUCTOR_NELTS (expr));
>  
> @@ -824,15 +814,9 @@ write_ts_binfo_tree_pointers (struct out
>  
>    stream_write_tree (ob, BINFO_OFFSET (expr), ref_p);
>    stream_write_tree (ob, BINFO_VTABLE (expr), ref_p);
> -  stream_write_tree (ob, BINFO_VPTR_FIELD (expr), ref_p);
> -
> -  /* The number of BINFO_BASE_ACCESSES has already been emitted in
> -     EXPR's bitfield section.  */
> -  FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_ACCESSES (expr), i, t)
> -    stream_write_tree (ob, t, ref_p);
>  
> -  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
> -     and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
> +  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX,
> +     BINFO_BASE_ACCESSES and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
>  }
>  
>  
> Index: tree.c
> ===================================================================
> --- tree.c	(revision 261841)
> +++ tree.c	(working copy)
> @@ -5073,6 +5073,7 @@ free_lang_data_in_binfo (tree binfo)
>    BINFO_BASE_ACCESSES (binfo) = NULL;
>    BINFO_INHERITANCE_CHAIN (binfo) = NULL_TREE;
>    BINFO_SUBVTT_INDEX (binfo) = NULL_TREE;
> +  BINFO_VPTR_FIELD (binfo) = NULL_TREE;
>  
>    FOR_EACH_VEC_ELT (*BINFO_BASE_BINFOS (binfo), i, t)
>      free_lang_data_in_binfo (t);
> 
>
diff mbox series

Patch

Index: lto-streamer-out.c
===================================================================
--- lto-streamer-out.c	(revision 261841)
+++ lto-streamer-out.c	(working copy)
@@ -954,15 +947,10 @@  DFS::DFS_write_tree_body (struct output_
 	DFS_follow_tree_edge (t);
       DFS_follow_tree_edge (BINFO_OFFSET (expr));
       DFS_follow_tree_edge (BINFO_VTABLE (expr));
-      DFS_follow_tree_edge (BINFO_VPTR_FIELD (expr));
-
-      /* The number of BINFO_BASE_ACCESSES has already been emitted in
-	 EXPR's bitfield section.  */
-      FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_ACCESSES (expr), i, t)
-	DFS_follow_tree_edge (t);
 
-      /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
-	 and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
+      /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX,
+	 BINFO_BASE_ACCESSES and BINFO_VPTR_INDEX; these are used
+	 by C++ FE only.  */
     }
 
   if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
@@ -1347,11 +1329,9 @@  hash_tree (struct streamer_tree_cache_d
 	visit (b);
       visit (BINFO_OFFSET (t));
       visit (BINFO_VTABLE (t));
-      visit (BINFO_VPTR_FIELD (t));
-      FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_ACCESSES (t), i, b)
-	visit (b);
       /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
-	 and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
+	 BINFO_BASE_ACCESSES and BINFO_VPTR_INDEX; these are used
+	 by C++ FE only.  */
     }
 
   if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
Index: tree-streamer-in.c
===================================================================
--- tree-streamer-in.c	(revision 261841)
+++ tree-streamer-in.c	(working copy)
@@ -532,13 +532,6 @@  streamer_read_tree_bitfields (struct lto
   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
     cl_optimization_stream_in (&bp, TREE_OPTIMIZATION (expr));
 
-  if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
-    {
-      unsigned HOST_WIDE_INT length = bp_unpack_var_len_unsigned (&bp);
-      if (length > 0)
-	vec_safe_grow (BINFO_BASE_ACCESSES (expr), length);
-    }
-
   if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
     {
       unsigned HOST_WIDE_INT length = bp_unpack_var_len_unsigned (&bp);
@@ -969,7 +960,6 @@  static void
 lto_input_ts_binfo_tree_pointers (struct lto_input_block *ib,
 				  struct data_in *data_in, tree expr)
 {
-  unsigned i;
   tree t;
 
   /* Note that the number of slots in EXPR was read in
@@ -987,17 +977,10 @@  lto_input_ts_binfo_tree_pointers (struct
 
   BINFO_OFFSET (expr) = stream_read_tree (ib, data_in);
   BINFO_VTABLE (expr) = stream_read_tree (ib, data_in);
-  BINFO_VPTR_FIELD (expr) = stream_read_tree (ib, data_in);
 
-  /* The vector of BINFO_BASE_ACCESSES is pre-allocated during
-     unpacking the bitfield section.  */
-  for (i = 0; i < vec_safe_length (BINFO_BASE_ACCESSES (expr)); i++)
-    {
-      tree a = stream_read_tree (ib, data_in);
-      (*BINFO_BASE_ACCESSES (expr))[i] = a;
-    }
-  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
-     and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
+  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX,
+     BINFO_BASE_ACCESSES and BINFO_VPTR_INDEX; these are used by C++ FE
+     only.  */
 }
 
 
Index: tree-streamer-out.c
===================================================================
--- tree-streamer-out.c	(revision 261841)
+++ tree-streamer-out.c	(working copy)
@@ -468,9 +468,6 @@  streamer_write_tree_bitfields (struct ou
   if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
     cl_optimization_stream_out (&bp, TREE_OPTIMIZATION (expr));
 
-  if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
-    bp_pack_var_len_unsigned (&bp, vec_safe_length (BINFO_BASE_ACCESSES (expr)));
-
   if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
     bp_pack_var_len_unsigned (&bp, CONSTRUCTOR_NELTS (expr));
 
@@ -824,15 +814,9 @@  write_ts_binfo_tree_pointers (struct out
 
   stream_write_tree (ob, BINFO_OFFSET (expr), ref_p);
   stream_write_tree (ob, BINFO_VTABLE (expr), ref_p);
-  stream_write_tree (ob, BINFO_VPTR_FIELD (expr), ref_p);
-
-  /* The number of BINFO_BASE_ACCESSES has already been emitted in
-     EXPR's bitfield section.  */
-  FOR_EACH_VEC_SAFE_ELT (BINFO_BASE_ACCESSES (expr), i, t)
-    stream_write_tree (ob, t, ref_p);
 
-  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX
-     and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
+  /* Do not walk BINFO_INHERITANCE_CHAIN, BINFO_SUBVTT_INDEX,
+     BINFO_BASE_ACCESSES and BINFO_VPTR_INDEX; these are used by C++ FE only.  */
 }
 
 
Index: tree.c
===================================================================
--- tree.c	(revision 261841)
+++ tree.c	(working copy)
@@ -5073,6 +5073,7 @@  free_lang_data_in_binfo (tree binfo)
   BINFO_BASE_ACCESSES (binfo) = NULL;
   BINFO_INHERITANCE_CHAIN (binfo) = NULL_TREE;
   BINFO_SUBVTT_INDEX (binfo) = NULL_TREE;
+  BINFO_VPTR_FIELD (binfo) = NULL_TREE;
 
   FOR_EACH_VEC_ELT (*BINFO_BASE_BINFOS (binfo), i, t)
     free_lang_data_in_binfo (t);