endless loop in compute_inverse bootstrapping on alpha
Zack Weinberg
zack@codesourcery.com
Fri Aug 23 10:24:00 GMT 2002
On Fri, Aug 23, 2002 at 05:39:11PM +0200, Ritzert@t-online.de wrote:
> > Breakpoint 6, compute_inverse (order=32)
> > at
> > /home/ritzert/nfs/compile/gcc/HEAD/gcc/gcc/ggc-page.c:1084
> > 1084 e = 0;
> > 1: size = 0
> >
> > Here obviously size % 2 == 0 will always be true.
>
> This keeps bugging me...
> I went on with debugging and much to my surprise found:
> (gdb) p object_size_table
> $8 = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192,
> 16384,
...
> With OBJECT_SIZE defined as a lookup in that table, OBJECT_SIZE(32)
> should definitively by non-zero. Maybe it should be defined as size_t
> as is object_size_table (untested patch follows)? On alpha
> sizeof(unsigned)==4 while sizeof(size_t)==8.
Yes, OBJECT_SIZE(32) should definitely be nonzero.
Simply changing the local 'size' and 'inv' variables in
compute_inverse to size_t won't work in general; you're still storing
back to a 32-bit field in the inverse_table, which means the
multiplier will get truncated and won't work properly. You luck out
because all the page orders of size >= 2^32 are powers of two, which
means inverse_table[order].mult will come out 1 for all of them (all
the work is done by inverse_table[order].shift, which can only go as
high as 64).
As an immediate fix, I would suggest instead the appended patch, which
takes advantage of the fact that there can only be one object in a
page bigger than G.page_size. As a longer term fix, I want to get rid
of most of the high orders -- all they do is waste memory, in the
extremely rare case that we allocate an object that large -- I have
statistics that say GCC basically never allocates an object bigger
than 64 words (256 bytes on a 32-bit system, 512 bytes on a 64-bit
system) with the garbage collector.
I've done stage1 on my 32-bit system; please test this on one of your
64-bit systems; I don't have immediate access to one.
zw
* ggc-page.c (compute_inverse): Short circuit calculation for
object sizes larger than half a page.
===================================================================
Index: ggc-page.c
--- ggc-page.c 22 Aug 2002 19:17:04 -0000 1.53
+++ ggc-page.c 23 Aug 2002 17:23:06 -0000
@@ -1080,6 +1080,18 @@ compute_inverse (order)
{
unsigned size, inv, e;
+ /* There can be only one object per "page" in a bucket for sizes
+ larger than half a machine page; it will always have offset zero. */
+ if (OBJECT_SIZE (order) > G.pagesize/2)
+ {
+ if (OBJECTS_PER_PAGE (order) != 1)
+ abort ();
+
+ DIV_MULT (order) = 1;
+ DIV_SHIFT (order) = 0;
+ return;
+ }
+
size = OBJECT_SIZE (order);
e = 0;
while (size % 2 == 0)
More information about the Gcc
mailing list