cpstrnew branch (was Re: [fpc-devel] Freepascal 2.4.0rc1 released)

Micha Nelissen micha at neli.hopto.org
Thu Nov 12 11:24:59 CET 2009


Jonas Maebe wrote:
> If you'd want to limit the length to 2GB on 64 bit systems. I also don't 
> know whether all 64 bit CPUs support atomic operations on 32 bit 
> entities (for the reference count).

Something might be said for "compatibility" towards 32 bit 
implementations that the maximum length is the same, but I don't really 
have an opinion on whether this is actually a good idea (limiting the 
size for compatibility reason).

At least Intel and PowerPC do have atomic operations on smaller sizes.

Intel: system programming guide vol 3 section 8.1.1 says byte, word, 
doubleword, quadword (since Pentium) are all atomic if they are 
naturally aligned. (word = 16 bits) 8.1.2.2 notes that LOCK is also best 
to be used on naturally aligned boundaries for 8/16/32/64 bit accesses 
for best performance.

PowerPC: pem64, 2005mar, section 5.1.2 says byte, halfword, word, 
doubleword (64 bit only) are atomic if they are naturally aligned. (word 
= 32 bits). lwarx/stwcx still exists on 64 bit implementations.

So both guarantee smaller reads/writes are atomic.

Micha



More information about the fpc-devel mailing list