This did not manifest in my testing on NetBSD because it happened
that on NetBSD, the tospace and newspace are always separated by more
than 4 GB, so the bogus jmprel32_offset was never used during GC,
e.g.:
newspace=0x17dd7f8 tospace=0x7f7feeb00000 delta=
17523427132673
I suspect it is the cause of Chris's problems on macOS, so this
should fix Chris's issue on macOS and speed things up even more for
everyone.
we don't know where the PC will be in the newspace. */
if ((((int64_t *) (newspace_to_tospace (target)))[-1]) == 0)
{
- ptrdiff_t jmprel32_offset = (target - (&addr[15]));
+ ptrdiff_t jmprel32_offset =
+ (target - ((const insn_t *) (tospace_to_newspace (&addr[15]))));
if ((INT32_MIN <= jmprel32_offset) && (jmprel32_offset <= INT32_MAX))
{
(addr[10]) = 0xe9; /* JMP rel32 */