From d67ff15a5cf11dff46fa2288e0c074526548db2b Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Fri, 4 Dec 2020 11:16:55 +0100 Subject: [PATCH] x64: Fix __call metamethod return dispatch. Reported by Igor Munkin. --- src/vm_x86.dasc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc index b23d046b..60359bd7 100644 --- a/src/vm_x86.dasc +++ b/src/vm_x86.dasc @@ -1246,7 +1246,11 @@ static void build_subroutines(BuildCtx *ctx) | mov LFUNC:RB, [RA-8] | add NARGS:RD, 1 | // This is fragile. L->base must not move, KBASE must always be defined. + |.if x64 + | cmp KBASEa, rdx // Continue with CALLT if flag set. + |.else | cmp KBASE, BASE // Continue with CALLT if flag set. + |.endif | je ->BC_CALLT_Z | mov BASE, RA | ins_call // Otherwise call resolved metamethod.