on master help sign in
hack in idris_gc to force 16-bit/2-byte alignment for

allocations. Some embedded platforms, like the arduino/avr, support byte-aligned pointers. However, that makes implementing tagged pointers very tricky. So, instead we just force 16-bit alignment.

commit66936b0fb6c2d3183c50f31ba54efa3fd77f1a2f authorstepcut <jeremy@n-heptane.com> dateMon 10 Mar 2014, 16:57 (13 years ago) parent035d0a9
1 file changed+9−1
rts/idris_gc.c+9−1
rts/idris_gc.c+9−1
@@ -103,7 +103,14 @@ void idris_gc(VM* vm) {
103103 free(vm->heap.old);
104104
105105 vm->heap.heap = newheap;
106− vm->heap.next = newheap;
106+#ifdef FORCE_ALIGNMENT
107+ if (((i_int)(vm->heap.heap)&1) == 1) {
108+ vm->heap.next = newheap + 1;
109+ } else
110+#endif
111+ {
112+ vm->heap.next = newheap;
113+ }
107114 vm->heap.end = newheap + vm->heap.size;
108115
109116 VAL* root;
@@ -111,6 +118,7 @@ void idris_gc(VM* vm) {
111118 for(root = vm->valstack; root < vm->valstack_top; ++root) {
112119 *root = copy(vm, *root);
113120 }
121+
114122#ifdef HAS_PTHREAD
115123 for(root = vm->inbox_ptr; root < vm->inbox_write; ++root) {
116124 *root = copy(vm, *root);