Using rel32 addressing when calling cfuncs, instead of r64 #92
64kramsystem
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
AFAIK there aren't any cases where we actually need 64 bit addressing, though I haven't confirmed. I think if the tests pass with your PR we should just merge it? I don't really see any downsides 😄 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The current
Runtime#call_cfunc
uses 64-bit addressing:This clobbers RAX, and makes it impossible to perform some calls, e.g. libc's
printf
, which uses RAX to count the floating point parameters (ie.xmm
registers used).I'm not familiar with the subject, but this seems to be required by the assumption of a large/huge memory model.
In
ISEQCompiler
though, a 32-bits relative address is used for jumps (see operations using@fisk.absolute
), which assumes a small memory model.Are there cases where 64-bit addressing is used for cfuncs? If there isn't,
call_cfunc
could be simplified. I've actually tested on a branch if the change works, and it does, however, I don't know if there are other situations where this wouldn't work.Beta Was this translation helpful? Give feedback.
All reactions