This is the mail archive of the gcc@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]

Re: endless loop in compute_inverse bootstrapping on alpha


Am Freitag, 23. August 2002 19:24 schrieb Zack Weinberg:
> 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).

Doesn't your patch contradict your statement here?  On the one hand you always 
set .shift to 0, which ist different from what the algorithm would compute 
without the patch.  On the other hand you say that .shift is the one 
important value.  

> 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.

Ok.  As I understand it, one doesn't have to care about the values for big 
orders as they will never be used anyway, right?

I'm appending the obvious extension of my previous patch to also change the 
type of inverse_table[order].mult to size_t.  It just passed the critical 
point in the bootstrap.  Next I will test Zack's patch, so whatever will be 
applied will be confirmed to work as intended on alpha, also.

Michael

2002-08-23 Michael Ritzert <michael@ritzert.de>

	* ggc-page.c (struct inverse_table[]): Make mult a size_t.
	(compute_inverse): Define size and inv as size_t.

Index: ggc-page.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ggc-page.c,v
retrieving revision 1.53
diff -u -3 -p -r1.53 ggc-page.c
--- ggc-page.c	22 Aug 2002 19:17:04 -0000	1.53
+++ ggc-page.c	23 Aug 2002 19:23:58 -0000
@@ -224,7 +224,7 @@ static size_t object_size_table[NUM_ORDE
 
 static struct
 {
-  unsigned int mult;
+  size_t mult;
   unsigned int shift;
 }
 inverse_table[NUM_ORDERS];
@@ -1078,7 +1078,8 @@ static void
 compute_inverse (order)
      unsigned order;
 {
-  unsigned size, inv, e;
+  size_t size, inv;
+  unsigned e;
 
   size = OBJECT_SIZE (order);
   e = 0;


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