[m-dev.] x86-64 architecture support
Peter Hawkins
peter at hawkins.emu.id.au
Fri Aug 26 16:00:40 AEST 2005
Hi...
I've been working on getting Mercury working on the x86-64 architecture
(ie. the new 'saturn' machine). I've been able to build a first-stage
compiler but I'm still waiting for a more complete build to finish.
Two issues have arisen so far when attempting to build mercury:
1) The Boehm garbage collector in the mercury source tree is a little
bit out of date and doesn't support the Intel EM64 variant of the x86-64
architecture. In particular, the prefetch instruction is different
between architectures. This bug has been fixed upstream. The correct
solution here is to update the copy of the garbage collector in the
mercury source tree; as a temporary solution I've manually ported the
relevant-looking patches across.
2) The x86-64 architecture needed a new global register declaration.
There are 16 general purpose registers on the x86-64 architecture, of
which only a few are callee-save:
rbx
rsp
rbp
r12
r13
r14
r15
I've elected only to use registers r12-r15, although x86-64 PIC code
apparently doesn't use a global base register, so we can possibly use
rbx as well without any extra effort. I haven't investigated this yet.
Note that rsi and rdi (the equivalent of esi and edi) are not
callee-save in the new ABI. I'm using the ABI documentation from:
http://www.x86-64.org/documentation/abi-0.96.pdf
I would imagine that the extra registers will improve the performance
the asm_fast grades in 64-bit code over 32-bit code.
=)
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 001-mercury-regs-h.diff
Type: text/x-patch
Size: 426 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20050826/4fff68ef/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 002-x86_64_regs-h.diff
Type: text/x-patch
Size: 2813 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20050826/4fff68ef/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 004-boehm-gcconfig-h.diff
Type: text/x-patch
Size: 710 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20050826/4fff68ef/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 005-boehm-osdep-c.diff
Type: text/x-patch
Size: 2280 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/developers/attachments/20050826/4fff68ef/attachment-0003.bin>
More information about the developers
mailing list