public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Zone allocator fixes
@ 2004-07-26 22:06 Daniel Jacobowitz
  2004-07-26 22:24 ` Daniel Berlin
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Jacobowitz @ 2004-07-26 22:06 UTC (permalink / raw)
  To: gcc-patches

This patch fixes bootstrap using --with-gc=zone on amd64.  I haven't tried a
gcac build, but it does work both with and without GC checking.

Summary:
  - Don't pack alloc_chunk, so that the returned memory is eight-byte
    aligned on 64-bit targets.  There may be something clever we
    can do with the extra four bytes of padding per object...

  - Make sure that FREE_BIN_DELTA is not smaller than a pointer.

  - Disable ggc_free; we'll have to change the list representation before we
    can free large pages.  They remain in the page list after being freed
    at present.

  - Fix a linked list management botch.

OK?

-- 
Daniel Jacobowitz

2004-07-26  Daniel Jacobowitz  <dan@codesourcery.com>

	PR bootstrap/12804
	* ggc-zone.c (struct alloc_chunk): Remove attribute packed.
	(MAX_FREE_BIN_SIZE): Increase on 64-bit targets.
	(ggc_free): Remove incorrect freeing.
	(sweep_pages): Advance PP for large pages.  Fix indentation.

Index: gcc/ggc-zone.c
===================================================================
RCS file: /home/drow/rsync/gcc-cvs/gcc/gcc/ggc-zone.c,v
retrieving revision 2.16
diff -u -p -r2.16 ggc-zone.c
--- gcc/ggc-zone.c	4 May 2004 08:20:31 -0000	2.16
+++ gcc/ggc-zone.c	26 Jul 2004 03:06:12 -0000
@@ -162,7 +162,7 @@ struct alloc_chunk {
     double align_d;
 #endif
   } u;
-} __attribute__ ((packed));
+};
 
 #define CHUNK_OVERHEAD	(offsetof (struct alloc_chunk, u))
 
@@ -177,7 +177,7 @@ struct alloc_chunk {
    on a PowerPC G4 7450 - 667 mhz, and a Pentium 4 - 2.8ghz,
    these were determined to be the optimal values.  */
 #define NUM_FREE_BINS		64
-#define MAX_FREE_BIN_SIZE	256
+#define MAX_FREE_BIN_SIZE	(64 * sizeof (void *))
 #define FREE_BIN_DELTA		(MAX_FREE_BIN_SIZE / NUM_FREE_BINS)
 #define SIZE_BIN_UP(SIZE)	(((SIZE) + FREE_BIN_DELTA - 1) / FREE_BIN_DELTA)
 #define SIZE_BIN_DOWN(SIZE)	((SIZE) / FREE_BIN_DELTA)
@@ -761,10 +761,6 @@ ggc_free (void *p)
   
   /* Poison the chunk.  */
   poison_chunk (chunk, ggc_get_size (p));
-
-  /* XXX: We only deal with explicitly freeing large objects ATM.  */
-  if (chunk->large)
-    free (p);
 }
 
 /* If P is not marked, mark it and return false.  Otherwise return true.
@@ -990,13 +986,14 @@ sweep_pages (struct alloc_zone *zone)
 	  if (((struct alloc_chunk *)p->page)->mark == 1)
 	    {
 	      ((struct alloc_chunk *)p->page)->mark = 0;
+	      pp = &p->next;
 	    }
 	  else
 	    {
 	      *pp = next;
 #ifdef ENABLE_GC_CHECKING
-	  /* Poison the page.  */
-	  memset (p->page, 0xb5, p->bytes);
+	      /* Poison the page.  */
+	      memset (p->page, 0xb5, p->bytes);
 #endif
 	      free_page (p);
 	    }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Zone allocator fixes
  2004-07-26 22:06 Zone allocator fixes Daniel Jacobowitz
@ 2004-07-26 22:24 ` Daniel Berlin
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Berlin @ 2004-07-26 22:24 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gcc-patches


On Jul 26, 2004, at 10:12 AM, Daniel Jacobowitz wrote:

> This patch fixes bootstrap using --with-gc=zone on amd64.  I haven't 
> tried a
> gcac build, but it does work both with and without GC checking.
>
> Summary:
>   - Don't pack alloc_chunk, so that the returned memory is eight-byte
>     aligned on 64-bit targets.  There may be something clever we
>     can do with the extra four bytes of padding per object...
>
>   - Make sure that FREE_BIN_DELTA is not smaller than a pointer.
>
>   - Disable ggc_free; we'll have to change the list representation 
> before we
>     can free large pages.  They remain in the page list after being 
> freed
>     at present.
>
>   - Fix a linked list management botch.
>
> OK?
>

Okay.
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-26 14:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-26 22:06 Zone allocator fixes Daniel Jacobowitz
2004-07-26 22:24 ` Daniel Berlin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).