More ABI changes

Don Clugston dac at nospam.com.au
Mon Dec 4 08:07:55 PST 2006


Walter Bright wrote:
> The ABI changed in 0.176 to reflect an accumulation of fixes. It's 
> apparent that it needs to change at least once more. So I wouldn't waste 
> too much time shipping precompiled libraries for 0.176, but it is worth 
> compiling and checking for dmd bugs that need fixing.
> 
> Hopefully soon we'll have an ABI we can live with for a while.

The name mangling for complex template parameters is also using the old
order (little endian between bytes, big endian within bytes), while for
real template params it uses the new one (big endian). I think that's
probably my fault.

Line 1498.

	for (int i = 0; i < REALSIZE-REALPAD; i++)
	    buf->printf("%02x", p[i]);

should be

     for (int i = REALSIZE-REALPAD-1; i >=0; i--)
  buf->printf("%02x", p[i]);


However, even better would be to make this aspect of the ABI
CPU-independent.

Define format to be:
e HexExponent HexSignificand  for real and imaginary FP literals.
c HexExponent HexSignificand HexExponent HexSignificand for complex FP
literals.

where

HexExponent 4HexDigits
HexSignificand 16HexDigits

Hex digits are encoded as the first ten bytes of the binary
representation of the number in quadruple floating point BigEndian
format, with no implicit significand bit. Only the first 64 significand
bits are stored.
(This means that the first four characters are the biased exponent, and
the next 16 characters are the first 64 significand bits, in the same
form that is used by hexadecimal floating point literals).
Example:
The template argument 0x1.12345678ABCDp+0
is encoded as:
Sde3FFF12345678ABCD0000

This means that on systems where real is identical to double, the last
three characters will always be "000", and the third character will
either be 'F' or '0'.

I'll post a patch to do this when I get a chance.



More information about the Digitalmars-d-announce mailing list