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]

Move more stuff into GC memory


This moves struct function, struct temp_slot, and struct var_refs_queue
into GC memory.  When practical it's more efficient to use that memory and
it's also a good idea to have anything that might be pointed to by
somehting else (e.g., the first two) in GC memory for simplicity.

Tested on alphaev56.

Sun Sep 23 18:19:48 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* function.c (pop_function_context_from): var_refs_queue
	and temp slots now in GC memory.
	(mark_function_status, free_after_compilation): Likewise;
	also struct function now in GC memory.
	(assign_stack_temp_for_type): struct temp_slot now in GC memory.
	(combine_temp_slots): Likewise.
	(schedule_fixup_var_refs): var_refs_queue now in GC memory.
	(prepare_function_start): Use GC memory for struct function.
	(mark_temp_slot): Deleted.
	(gcc_mark_struct_function): struct function now in GC memory.

*** function.c	2001/09/22 13:27:33	1.308
--- function.c	2001/09/23 16:51:23
*************** static bool insns_for_mem_comp PARAMS ((
*** 301,305 ****
  static int insns_for_mem_walk   PARAMS ((rtx *, void *));
  static void compute_insns_for_mem PARAMS ((rtx, rtx, struct hash_table *));
- static void mark_temp_slot PARAMS ((struct temp_slot *));
  static void mark_function_status PARAMS ((struct function *));
  static void maybe_mark_struct_function PARAMS ((void *));
--- 302,305 ----
*************** pop_function_context_from (context)
*** 379,383 ****
    struct function *p = outer_function_chain;
    struct var_refs_queue *queue;
-   struct var_refs_queue *next;
  
    cfun = p;
--- 379,382 ----
*************** pop_function_context_from (context)
*** 394,404 ****
    /* Finish doing put_var_into_stack for any of our variables
       which became addressable during the nested function.  */
!   for (queue = p->fixup_var_refs_queue; queue; queue = next)
!     {
!       next = queue->next;
!       fixup_var_refs (queue->modified, queue->promoted_mode,
! 		      queue->unsignedp, 0);
!       free (queue);
!     }
    p->fixup_var_refs_queue = 0;
  
--- 393,400 ----
    /* Finish doing put_var_into_stack for any of our variables
       which became addressable during the nested function.  */
!   for (queue = p->fixup_var_refs_queue; queue; queue = queue->next)
!     fixup_var_refs (queue->modified, queue->promoted_mode,
! 		    queue->unsignedp, 0);
! 
    p->fixup_var_refs_queue = 0;
  
*************** free_after_compilation (f)
*** 441,447 ****
       struct function *f;
  {
-   struct temp_slot *ts;
-   struct temp_slot *next;
- 
    free_eh_status (f);
    free_expr_status (f);
--- 437,440 ----
*************** free_after_compilation (f)
*** 455,465 ****
      free (f->x_parm_reg_stack_loc);
  
-   for (ts = f->x_temp_slots; ts; ts = next)
-     {
-       next = ts->next;
-       free (ts);
-     }
    f->x_temp_slots = NULL;
- 
    f->arg_offset_rtx = NULL;
    f->return_rtx = NULL;
--- 448,452 ----
*************** free_after_compilation (f)
*** 488,493 ****
    f->inl_last_parm_insn = NULL;
    f->epilogue_delay_list = NULL;
- 
-   free (f);
  }
  
--- 475,478 ----
*************** assign_stack_temp_for_type (mode, size, 
*** 702,706 ****
  	  if (best_p->size - rounded_size >= alignment)
  	    {
! 	      p = (struct temp_slot *) xmalloc (sizeof (struct temp_slot));
  	      p->in_use = p->addr_taken = 0;
  	      p->size = best_p->size - rounded_size;
--- 687,691 ----
  	  if (best_p->size - rounded_size >= alignment)
  	    {
! 	      p = (struct temp_slot *) ggc_alloc (sizeof (struct temp_slot));
  	      p->in_use = p->addr_taken = 0;
  	      p->size = best_p->size - rounded_size;
*************** assign_stack_temp_for_type (mode, size, 
*** 733,737 ****
        HOST_WIDE_INT frame_offset_old = frame_offset;
  
!       p = (struct temp_slot *) xmalloc (sizeof (struct temp_slot));
  
        /* We are passing an explicit alignment request to assign_stack_local.
--- 718,722 ----
        HOST_WIDE_INT frame_offset_old = frame_offset;
  
!       p = (struct temp_slot *) ggc_alloc (sizeof (struct temp_slot));
  
        /* We are passing an explicit alignment request to assign_stack_local.
*************** combine_temp_slots ()
*** 937,944 ****
  	    /* Either delete Q or advance past it.  */
  	    if (delete_q)
! 	      {
! 		prev_q->next = q->next;
! 		free (q);
! 	      }
  	    else
  	      prev_q = q;
--- 922,926 ----
  	    /* Either delete Q or advance past it.  */
  	    if (delete_q)
! 	      prev_q->next = q->next;
  	    else
  	      prev_q = q;
*************** schedule_fixup_var_refs (function, reg, 
*** 1532,1536 ****
  
        temp
! 	= (struct var_refs_queue *) xmalloc (sizeof (struct var_refs_queue));
        temp->modified = reg;
        temp->promoted_mode = promoted_mode;
--- 1514,1518 ----
  
        temp
! 	= (struct var_refs_queue *) ggc_alloc (sizeof (struct var_refs_queue));
        temp->modified = reg;
        temp->promoted_mode = promoted_mode;
*************** number_blocks (fn)
*** 6080,6087 ****
  
  /* Allocate a function structure and reset its contents to the defaults.  */
  static void
  prepare_function_start ()
  {
!   cfun = (struct function *) xcalloc (1, sizeof (struct function));
  
    init_stmt_for_function ();
--- 6065,6073 ----
  
  /* Allocate a function structure and reset its contents to the defaults.  */
+ 
  static void
  prepare_function_start ()
  {
!   cfun = (struct function *) ggc_alloc_cleared (sizeof (struct function));
  
    init_stmt_for_function ();
*************** reposition_prologue_and_epilogue_notes (
*** 7584,7604 ****
  }
  
- /* Mark T for GC.  */
- 
- static void
- mark_temp_slot (t)
-      struct temp_slot *t;
- {
-   while (t)
-     {
-       ggc_mark_rtx (t->slot);
-       ggc_mark_rtx (t->address);
-       ggc_mark_tree (t->rtl_expr);
-       ggc_mark_tree (t->type);
- 
-       t = t->next;
-     }
- }
- 
  /* Mark P for GC.  */
  
--- 7570,7573 ----
*************** mark_function_status (p)
*** 7607,7610 ****
--- 7576,7581 ----
       struct function *p;
  {
+   struct var_refs_queue *q;
+   struct temp_slot *t;
    int i;
    rtx *r;
*************** mark_function_status (p)
*** 7637,7650 ****
    ggc_mark_rtx (p->x_clobber_return_insn);
  
!   mark_temp_slot (p->x_temp_slots);
  
!   {
!     struct var_refs_queue *q = p->fixup_var_refs_queue;
!     while (q)
!       {
! 	ggc_mark_rtx (q->modified);
! 	q = q->next;
        }
-   }
  
    ggc_mark_rtx (p->x_nonlocal_goto_handler_slots);
--- 7608,7625 ----
    ggc_mark_rtx (p->x_clobber_return_insn);
  
!   for (t = p->x_temp_slots; t != 0; t = t->next)
!     {
!       ggc_mark (t);
!       ggc_mark_rtx (t->slot);
!       ggc_mark_rtx (t->address);
!       ggc_mark_tree (t->rtl_expr);
!       ggc_mark_tree (t->type);
!     }
  
!   for (q = p->fixup_var_refs_queue; q != 0; q = q->next)
!     {
!       ggc_mark (q);
!       ggc_mark_rtx (q->modified);
        }
  
    ggc_mark_rtx (p->x_nonlocal_goto_handler_slots);
*************** maybe_mark_struct_function (arg)
*** 7672,7679 ****
--- 7648,7657 ----
  
  /* Mark a struct function * for GC.  This is called from ggc-common.c.  */
+ 
  void
  ggc_mark_struct_function (f)
       struct function *f;
  {
+   ggc_mark (f);
    ggc_mark_tree (f->decl);
  


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