@@ -327,30 +327,36 @@ class BackendLinux86 : CompilerBackend {
327
327
}
328
328
else if (word.type == WordType.C) {
329
329
if (word.params.length >= 1 ) {
330
- output ~= " sub r15, 8\n " ;
331
- output ~= " mov rdi, [r15]\n " ;
330
+ output ~= format(
331
+ " mov rdi, [r15 - %d]\n " , word.params.length * 8
332
+ );
332
333
}
333
334
if (word.params.length >= 2 ) {
334
- output ~= " sub r15, 8\n " ;
335
- output ~= " mov rsi, [r15]\n " ;
335
+ output ~= format(
336
+ " mov rsi, [r15 - %d]\n " , (word.params.length - 1 ) * 8
337
+ );
336
338
}
337
339
if (word.params.length >= 3 ) {
338
- output ~= " sub r15, 8\n " ;
339
- output ~= " mov rdx, [r15]\n " ;
340
+ output ~= format(
341
+ " mov rdx, [r15 - %d]\n " , (word.params.length - 2 ) * 8
342
+ );
340
343
}
341
344
if (word.params.length >= 4 ) {
342
- output ~= " sub r15, 8\n " ;
343
- output ~= " mov rcx, [r15]\n " ;
345
+ output ~= format(
346
+ " mov rcx, [r15 - %d]\n " , (word.params.length - 3 ) * 8
347
+ );
344
348
}
345
349
if (word.params.length >= 5 ) {
346
- output ~= " sub r15, 8\n " ;
347
- output ~= " mov r8, [r15]\n " ;
350
+ output ~= format(
351
+ " mov r8, [r15 - %d]\n " , (word.params.length - 4 ) * 8
352
+ );
348
353
}
349
354
if (word.params.length >= 6 ) {
350
- output ~= " sub r15, 8\n " ;
351
- output ~= " mov r9, [r15]\n " ;
355
+ output ~= format(
356
+ " mov r9, [r15 - %d]\n " , (word.params.length - 5 ) * 8
357
+ );
352
358
}
353
-
359
+ output ~= format( " sub r15, %d \n " , word.params.length * 8 );
354
360
355
361
output ~= format(" call %s\n " , node.name);
356
362
0 commit comments