File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ class BackendRM86 : CompilerBackend {
320320 output ~= format(" jne __func__%s\n " , Sanitise(" __rm86_exception" ));
321321 }
322322 else {
323- output ~= " mov si, di\n " ;
323+ output ~= " mov si, di\n " ;
324324 CompileReturn(node);
325325 }
326326 }
Original file line number Diff line number Diff line change @@ -275,7 +275,7 @@ class BackendUXN : CompilerBackend {
275275 output ~= format(" ;func__%s JCN2\n " , Sanitise(" __uxn_exception" ));
276276 }
277277 else {
278- output ~= " .temp LDZ .System/wst DEO\n " ;
278+ output ~= " .temp LDZ .System/wst DEO\n " ;
279279 CompileReturn(node);
280280 }
281281 }
Original file line number Diff line number Diff line change @@ -510,11 +510,24 @@ class BackendX86_64 : CompilerBackend {
510510 " mov r9, [r15 - %d]\n " , (word.params.length - 5 ) * 8
511511 );
512512 }
513- output ~= format(" sub r15, %d\n " , word.params.length * 8 );
514513
515- // TODO: support more than 6 parameters
514+ // align stack pointer
515+ output ~= " mov rbp, rsp\n " ;
516+ output ~= " and rsp, 0xFFFFFFFFFFFFFFF0\n " ;
517+
518+ if (word.params.length > 6 ) {
519+ // push parameters
520+ foreach_reverse (i ; 6 .. word.params.length) {
521+ output ~= format(
522+ " push qword [r15 - %d]\n " , (word.params.length - i) * 8
523+ );
524+ }
525+ }
526+ // remove parameters
527+ output ~= format(" sub r15, %d\n " , word.params.length * 8 );
516528
517529 output ~= format(" call %s\n " , ExternSymbol(word.symbolName));
530+ output ~= " mov rsp, rbp\n " ;
518531
519532 if (! word.isVoid) {
520533 output ~= " mov [r15], rax\n " ;
You can’t perform that action at this time.
0 commit comments