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]

PATCH: Remove ggc_{push,pop}_context


This patch removes the declarations and definitions of
ggc_push_context and ggc_pop_context, to avoid any future use, as per
earlier discussion on this list.

Tested on x86_64-unknown-linux-gnu, applied on the mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-09-06  Mark Mitchell  <mark@codesourcery.com>

	* ggc-page.c (ggc_push_context): Remove.
	(ggc_pop_context): Likewise.
	* ggc.h (ggc_push_context): Remove.
	(ggc_pop_context): Likewise.

Index: ggc-page.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ggc-page.c,v
retrieving revision 1.104
diff -c -5 -p -r1.104 ggc-page.c
*** ggc-page.c	8 Jul 2005 23:36:40 -0000	1.104
--- ggc-page.c	7 Sep 2005 03:45:59 -0000
*************** new_ggc_zone (const char *name ATTRIBUTE
*** 1538,1559 ****
  void
  destroy_ggc_zone (struct alloc_zone *zone ATTRIBUTE_UNUSED)
  {
  }
  
- /* Increment the `GC context'.  Objects allocated in an outer context
-    are never freed, eliminating the need to register their roots.  */
- 
- void
- ggc_push_context (void)
- {
-   ++G.context_depth;
- 
-   /* Die on wrap.  */
-   gcc_assert (G.context_depth < HOST_BITS_PER_LONG);
- }
- 
  /* Merge the SAVE_IN_USE_P and IN_USE_P arrays in P so that IN_USE_P
     reflects reality.  Recalculate NUM_FREE_OBJECTS as well.  */
  
  static void
  ggc_recalculate_in_use_p (page_entry *p)
--- 1538,1547 ----
*************** ggc_recalculate_in_use_p (page_entry *p)
*** 1585,1677 ****
  	p->num_free_objects -= (j & 1);
      }
  
    gcc_assert (p->num_free_objects < num_objects);
  }
- 
- /* Decrement the `GC context'.  All objects allocated since the
-    previous ggc_push_context are migrated to the outer context.  */
- 
- void
- ggc_pop_context (void)
- {
-   unsigned long omask;
-   unsigned int depth, i, e;
- #ifdef ENABLE_CHECKING
-   unsigned int order;
- #endif
- 
-   depth = --G.context_depth;
-   omask = (unsigned long)1 << (depth + 1);
- 
-   if (!((G.context_depth_allocations | G.context_depth_collections) & omask))
-     return;
- 
-   G.context_depth_allocations |= (G.context_depth_allocations & omask) >> 1;
-   G.context_depth_allocations &= omask - 1;
-   G.context_depth_collections &= omask - 1;
- 
-   /* The G.depth array is shortened so that the last index is the
-      context_depth of the top element of by_depth.  */
-   if (depth+1 < G.depth_in_use)
-     e = G.depth[depth+1];
-   else
-     e = G.by_depth_in_use;
- 
-   /* We might not have any PTEs of depth depth.  */
-   if (depth < G.depth_in_use)
-     {
- 
-       /* First we go through all the pages at depth depth to
- 	 recalculate the in use bits.  */
-       for (i = G.depth[depth]; i < e; ++i)
- 	{
- 	  page_entry *p = G.by_depth[i];
- 
- 	  /* Check that all of the pages really are at the depth that
- 	     we expect.  */
- 	  gcc_assert (p->context_depth == depth);
- 	  gcc_assert (p->index_by_depth == i);
- 
- 	  prefetch (&save_in_use_p_i (i+8));
- 	  prefetch (&save_in_use_p_i (i+16));
- 	  if (save_in_use_p_i (i))
- 	    {
- 	      p = G.by_depth[i];
- 	      ggc_recalculate_in_use_p (p);
- 	      free (save_in_use_p_i (i));
- 	      save_in_use_p_i (i) = 0;
- 	    }
- 	}
-     }
- 
-   /* Then, we reset all page_entries with a depth greater than depth
-      to be at depth.  */
-   for (i = e; i < G.by_depth_in_use; ++i)
-     {
-       page_entry *p = G.by_depth[i];
- 
-       /* Check that all of the pages really are at the depth we
- 	 expect.  */
-       gcc_assert (p->context_depth > depth);
-       gcc_assert (p->index_by_depth == i);
-       p->context_depth = depth;
-     }
- 
-   adjust_depth ();
- 
- #ifdef ENABLE_CHECKING
-   for (order = 2; order < NUM_ORDERS; order++)
-     {
-       page_entry *p;
- 
-       for (p = G.pages[order]; p != NULL; p = p->next)
- 	gcc_assert (p->context_depth < depth ||
- 		    (p->context_depth == depth && !save_in_use_p (p)));
-     }
- #endif
- }
  
  /* Unmark all objects.  */
  
  static void
  clear_marks (void)
--- 1573,1582 ----
Index: ggc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ggc.h,v
retrieving revision 1.73
diff -c -5 -p -r1.73 ggc.h
*** ggc.h	25 Jun 2005 02:00:19 -0000	1.73
--- ggc.h	7 Sep 2005 03:45:59 -0000
*************** extern void init_ggc (void);
*** 153,170 ****
  extern struct alloc_zone *new_ggc_zone (const char *);
  
  /* Free a complete GGC zone, destroying everything in it.  */
  extern void destroy_ggc_zone (struct alloc_zone *);
  
- /* Start a new GGC context.  Memory allocated in previous contexts
-    will not be collected while the new context is active.  */
- extern void ggc_push_context (void);
- 
- /* Finish a GC context.  Any uncollected memory in the new context
-    will be merged with the old context.  */
- extern void ggc_pop_context (void);
- 
  struct ggc_pch_data;
  
  /* Return a new ggc_pch_data structure.  */
  extern struct ggc_pch_data *init_ggc_pch (void);
  
--- 153,162 ----


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