@@ -582,16 +582,25 @@ class BackendARM64 : CompilerBackend {
582582 }
583583
584584 // copy data to parameters
585- output ~= format(" sub x19, x19, #%d\n " , paramSize);
586- // output ~= format("sub x9, x19, #%d\n", paramSize);
587- output ~= " mov x9, x19\n " ;
588- output ~= " mov x10, x20\n " ;
589- output ~= format(" mov x11, #%d\n " , paramSize);
590- output ~= " 1:\n " ;
591- output ~= " ldrb w12, [x9], #1\n " ;
592- output ~= " strb w12, [x10], #1\n " ;
593- output ~= " subs x11, x11, #1\n " ;
594- output ~= " bne 1b\n " ;
585+ if (node.params.length > 10 ) {
586+ output ~= format(" sub x19, x19, #%d\n " , paramSize);
587+ // output ~= format("sub x9, x19, #%d\n", paramSize);
588+ output ~= " mov x9, x19\n " ;
589+ output ~= " mov x10, x20\n " ;
590+ output ~= format(" mov x11, #%d\n " , paramSize);
591+ output ~= " 1:\n " ;
592+ output ~= " ldrb w12, [x9], #1\n " ;
593+ output ~= " strb w12, [x10], #1\n " ;
594+ output ~= " subs x11, x11, #1\n " ;
595+ output ~= " bne 1b\n " ;
596+ }
597+ else {
598+ foreach_reverse (ref param ; node.params) {
599+ auto setNode = new SetNode(node.error);
600+ setNode.var = param;
601+ CompileSet(setNode);
602+ }
603+ }
595604 }
596605
597606 foreach (ref inode ; node.nodes) {
@@ -774,6 +783,10 @@ class BackendARM64 : CompilerBackend {
774783 }
775784 }
776785 else {
786+ if (GlobalExists(node.name)) {
787+ Error(node.error, " Global '%s' already exists" , node.name);
788+ }
789+
777790 Global global;
778791 global.type = GetType(node.varType);
779792 global.array = node.array;
0 commit comments