diff options
author | Helmut Eller <eller.helmut@gmail.com> | 2022-06-08 16:20:42 +0200 |
---|---|---|
committer | Helmut Eller <eller.helmut@gmail.com> | 2022-06-08 16:20:42 +0200 |
commit | f31fb0044d6a7275c9a4bf3300b111a902f787f7 (patch) | |
tree | 0a1e665f907d52d24ce61ac2066060aae3c62f80 /lib/btowc.c | |
parent | 636f43bc5489bd51e0d6af93938aabc75353baa4 (diff) | |
download | guile-f31fb0044d6a7275c9a4bf3300b111a902f787f7.tar.gz |
Fix some problems with callr and calli.
The problem with callr is that the register that contains the
function to be called, can be overwritten by the logic that moves
the values into argument registers. To fix this, I added a
get_callr_temp function that should return a platform specific
register that is not used to pass arguments. For Aarch64/Arm the
link registers seems to work; for Amd64/i686 the RAX register.
The function/tmp pair becomes an additional argument to the
parallel assigment; this way the original function register is not
accidentally overwritten.
The problem with calli is that it may not have enough temp
registers to move arguments. The windmill paper says that at most
one temporary register is needed for the parallel assignment.
However, we also need a temp register for mem-to-mem moves. So it
seems that we need a second temporary. For Amd64/i686 we have
only one temporary GPR and one temporary FPR. To fix this, I
modified the algorithm from the paper a bit: we perform the
mem-to-mem moves before the other moves. Later when we need the
temp to break cycles, there shouldn't be any mem-to-mem moves
left. So we should never need two temps at the same time.
* lightening/lightening.c: (get_callr_temp): New function; need
for each platform.
(prepare_call_args): Include the function/callr_temp pair in the
arguments for the parallel assignment.
* lightening/x86.c, lightening/arm.c, lightening/aarch64.c
(get_callr_temp): Implementation for each platform.
* lightening/arm.c (next_abi_arg): Fix the stack size for doubles.
* tests/call_10_2.c, tests/callr_10.c: New tests.
* tests/regarrays.inc: New file. Common code between the above two
tests that would be tedious to duplicate.
Diffstat (limited to 'lib/btowc.c')
0 files changed, 0 insertions, 0 deletions