TYPE_ALIGN? Re: Java: hashtable synchronization for PowerPC

Bryce McKinlay bryce@waitaki.otago.ac.nz
Tue Mar 5 14:08:00 GMT 2002


Alexandre Petit-Bianco wrote:

>Boehm, Hans writes:
>
>>If I understand what this is doing, you really want alignment = 8 *
>>smallest_addressable_unit, i.e. 8 bytes, even on a 64 bit machine.
>>Does this do that?
>>
>
>I read the comment and went with the `at least double-word' alignment.
>
>On x86, this would be (BITS_PER_UNIT = 8) * (UNITS_PER_WORD = 4) *
>(double = 2), 64.
>

Sorry, the comment is inaccurate - it should say "at least 64-bit 
alignment". The only reason why it checks (POINTER_SIZE < 64) is that I 
wanted to make sure we didn't end up _reducing_ alignment if the back 
end wants > 64-bit alignment, but I don't know if there is a way to find 
out what the natural alignment for the structure according to the back 
end is from the front-end.

But now I think about it, TYPE_ALIGN is presumably only treated as a 
minimum alignment - the back end would still override this with a 
greater alignment if it wante to, right?

So how about:

RCS file: /cvs/gcc/egcs/gcc/java/decl.c,v
...
+
+  /* Hash synchronization requires at least 64-bit alignment. */
+  if (flag_hash_synchronization)
+    TYPE_ALIGN (class_type_node) = 64;

regards

Bryce.




More information about the Gcc mailing list