From 9457dac02584523878b31ea8add5ce426c1eb5d5 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Wed, 18 Sep 2019 01:44:15 +0000 Subject: [PATCH] Revert "Workaround for inexplicable fatal error on macOS." This reverts commit 689da8bf97534063f1800caf544a694de81d511e. Will fix in a subsequent commit. --- src/microcode/cmpintmd/x86-64.c | 38 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/src/microcode/cmpintmd/x86-64.c b/src/microcode/cmpintmd/x86-64.c index 8edfd8baa..84b9f6214 100644 --- a/src/microcode/cmpintmd/x86-64.c +++ b/src/microcode/cmpintmd/x86-64.c @@ -224,26 +224,24 @@ write_uuo_target (insn_t * target, SCHEME_OBJECT * saddr) But if the target is a compiled closure pointing into a block somewhere else, the block may not have been relocated yet and so we don't know where the PC will be in the newspace. */ - - // **** For unknown reasons this optimization doesn't work right on macOS. - // if ((((int64_t *) (newspace_to_tospace (target)))[-1]) == 0) - // { - // ptrdiff_t jmprel32_offset = (target - (&addr[15])); - // if ((INT32_MIN <= jmprel32_offset) && (jmprel32_offset <= INT32_MAX)) - // { - // (addr[10]) = 0xe9; /* JMP rel32 */ - // (* ((int32_t *) (&addr[11]))) = jmprel32_offset; - // } - // else - // { - // (addr[10]) = 0x48; /* MOV RAX,imm64 */ - // (addr[11]) = 0xb8; - // (* ((insn_t **) (&addr[12]))) = target; - // (addr[20]) = 0xff; /* JMP RAX */ - // (addr[21]) = 0xe0; - // } - // } - // else + if ((((int64_t *) (newspace_to_tospace (target)))[-1]) == 0) + { + ptrdiff_t jmprel32_offset = (target - (&addr[15])); + if ((INT32_MIN <= jmprel32_offset) && (jmprel32_offset <= INT32_MAX)) + { + (addr[10]) = 0xe9; /* JMP rel32 */ + (* ((int32_t *) (&addr[11]))) = jmprel32_offset; + } + else + { + (addr[10]) = 0x48; /* MOV RAX,imm64 */ + (addr[11]) = 0xb8; + (* ((insn_t **) (&addr[12]))) = target; + (addr[20]) = 0xff; /* JMP RAX */ + (addr[21]) = 0xe0; + } + } + else { (addr[10]) = 0x48; /* MOV RAX,-8(RCX) */ (addr[11]) = 0x8b; -- 2.25.1