Skip to content

Commit

Permalink
Hopefully fix MVM_jit_emit_runcode on Windows
Browse files Browse the repository at this point in the history
Windows requires structs and other aggregates to be put into caller allocated
memory and a pointer to this memory passed as an ordinary argument. On POSIX
we put the struct's fields individually onto the stack. Since the stack is
memory and as such guaranteed to be available until the caller exits, we can
use it for Windows as well. So all that should be needed is that pointer.

Completely untested, as I don't have Windows available.
  • Loading branch information
niner committed Jul 30, 2021
1 parent a3c5efb commit af8eae1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/jit/x64/emit.dasc
Expand Up @@ -3065,6 +3065,10 @@ void MVM_jit_emit_runcode(MVMThreadContext *tc, MVMJitCompiler *compiler, MVMJit
emit_stack_arg(tc, compiler, jg, 8, 8);
| lea TMP6, [<5];
emit_stack_arg(tc, compiler, jg, 8, 16);
|.if WIN32
/* Pass a pointer to the stack allocated struct as ordinary argument */
| mov ARG2, rsp;
|.endif
| mov FUNCTION, qword WORK[runcode->code_register];
| mov FUNCTION, CFUNCTION:FUNCTION->body.func;
| call FUNCTION
Expand Down

0 comments on commit af8eae1

Please sign in to comment.