@@ -217,7 +217,7 @@ class BackendARM64 : CompilerBackend {
217217
218218 // call constructors
219219 foreach (global ; globals) {
220- if (global.type.hasInit) {
220+ if (global.type.hasInit && ! global.type.ptr ) {
221221 LoadAddress(" x9" , format(" __global_%s" , global.name.Sanitise()));
222222 output ~= " str x9, [x19], #8\n " ;
223223 output ~= format(" bl __type_init_%s\n " , global.type.name.Sanitise());
@@ -291,7 +291,7 @@ class BackendARM64 : CompilerBackend {
291291 override void End () {
292292 // call destructors
293293 foreach (global ; globals) {
294- if (global.type.hasDeinit) {
294+ if (global.type.hasDeinit && ! global.type.ptr ) {
295295 LoadAddress(" x9" , format(" __global_%s" , global.name.Sanitise()));
296296 output ~= " str x9, [x19], #8\n " ;
297297 output ~= format(" bl __type_deinit_%s\n " , global.type.name.Sanitise());
@@ -705,7 +705,7 @@ class BackendARM64 : CompilerBackend {
705705 foreach (ref var ; variables) {
706706 scopeSize += var.Size();
707707
708- if (var.type.hasDeinit) {
708+ if (var.type.hasDeinit && ! var.type.ptr ) {
709709 output ~= format(" add x9, x20, #%d\n " , var.offset);
710710 output ~= " str x9, [x19], #8\n " ;
711711 output ~= format(" bl __type_deinit_%s\n " , var.type.name.Sanitise());
@@ -746,7 +746,7 @@ class BackendARM64 : CompilerBackend {
746746 // remove scope
747747 foreach (ref var ; variables) {
748748 if (oldVars.canFind(var)) continue ;
749- if (! var.type.hasDeinit) continue ;
749+ if (! var.type.hasDeinit || var.type.ptr) continue ;
750750
751751 output ~= format(" add x9, x20, #%d\n " , var.offset);
752752 output ~= " str x9, [x19], #8\n " ;
@@ -775,7 +775,7 @@ class BackendARM64 : CompilerBackend {
775775 // remove scope
776776 foreach (ref var ; variables) {
777777 if (oldVars.canFind(var)) continue ;
778- if (! var.type.hasDeinit) continue ;
778+ if (! var.type.hasDeinit || var.type.ptr) continue ;
779779
780780 output ~= format(" add x9, x20, #%d\n " , var.offset);
781781 output ~= " str x9, [x19], #8\n " ;
@@ -813,7 +813,7 @@ class BackendARM64 : CompilerBackend {
813813 output ~= format(" __while_%d_next:\n " , blockNum);
814814 foreach (ref var ; variables) {
815815 if (oldVars.canFind(var)) continue ;
816- if (! var.type.hasDeinit) continue ;
816+ if (! var.type.hasDeinit || var.type.ptr) continue ;
817817
818818 output ~= format(" add x9, x20, #%d\n " , var.offset);
819819 output ~= " str x9, [x19], #8\n " ;
@@ -993,7 +993,7 @@ class BackendARM64 : CompilerBackend {
993993 foreach (ref var ; variables) {
994994 scopeSize += var.Size();
995995
996- if (var.type.hasDeinit) {
996+ if (var.type.hasDeinit && ! var.type.ptr ) {
997997 output ~= format(" add x9, x20, #%d\n " , var.offset);
998998 output ~= " str x9, [x19], #8\n " ;
999999 output ~= format(" bl __type_deinit_%s\n " , var.type.name.Sanitise());
@@ -1166,7 +1166,7 @@ class BackendARM64 : CompilerBackend {
11661166 foreach (ref var ; variables) {
11671167 scopeSize += var.Size();
11681168
1169- if (var.type.hasDeinit) {
1169+ if (var.type.hasDeinit && ! var.type.ptr ) {
11701170 output ~= format(" add x9, x20, #%d\n " , var.offset);
11711171 output ~= " str x9, [x19], #8\n " ;
11721172 output ~= format(" bl __type_deinit_%s\n " , var.type.name.Sanitise());
@@ -1334,7 +1334,7 @@ class BackendARM64 : CompilerBackend {
13341334 // remove scope
13351335 foreach (ref var ; variables) {
13361336 if (oldVars.canFind(var)) continue ;
1337- if (! var.type.hasDeinit) continue ;
1337+ if (! var.type.hasDeinit || var.type.ptr) continue ;
13381338
13391339 output ~= format(" add x9, x20, #%d\n " , var.offset);
13401340 output ~= " str x9, [x19], #8\n " ;
0 commit comments