@@ -97,7 +97,7 @@ class BackendARM64 : CompilerBackend {
9797 version (linux ) {
9898 defaultOS = " linux" ;
9999 }
100- version (OSX ) {
100+ else version (OSX ) {
101101 defaultOS = " osx" ;
102102 }
103103 else {
@@ -501,7 +501,7 @@ class BackendARM64 : CompilerBackend {
501501 }
502502
503503 if (crash) {
504- output ~= format( " ldr x9, = __global_%s \n " , Sanitise(" _cal_exception" ));
504+ LoadAddress( " x9 " , " __global_" ~ Sanitise(" _cal_exception" ));
505505 output ~= " ldr x9, [x9]\n " ;
506506 output ~= " cmp x9, #0\n " ;
507507 output ~= format(" bne __func__%s\n " , Sanitise(" __arm64_exception" ));
@@ -579,7 +579,7 @@ class BackendARM64 : CompilerBackend {
579579
580580 if (node.inline) {
581581 if (node.errors) {
582- output ~= format( " ldr x9, = __global_%s \n " , Sanitise(" _cal_exception" ));
582+ LoadAddress( " x9 " , " __global_" ~ Sanitise(" _cal_exception" ));
583583 output ~= " ldr x10, #0\n " ;
584584 output ~= " str x10, [x9]\n " ;
585585 }
@@ -607,7 +607,7 @@ class BackendARM64 : CompilerBackend {
607607 output ~= " str lr, [x20, #-8]!\n " ;
608608
609609 if (node.errors) {
610- output ~= format( " ldr x9, = __global_%s \n " , Sanitise(" _cal_exception" ));
610+ LoadAddress( " x9 " , " __global_" ~ Sanitise(" _cal_exception" ));
611611 output ~= " ldr x10, #0\n " ;
612612 output ~= " str x10, [x9]\n " ;
613613 }
@@ -1301,7 +1301,7 @@ class BackendARM64 : CompilerBackend {
13011301
13021302 ++ blockCounter;
13031303
1304- output ~= format( " ldr x9, = __global_%s \n " , Sanitise(" _cal_exception" ));
1304+ LoadAddress( " x9 " , " __global_" ~ Sanitise(" _cal_exception" ));
13051305 output ~= " ldr x9, [x9]\n " ;
13061306 output ~= " cmp x9, #0\n " ;
13071307 output ~= format(" beq __catch_%d_end\n " , blockCounter);
@@ -1340,22 +1340,19 @@ class BackendARM64 : CompilerBackend {
13401340 }
13411341
13421342 // set exception error
1343- output ~= format( " ldr x9, = __global_%s \n " , Sanitise(" _cal_exception" ));
1344- output ~= " mov x10, 0xFFFFFFFFFFFFFFFF \n " ;
1343+ LoadAddress( " x9 " , " __global_" ~ Sanitise(" _cal_exception" ));
1344+ output ~= " mov x10, #-1 \n " ;
13451345 output ~= " str x10, [x9]\n " ;
13461346
13471347 // copy exception message
1348- output ~= " sub x19, x19, #8\n " ;
1349- output ~= " mov x10, x19\n " ;
1348+ output ~= " ldr x10, [x19, #-8]!\n " ;
13501349 output ~= " add x11, x9, #8\n " ;
13511350 output ~= " mov x12, #3\n " ;
13521351 // copy x10 to x11, x12 times
13531352 output ~= " 1:\n " ;
1354- output ~= " ldr x13, [x10]\n " ;
1355- output ~= " str x13, [x11]\n " ;
1356- output ~= " add x10, x10, #8\n " ;
1357- output ~= " add x11, x11, #8\n " ;
1358- output ~= " sub x12, x12, #1\n " ;
1353+ output ~= " ldr x13, [x10], #8\n " ;
1354+ output ~= " str x13, [x11], #8\n " ;
1355+ output ~= " subs x12, x12, #1\n " ;
13591356 output ~= " bne 1b\n " ;
13601357
13611358 CompileReturn(node);
0 commit comments