Index: tests/zombies/ArrayN.c
===================================================================
--- tests/zombies/ArrayN.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/ArrayN.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,23 @@
+#include <fstream.hfa>
+
+// [unsigned, unsigned] offset_to_index(unsigned offset, unsigned sx, unsigned sy)
+// {
+//     return [offset / sx, offset % sy];
+// }
+
+forall(otype index_t)
+index_t offset_to_index(unsigned offset, index_t size) {
+    return [offset / size.0, offset % size.1];
+}
+
+int main(int argc, char* argv[]) {
+    unsigned x = 0, y = 0, i = 0;
+    unsigned sx = 4, sy = 4;
+
+    i = 6;
+    [x, y] = offset_to_index(6, [sx, sy]);
+
+    sout | x | ' ' | y;
+
+    return 0;
+}
Index: tests/zombies/Initialization.c
===================================================================
--- tests/zombies/Initialization.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/Initialization.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,41 @@
+// Cforall extensions
+
+int * x11 = 0, x12 = 0;
+int * x21 = 0, x22 = 0;
+
+[20] int y1, y2 = { 1, 2, 3 };
+
+// designators
+
+struct {
+	[int] w;
+} a = { .w : [2] };
+
+struct { int a[3], b; } w [] = { [0].a : {1}, [0].b : 3, [1].a[0] : 2 };
+
+struct {
+	int f1, f2, f3;
+	struct { int g1, g2, g3; } f4[4];
+} v7 = {
+  .f1 : 4,
+  f2 : 3,
+  .f4[2] : {
+	  .g1 : 3,
+	  g3 : 0,
+	},
+  .f4[3].g3 : 7,
+};
+
+struct point { int x; int z; struct {int y1, y2, y3;} y; int w;};
+struct quintet { int v, w, x, y, z;};
+
+int main() {
+	struct point p1 = { x : 3 };
+	struct point p2 = { 3, 4 };
+	struct point p3 = { .[x,z] : 5, y : { .[y3,y1] : 6, 17 } };
+	struct point p4 = { w : 5, 4 };
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/zombies/Initialization2.c
===================================================================
--- tests/zombies/Initialization2.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/Initialization2.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,15 @@
+int a = 3;
+struct { int x; int y; } z = { 3, 7 };      /* OK */
+struct { int x; int y; } z1 = { .[x,y]:3 }; /* OK */
+struct { int x; int y; } z2 = { y:3, x:4 }; /* OK */
+struct { int x; struct { int y1; int y2; } y; } z3 = { x:3, y:{y1:4, y2:5} };  /* OK */
+struct { int x; struct { int y1; int y2; } y; } z3 = { y:{y2:9, y1:8}, x:7 };  /* OK */
+struct { int x; struct { int y1; int y2; } y; } z3 = { x:7, {y2:9, y1:8} };  /* OK */
+struct { int x; struct { int y1; int y2; } y; } z3 = { 3, {4, 5} };   /* OK */
+//struct { int x; struct { int y1; int y2; } } z3 = {4, {5,6}};
+//struct { int x; struct { int y1; int y2; } y; } z4 = { y:{4,5}, a:3 };
+//struct { int x; struct { int y1; int y2; } y; } z5 = { a:3, {4,5}};
+//int x[20] = { [10]: 4 };
+struct t { int a, b; };
+struct t x = { b:4, a:3 };
+struct { int x; int y; } z6= {5,6,4};  /* (should be an) error */
Index: tests/zombies/Makefile.example
===================================================================
--- tests/zombies/Makefile.example	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/Makefile.example	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,42 @@
+CFA ?= ../driver/cfa-cpp
+CFAOPT ?= -a
+OUTPUT ?= Output
+EXPECT ?= Expect
+OUTPUTDIR ?= ${OUTPUT}${CFAOPT}
+EXPECTDIR ?= ${EXPECT}${CFAOPT}
+EXAMPLES = ${wildcard *.c}
+OUTPUTS = ${addprefix ${OUTPUTDIR}/,${EXAMPLES:.c=.txt}}
+
+#.SILENT :
+
+all :
+	+for opt in -a -e -f -r -s -v ; do \
+	    make test CFAOPT=$${opt} ; \
+	done ; \
+	rm -f core
+
+test : ${OUTPUTS} ${OUTPUTDIR}/report
+
+${OUTPUTDIR}/%.txt : %.c ${CFA} Makefile
+	-${CFA} -n ${CFAOPT} $< > $@ 2>&1
+
+${OUTPUTDIR}/report : ${OUTPUTS} ${EXPECTDIR}
+	rm -f $@
+	echo "===== regression test using cfa-cpp flag ${CFAOPT} ====="
+	@for i in ${OUTPUTS} ; do \
+	     echo "---"`basename $$i`"---" | tee -a $@; \
+	     diff -B -w ${EXPECTDIR}/`basename $$i` $$i | tee -a $@; \
+	done
+
+${OUTPUTS} : | ${OUTPUTDIR}		# order only prerequisite
+
+${OUTPUTDIR} :
+	mkdir -p $@
+
+# remove the expected results directories to generate new ones from the current output
+
+${EXPECTDIR} : | ${OUTPUTS}		# new Expected results ?
+	cp -pr ${OUTPUTDIR} $@
+
+clean :
+	rm -rf ${OUTPUT}-* core
Index: tests/zombies/Members.c
===================================================================
--- tests/zombies/Members.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/Members.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,72 @@
+char ?=?( char*, char );
+int ?=?( int*, int );
+float ?=?( float*, float );
+forall( dtype DT ) DT * ?=?( DT**, DT* );
+forall(otype T) lvalue T *?( T* );
+char *__builtin_memcpy();
+
+void a( char );
+void b( int );
+void c( int* );
+void d( float* );
+
+struct a_struct {
+	int a;
+	char a;
+	float a;
+};
+
+union b_struct {
+	int *a;
+	char *a;
+	float *a;
+};
+
+void f() {
+	struct a_struct the_struct;
+	union b_struct the_struct;
+  
+	a( the_struct.a );
+	b( the_struct.a );
+	c( the_struct.a );
+	d( the_struct.a );
+}
+
+struct c_struct {
+	int;
+	char;
+	float;
+};
+
+union d_struct {
+	int*;
+	char*;
+	float*;
+};
+
+void g() {
+	unsigned short x;
+	struct c_struct x;
+	union d_struct x;
+  
+	a( x );	// the 'a' and 'b' calls resolve to the ushort
+	b( x );	// it's debatable whether this is good
+	c( x );
+	d( x );
+}
+
+// make sure that forward declarations work
+
+struct forward;
+
+struct forward *q;
+
+struct forward { int y; };
+
+void h() {
+	q->y;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/zombies/Misc.c
===================================================================
--- tests/zombies/Misc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/Misc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,19 @@
+// interesting corner cases
+
+int a;
+int b;
+float b;
+
+void g( int );
+void g( unsigned );
+
+void f( void ) {
+	g( (a, b) );
+	g( (a, a, b) );
+	g( sizeof a );
+	g( sizeof( int ) );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/zombies/MiscError.c
===================================================================
--- tests/zombies/MiscError.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/MiscError.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,16 @@
+int a;
+int b;
+float b;
+
+void g( int );
+
+void f( void ) {
+	g( (b, a) );
+	g( (b, a, b) );
+	g( (a, b, b) );
+	sizeof b;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/zombies/Rank2.c
===================================================================
--- tests/zombies/Rank2.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/Rank2.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,20 @@
+int ?=?( int *, int );
+forall(dtype DT) DT * ?=?( DT **, DT * );
+
+void a() {
+	forall( otype T ) void f( T );
+	void g( forall( otype U ) void p( U ) );
+	g( f );
+}
+
+void g() {
+	void h( int *null );
+	forall( otype T ) T id( T );
+	forall( dtype T ) T *0;
+	int 0;
+	h( id( id( id( 0 ) ) ) );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/zombies/Tuple.c
===================================================================
--- tests/zombies/Tuple.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/Tuple.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,73 @@
+int f( int, int );
+int g( int, int, int );
+static
+[ int, int *, * int, int ] h( int a, int b, * int c, [] char d );
+
+struct inner {
+	int f2, f3;
+};
+
+struct outer {
+	int f1;
+	struct inner i;
+	double f4;
+} s, *sp;
+
+const volatile [ int, int ] t1;
+static const [ int, int ] t2;
+const static [ int, const int ] t3;
+
+[ int rc ] printf( * char fmt, ... );
+int printf( char *fmt, ... );
+
+[ short x, unsigned y ] f1( int w ) {
+// 	return [ y, x ] = [ x, y ] = [ w, 23 ];
+}
+
+[ [ int, char, long, int ] r ] g1() {
+	short int x, p;
+	unsigned int y;
+	[ int, int ] z;
+
+	[ x, y, z ] = [ p, f( 17, 18 ), 4, 3 ];
+//	[ x, y, z ] = ([short, unsigned int, [int, int]])([ p, f( 17, 18 ), 4, 3 ]);
+	r = [ x, y, z ];
+}
+
+[ int rc ] main( int argc, ** char argv ) {
+	int a, b, c, d;
+//	struct outer t = { .[ f1, f4 ] : [ 1, 7.0 ] };
+	f( [ 3,5 ] );
+	g( [ 3,5 ], 3 );
+	f( t1 );
+	g( t1, 3 );
+
+//	[ , , , ];						/* empty tuple */
+	[ 3, 5 ];
+	[ a, b ] = 3;
+//	[ a, b ] = [ 4.6 ];
+	[ a, b ] = 4.6;
+	[ a, b ] = [ c, d ] = [ 3, 5 ];
+//	[ a, b, [ c ] ] = [ 2, [ a, b ] ];
+	[ a, b, c ] = [ 2, [ a, b ] ];
+	[ a, b ] = 3 > 4 ? [ b, 6 ] : [ 7, 8 ];
+
+	t1 = [ a, b ];
+	t1 = t2 = [ a, b ];
+	[ a, b ] = [ c, d ] = d += c += 1;
+	[ a, b ] = [ c, d ] = t1;
+	[ a, b ] = t1 = [ c, d ];
+	[ a, b ] = t1 = t2 = [ c, d ];
+//	t1 = [ 3, 4 ] = [ 3, 4 ] = t1 = [ 3, 4 ];
+
+	s.[ f1, i.[ f2, f3 ], f4 ] = [ 11, 12, 13, 3.14159 ];
+//	s.[ f1, i.[ f2, f3 ], f4 ] = h( 3, 3, (* int)0, "abc" );
+//	[ a, , b, ] = h( 3, 3, 0, "abc" );			/* ignore some results */
+	sp->[ f4, f1 ] = sp->[ f1, f4 ];
+	printf( "expecting 3, 17, 23, 4; got %d, %d, %d, %d\n", s.[ f4, i.[ f3, f2 ], f1 ] );
+	rc = 0;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: tests/zombies/abstype.c
===================================================================
--- tests/zombies/abstype.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/abstype.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,43 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// abstype.c -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Jun 14 14:27:48 2016
+// Update Count     : 9
+//
+
+otype T | { T x( T ); };
+
+T y( T t ) {
+	T t_instance;
+	return x( t );
+}
+
+forall( otype T ) lvalue T *?( T * );
+int ?++( int * );
+int ?=?( int *, int );
+forall( dtype DT ) DT * ?=?( DT **, DT * );
+
+otype U = int *;
+
+U x( U u ) {
+	U u_instance = u;
+	(*u)++;
+	return u;
+}
+
+int *break_abstraction( U u ) {
+	return u;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa abstype.c" //
+// End: //
Index: tests/zombies/constructors.c
===================================================================
--- tests/zombies/constructors.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/constructors.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,61 @@
+int fred() {
+    // initialize basic structure
+    struct S {
+	int i, j, k;
+    };
+    void ?{}( S *s ) { s->i = 1, s->k = 2; }		// default constructor
+    void ?{}( S *s, int i, int k ) { s->i = i, s->k = k; } // 2 parameter constructor
+    void ?{}( S *s, S c ) { *s = c; }			// copy constructor
+    void ^?{}( S *s ) { s->i = 0, s->k = 0; }		// default destructor
+    void ^?{}( S *s, int i ) { s->i = i, s->k = i; }	// 1 parameter destructor
+    {
+	S s1;			// default constructor
+	S s2 = { 3, 7 };	// 2 parameter constructor
+	S s3 @= { .k:3, .i:7 };	// 2 parameter C initialization
+	?{}( &s3, 2, 5 );	// explicit 2 parameter constructor
+	^?{}( &s1 );		// explicit call to default destructor
+    } // implicit call to default destructor for s2, explicit call s1, no call for s3
+    S s4 @= {};			// no default construction
+    (&s4){ 2, 5 };		// explicit 2 parameter constructor
+    ^s4{ 3 };			// explicit call to 1 parameter destructor
+
+    // initialize pointer to a basic structure
+
+    void ?{}( S **s ) { *s = malloc(); (*s)->i = 1, (*s)->k = 2; } // default constructor
+    void ?{}( S **s, int i, int k ) { *s = malloc(); (*s)->i = i, (*s)->k = k; } // 2 parameter constructor
+    void ^?{}( S **s ) { (*s)->i = 0, (*s)->k = 0; free( *s ); *s = 0; } // default destructor
+    {
+	S *ps1;			// default constructor
+	S *ps2 = { 3, 7 };	// 2 parameter constructor
+	S *ps3 @= 0;		// C initialization
+	S *ps4 @= {};		// no default construction
+    } // implicit call to default destructor for ps2 and ps1, checks ordering of explicit destructor calls
+
+    ?{}( &ps3, 2, 5 );		// explicit 2 parameter constructor
+    (&ps4){ 2, 5 };		// explicit 2 parameter constructor
+    
+    ^?{}( &ps3 );		// explicit call to default destructor
+    ^ps4{};			// explicit call to default destructor
+
+    // initialize complex structure
+
+    struct T {
+	struct S s;
+    };
+
+    void ?{}( T *t ) {}					// default constructor => implicitly call constructor for field s
+    void ?{}( T *t, int i, int k ) { (&t->s){ i, k }; }	// 2 parameter constructor => explicitly call constructor for field s
+    void ?{}( T *t, S c ) { (&t->s){ c }; }		// 1 parameter constructor => explicitly call copy constructor for field s
+    void ^?{}( T *s, int i ) {}				// destructor => implicitly call destructor for field s
+    {
+	S s;			// default constructor
+	T t1;			// default constructor
+	T t2 = { s };		// 1 parameter constructor
+	^?{}( &t1 );		// explicit call to default destructor => implicit call to t1.s's destructor
+    } // implicit call to default destructor for t2 and implicit call for s;
+    T t3;			// default constructor
+    T t4 @= { { 1, 3 } };	// C initialization
+    (&t4){ 2, 5 };		// explicit 2 parameter constructor
+
+    T *pt = malloc(){ 3, 4 };	// common usage
+} // implicit call to default destructor for t3
Index: tests/zombies/forward.c
===================================================================
--- tests/zombies/forward.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/forward.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,29 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// forward.c -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed May 27 18:11:57 2015
+// Update Count     : 2
+//
+
+forall(type T) lvalue T *?( T* );
+int ?=?( int*, int );
+
+struct q { int y; };
+struct q *x;
+
+void f() {
+	*x;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa forward.c" //
+// End: //
Index: tests/zombies/gc_no_raii/.gitignore
===================================================================
--- tests/zombies/gc_no_raii/.gitignore	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/.gitignore	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,4 @@
+.tags
+.tags*
+gc-test
+build/
Index: tests/zombies/gc_no_raii/bug-repro/assert.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/assert.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/assert.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,16 @@
+struct gc_object_header{
+ int size;
+};
+
+struct gc_state;
+
+inline _Bool needs_collect(gc_state* state) {
+ return state->used_space > 0;
+}
+
+struct gc_object_header* gc_get_object_for_ref();
+
+inline gc_object_header* gc_get_object_ptr(void* ptr)
+{
+ return 0;
+}
Index: tests/zombies/gc_no_raii/bug-repro/blockers/explicit_cast.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/blockers/explicit_cast.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/blockers/explicit_cast.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,22 @@
+
+#include <stdbool.h>
+#include <stdint.h>
+
+struct gcpointer_t
+{
+	intptr_t ptr;
+	struct gcpointer_t* next;
+};
+
+forall(otype T)
+struct gcpointer
+{
+	gcpointer_t internal;
+};
+
+forall(otype T)
+static inline gcpointer(T) gcmalloc()
+{
+    gcpointer(T) test;
+    return test;
+}
Index: tests/zombies/gc_no_raii/bug-repro/blockers/file_scope.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/blockers/file_scope.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/blockers/file_scope.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,18 @@
+
+#include <stdbool.h>
+#include <stdlib.hfa>
+
+#define POOL_SIZE_EXP 24
+#define POOL_SIZE_BYTES 0x1 << POOL_SIZE_EXP
+#define POOL_PTR_MASK ~(POOL_SIZE_BYTES - 1)
+
+#define CARDS_SIZE_EXP 12
+#define CARDS_SIZE_BYTES 0x1 << CARDS_SIZE_EXP
+#define CARDS_OFFSET_MASK (~(CARDS_SIZE_BYTES - 1)) & (POOL_SIZE_BYTES - 1)
+#define CARDS_COUNT POOL_SIZE_BYTES / CARDS_SIZE_BYTES
+
+struct card_table_t
+{
+	size_t count;
+	void* cards_start[CARDS_COUNT];
+};
Index: tests/zombies/gc_no_raii/bug-repro/blockers/recursive_realloc.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/blockers/recursive_realloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/blockers/recursive_realloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,21 @@
+
+#include <stdbool.h>
+#include <stdlib.hfa>
+
+trait allocator_c(otype T, otype allocator_t)
+{
+	void realloc(allocator_t* const, size_t);
+};
+
+forall(otype T)
+struct heap_allocator
+{
+	T* storage;
+	size_t capacity;
+};
+
+forall(otype T)
+inline void realloc(heap_allocator(T) *const this, size_t size)
+{
+	this->storage = (T*)realloc((void*)this->storage, this->capacity);
+}
Index: tests/zombies/gc_no_raii/bug-repro/crash.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/crash.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/crash.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,6 @@
+
+void f()
+{
+ void* obj;
+ (void)obj;
+}
Index: tests/zombies/gc_no_raii/bug-repro/deref.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/deref.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/deref.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,19 @@
+    forall(otype T)
+    struct wrap
+    {
+        T val;
+    };
+
+    forall(otype T)
+    T *? (wrap(T) rhs)
+    {
+        return rhs.val;
+    }
+
+    int main(int argc, char const *argv[])
+    {
+        wrap(int) test;
+        test.val = 3;
+        int i = *test;
+        return 0;
+    }
Index: tests/zombies/gc_no_raii/bug-repro/field.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/field.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/field.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,130 @@
+extern "C" {
+#include <stdbool.h>
+#include <stdint.h>
+}
+
+#include <stdlib.hfa>
+
+//------------------------------------------------------------------------------
+//Declaration
+trait allocator_c(otype T, otype allocator_t)
+{
+	void ctor(allocator_t* const);
+	void dtor(allocator_t* const);
+	void realloc(allocator_t* const, size_t);
+	T* data(allocator_t* const);
+};
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+struct vector
+{
+	allocator_t storage;
+	size_t size;
+};
+
+int global = 3;
+
+struct card_table_t
+{
+	size_t count;
+	void* cards_start[100];
+};
+
+static inline void ctor(card_table_t* const this)
+{
+	this->count = 0;
+}
+
+struct gc_memory_pool
+{
+	struct memory_pool* mirror;
+	struct memory_pool* next;
+
+	uint8_t type_code;
+
+	card_table_t* cards;
+
+	uint8_t* end_p;
+	uint8_t* free_p;
+	uint8_t start_p[1];
+};
+
+void ctor(	gc_memory_pool *const this,
+		size_t size,
+		gc_memory_pool* next,
+		gc_memory_pool* mirror,
+		uint8_t type
+	);
+
+void dtor(gc_memory_pool *const this);
+
+struct gc_pool_object_iterator
+{
+	struct gc_object_header* object;
+	#ifndef NDEBUG
+		intptr_t lower_limit;
+		intptr_t upper_limit;
+	#endif
+};
+
+void ctor(
+		gc_pool_object_iterator* const this,
+		void* start_object
+		#ifndef NDEBUG
+			, intptr_t pool_start
+			, intptr_t pool_end
+		#endif
+	);
+
+bool ?!=?(const gc_pool_object_iterator lhs, const gc_pool_object_iterator rhs);
+
+gc_pool_object_iterator begin(gc_memory_pool* const this);
+gc_pool_object_iterator end(gc_memory_pool* const);
+
+gc_pool_object_iterator* ++?(gc_pool_object_iterator* it);
+
+const void* *?(const gc_pool_object_iterator it);
+void* *?(gc_pool_object_iterator it);
+
+static inline bool gc_pool_is_from_space(const gc_memory_pool* pool)
+{
+	return false;
+}
+
+void gc_reset_pool(gc_memory_pool* const pool);
+
+static inline size_t gc_pool_size_used(const gc_memory_pool* pool)
+{
+	return pool->free_p - pool->start_p;
+}
+
+static inline size_t gc_pool_size_total(const gc_memory_pool* pool)
+{
+	return pool->end_p - pool->start_p;
+}
+
+static inline size_t gc_pool_size_left(const gc_memory_pool* pool)
+{
+	return pool->end_p - pool->free_p;
+}
+
+void* gc_pool_allocate(gc_memory_pool* const pool, size_t size, bool zero);
+
+gc_pool_object_iterator gc_pool_iterator_for(gc_memory_pool* const pool, void* member);
+
+void ctor(gc_memory_pool *const this, size_t size, gc_memory_pool* next, gc_memory_pool* mirror, uint8_t type)
+{
+	this->mirror = mirror;
+	this->next = next;
+	this->type_code = type;
+
+	this->cards = malloc();
+	ctor(this->cards);
+
+	this->end_p = ((uint8_t*)this) + size;
+	this->free_p = this->start_p;
+
+	// check(gc_pool_of(this) == this);
+	// check(this->cards);
+	// gc_reset_pool(this);
+}
Index: tests/zombies/gc_no_raii/bug-repro/find.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/find.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/find.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,10 @@
+
+void main()
+{
+	int a[3] = {1, 2, 3};
+	int* begin = a;
+	int *const end = begin + 3;
+
+	int* f = find(begin, &end, 2);
+
+}
Index: tests/zombies/gc_no_raii/bug-repro/inline.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/inline.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/inline.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,8 @@
+inline _Bool test(int t){
+	return t == 3;
+}
+
+int main()
+{
+	test(6);
+}
Index: tests/zombies/gc_no_raii/bug-repro/malloc.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/malloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/malloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,33 @@
+forall(otype T)
+struct wrapper
+{
+    T val;
+};
+
+forall(otype T)
+void ctor(wrapper(T)* this)
+{
+    this->val = 0;
+}
+
+forall(otype T)
+wrapper(T) gcmalloc()
+{
+    wrapper(T) w;
+    ctor(&w);
+    return w;
+}
+
+forall(otype T)
+wrapper(T)* ?=? (wrapper(T)* lhs, wrapper(T)* rhs)
+{
+    lhs->val = rhs->val;
+    return lhs;
+}
+
+int main(int argc, char *argv[])
+{
+    wrapper(int) test;
+    test = gcmalloc();
+    return 0;
+}
Index: tests/zombies/gc_no_raii/bug-repro/not_equal.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/not_equal.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/not_equal.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,10 @@
+
+struct pointer_t
+{
+	void* p;
+};
+
+_Bool operator_not_equal_p(pointer_t* lhs, pointer_t* rhs)
+{
+	return lhs->p == rhs->p;
+}
Index: tests/zombies/gc_no_raii/bug-repro/oddtype.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/oddtype.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/oddtype.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,13 @@
+forall(dtype T)
+struct wrap {
+	int i;
+};
+
+forall(otype T) void ?{}(wrap(T)* this) {}
+forall(otype T) void ?=?(wrap(T)* this) {}
+forall(otype T) void ^?{}(wrap(T)* this) {}
+
+struct List_t {
+	int val;
+	wrap(List_t) next;
+};
Index: tests/zombies/gc_no_raii/bug-repro/push_back.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/push_back.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/push_back.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,16 @@
+#include <stddef.h>
+#include <stdint.h>
+
+#include "push_back.h"
+
+typedef vector(intptr_t*, heap_allocator(intptr_t*)) worklist_t;
+
+void test()
+{
+	worklist_t w;
+	if(!empty(&w))
+	{
+		intptr_t zero = 0;
+		push_back(&w, &zero);
+	}
+}
Index: tests/zombies/gc_no_raii/bug-repro/push_back.h
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/push_back.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/push_back.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,72 @@
+//------------------------------------------------------------------------------
+//Declaration
+trait allocator_c(otype T, otype allocator_t) {
+	void ctor(allocator_t* const);
+	void dtor(allocator_t* const);
+	void realloc(allocator_t* const, size_t);
+	T* data(allocator_t* const);
+};
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+struct vector
+{
+	allocator_t storage;
+	size_t size;
+};
+
+//------------------------------------------------------------------------------
+//Initialization
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void vector_ctor(vector(T, allocator_t) *const this);
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void dtor(vector(T, allocator_t) *const this);
+
+//------------------------------------------------------------------------------
+//Allocator
+forall(otype T)
+struct heap_allocator
+{
+	T* storage;
+	size_t capacity;
+};
+
+forall(otype T)
+void ctor(heap_allocator(T) *const this);
+
+forall(otype T)
+void dtor(heap_allocator(T) *const this);
+
+forall(otype T)
+void realloc(heap_allocator(T) *const this, size_t size);
+
+forall(otype T)
+inline T* data(heap_allocator(T) *const this)
+{
+	return this->storage;
+}
+
+//------------------------------------------------------------------------------
+//Capacity
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline bool empty(vector(T, allocator_t) *const this)
+{
+	return this->size == 0;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline bool size(vector(T, allocator_t) *const this)
+{
+	return this->size;
+}
+
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+inline void reserve(vector(T, allocator_t) *const this, size_t size)
+{
+	realloc(&this->storage, this->size+1);
+}
+
+//------------------------------------------------------------------------------
+//Modifiers
+forall(otype T, otype allocator_t | allocator_c(T, allocator_t))
+void push_back(vector(T, allocator_t) *const this, T value);
Index: tests/zombies/gc_no_raii/bug-repro/realloc.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/realloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/realloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,13 @@
+void* realloc(void*, unsigned long int);
+
+forall(otype T)
+struct wrap
+{
+	T* val;
+};
+
+forall(otype T)
+static inline void realloc(wrap(T) *const this, unsigned long int size)
+{
+	this->val = (T*)realloc((void*)this->val, size);
+}
Index: tests/zombies/gc_no_raii/bug-repro/return.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/return.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/return.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,27 @@
+forall(otype T)
+struct wrapper
+{
+	T value;
+};
+
+forall(otype T)
+wrapper(T) create()
+{
+	wrapper(T) test;
+	return test;
+}
+
+forall(otype T)
+wrapper(T)* ?=?(wrapper(T)* lhs, wrapper(T)* rhs)
+{
+	lhs->value = rhs->value;
+	return lhs;
+}
+
+
+int main(int argc, char const *argv[])
+{
+	wrapper(int) test;
+	test = create();
+	return 0;
+}
Index: tests/zombies/gc_no_raii/bug-repro/return_template.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/return_template.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/return_template.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,17 @@
+forall(otype T)
+struct wrap
+{
+	T value;
+};
+
+forall(otype T) void ?{}(wrap(T)* this);
+forall(otype T) void ?{}(wrap(T)* this, wrap(T)* rhs);
+forall(otype T) void ^?{}(wrap(T)* this);
+forall(otype T) void ?=?(wrap(T)* this, wrap(T)* rhs);
+
+forall(otype T)
+wrap(T) test()
+{
+	wrap(T) tester;
+	return tester;
+}
Index: tests/zombies/gc_no_raii/bug-repro/slow_malloc.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/slow_malloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/slow_malloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,20 @@
+#include <stdlib.hfa>
+
+forall(otype T)
+struct heap_allocator
+{
+	T* storage;
+	size_t capacity;
+};
+
+struct card_table_t
+{
+	unsigned long int count;
+	void* cards_start[1000];
+};
+
+int main(int argc, char const *argv[])
+{
+	card_table_t* t = (card_table_t*)malloc(sizeof(card_table_t));
+	return 0;
+}
Index: tests/zombies/gc_no_raii/bug-repro/static_const_local.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/static_const_local.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/static_const_local.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,6 @@
+typedef unsigned long long size_t;
+
+int main(int argc, char const *argv[]) {
+	static const size_t GROWTH_RATE = 2;
+	return 0;
+}
Index: tests/zombies/gc_no_raii/bug-repro/test-assert.cpp
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/test-assert.cpp	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/test-assert.cpp	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,9 @@
+#include <cassert>
+#include "../src/tools/checks.h"
+
+int main(int argc, char* argv[])
+{
+	//check(false);
+	assert(false);
+	return 0;
+}
Index: tests/zombies/gc_no_raii/bug-repro/void_pointer.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/void_pointer.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/void_pointer.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,18 @@
+#include <stddef.h>
+#include <stdint.h>
+
+inline void* test(intptr_t address)
+{
+	return (void*)address;
+}
+
+//inline void* test2(void* address)
+//{
+//	return address & 0xFF;
+//}
+
+// inline int test()
+// {
+// 	void* d = 0;
+// 	return (int)d;
+// }
Index: tests/zombies/gc_no_raii/bug-repro/while.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/while.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/while.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,14 @@
+extern void* get_member();
+extern void* get_next();
+
+void main()
+{
+	void* member = get_member();
+	void* start_obj = get_next();
+
+	do
+	{
+		start_obj = (void*) ( ((unsigned long int)start_obj) + sizeof(void*) );
+	}
+	while(start_obj > member || !(start_obj) );
+}
Index: tests/zombies/gc_no_raii/bug-repro/zero.c
===================================================================
--- tests/zombies/gc_no_raii/bug-repro/zero.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/bug-repro/zero.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,25 @@
+forall(otype T)
+struct wrap
+{
+    T val;
+};
+
+forall(otype T)
+int ?==? (wrap(T) lhs, wrap(T) rhs)
+{
+    return 0;
+}
+
+/*
+struct wrap(int) 0;
+/*/
+forall(otype T)
+struct wrap(T) 0;
+//*/
+
+int main(int argc, char const *argv[])
+{
+    wrap(int) test;
+    if(test == 0) { return 1; }
+    return 0;
+}
Index: tests/zombies/gc_no_raii/pool-alloc/allocate-malign.c
===================================================================
--- tests/zombies/gc_no_raii/pool-alloc/allocate-malign.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/pool-alloc/allocate-malign.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,30 @@
+/*
+ * Allocation functions (posix_malign)
+ *
+ * Copyright (c) 2014, 2015 Gregor Richards
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+static void *allocPool(size_t size, int mustSucceed)
+{
+    void *ret;
+    if ((errno = posix_memalign(&ret, size, size))) {
+        if (mustSucceed) {
+            perror("posix_memalign");
+            abort();
+        }
+        return NULL;
+    }
+    return ret;
+}
Index: tests/zombies/gc_no_raii/pool-alloc/allocate-malloc.c
===================================================================
--- tests/zombies/gc_no_raii/pool-alloc/allocate-malloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/pool-alloc/allocate-malloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,53 @@
+/*
+ * Allocation functions (malloc)
+ *
+ * Copyright (c) 2014, 2015 Gregor Richards
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+static void *allocPool(int mustSucceed)
+{
+    static ggc_mutex_t poolLock = GGC_MUTEX_INITIALIZER;
+    static unsigned char *space = NULL, *spaceEnd = NULL;
+    void *ret;
+
+    /* do we already have some available space? */
+    ggc_mutex_lock_raw(&poolLock);
+    if (!space || space + GGGGC_POOL_BYTES > spaceEnd) {
+        ggc_size_t i;
+
+        /* since we can't pre-align, align by getting as much as we can manage */
+        for (i = 16; i >= 2; i /= 2) {
+            space = malloc(GGGGC_POOL_BYTES * i);
+            if (space) break;
+        }
+        if (!space) {
+            if (mustSucceed) {
+                perror("malloc");
+                abort();
+            }
+            return NULL;
+        }
+        spaceEnd = space + GGGGC_POOL_BYTES * i;
+
+        /* align it */
+        space = (unsigned char *) GGGGC_POOL_OF(space + GGGGC_POOL_BYTES - 1);
+    }
+
+    ret = (struct GGGGC_Pool *) space;
+    space += GGGGC_POOL_BYTES;
+    ggc_mutex_unlock(&poolLock);
+
+    return ret;
+}
Index: tests/zombies/gc_no_raii/pool-alloc/allocate-mmap.c
===================================================================
--- tests/zombies/gc_no_raii/pool-alloc/allocate-mmap.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/pool-alloc/allocate-mmap.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,44 @@
+/*
+ * Allocation functions (mmap)
+ *
+ * Copyright (c) 2014, 2015 Gregor Richards
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+static void *allocPool(int mustSucceed)
+{
+    unsigned char *space, *aspace;
+    struct GGGGC_Pool *ret;
+
+    /* allocate enough space that we can align it later */
+    space = mmap(NULL, GGGGC_POOL_BYTES*2, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
+    if (space == NULL) {
+        if (mustSucceed) {
+            perror("mmap");
+            abort();
+        }
+        return NULL;
+    }
+
+    /* align it */
+    ret = GGGGC_POOL_OF(space + GGGGC_POOL_BYTES - 1);
+    aspace = (unsigned char *) ret;
+
+    /* free unused space */
+    if (aspace > space)
+        munmap(space, aspace - space);
+    munmap(aspace + GGGGC_POOL_BYTES, space + GGGGC_POOL_BYTES - aspace);
+
+    return ret;
+}
Index: tests/zombies/gc_no_raii/pool-alloc/allocate-win-valloc.c
===================================================================
--- tests/zombies/gc_no_raii/pool-alloc/allocate-win-valloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/pool-alloc/allocate-win-valloc.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,45 @@
+/*
+ * Allocation functions (mmap)
+ *
+ * Copyright (c) 2014, 2015 Gregor Richards
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+static void *allocPool(int mustSucceed)
+{
+    unsigned char *space, *aspace;
+    struct GGGGC_Pool *ret;
+
+    /* allocate enough space that we can align it later */
+    space = (unsigned char *)
+        VirtualAlloc(NULL, GGGGC_POOL_BYTES*2, MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
+    if (space == NULL) {
+        if (mustSucceed) {
+            perror("mmap");
+            abort();
+        }
+        return NULL;
+    }
+
+    /* align it */
+    ret = GGGGC_POOL_OF(space + GGGGC_POOL_BYTES - 1);
+    aspace = (unsigned char *) ret;
+
+    /* free unused space */
+    if (aspace > space)
+        VirtualFree(space, aspace - space, MEM_RELEASE);
+    VirtualFree(aspace + GGGGC_POOL_BYTES, space + GGGGC_POOL_BYTES - aspace, MEM_RELEASE);
+
+    return ret;
+}
Index: tests/zombies/gc_no_raii/premake4.lua
===================================================================
--- tests/zombies/gc_no_raii/premake4.lua	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/premake4.lua	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,82 @@
+#!lua
+
+-- Additional Linux libs: "X11", "Xxf86vm", "Xi", "Xrandr", "stdc++"
+
+includeDirList = {
+	"src/",
+	"../"
+}
+
+libDirectories = {
+
+}
+
+
+if os.get() == "linux" then
+    linkLibs = {
+
+    }
+end
+
+-- Build Options:
+buildOptions = {
+      "-g",
+	"-DTEST_FILE=${test}",
+      "\n  test = gctest",
+	"\n  CC = cfa\n  CXX = cfa", }
+
+solution "GC-no-RAII"
+	configurations  { "debug", "release",
+				"cproc-debug", "cproc-release",
+				"cfa-debug", "cfa-release" }
+
+	project "gc-test"
+		kind "ConsoleApp"
+		language "C"
+		location "build"
+		objdir "build"
+		targetdir "."
+		buildoptions (buildOptions)
+		defines {	"bool=_Bool",
+				"\"true=((_Bool)(const signed int)1)\"",
+				"\"false=((_Bool)(const signed int)0)\"",
+				"_GNU_SOURCE",
+				"__cforall"
+			}
+		libdirs (libDirectories)
+		links (linkLibs)
+		linkoptions (linkOptionList)
+		includedirs (includeDirList)
+		files { "src/**.c", "containers/**.c" }
+
+	configuration "debug"
+		defines { "DEBUG" }
+		flags { "Symbols" }
+
+	configuration "release"
+		defines { "NDEBUG" }
+		flags { "Optimize" }
+
+	configuration "cproc-debug"
+		buildoptions ({"-E"})
+		linkoptions ({"-E"})
+	      defines { "DEBUG" }
+	      flags { "Symbols" }
+
+	configuration "cproc-release"
+		buildoptions ({"-E"})
+		linkoptions ({"-E"})
+	      defines { "DEBUG" }
+	      flags { "Symbols" }
+
+	configuration "cfa-debug"
+		linkoptions ({"-E"})
+		files { "build/cproc-debug/*.o" }
+	      defines { "DEBUG" }
+	      flags { "Symbols" }
+
+	configuration "cfa-release"
+		linkoptions ({"-E"})
+		files { "build/cproc-debug/*.o" }
+	      defines { "DEBUG" }
+	      flags { "Symbols" }
Index: tests/zombies/gc_no_raii/src/allocate-pool.c
===================================================================
--- tests/zombies/gc_no_raii/src/allocate-pool.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/allocate-pool.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,64 @@
+#define _BSD_SOURCE /* for MAP_ANON */
+#define _DARWIN_C_SOURCE /* for MAP_ANON on OS X */
+
+#ifdef __cforall
+extern "C"{
+#else
+#error missing cfa define
+#endif
+
+/* for standards info */
+#if defined(unix) || defined(__unix) || defined(__unix__) || \
+    (defined(__APPLE__) && defined(__MACH__))
+#include <unistd.h>
+#endif
+
+#if defined(_WIN32)
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+
+#if _POSIX_VERSION
+#include <sys/mman.h>
+#endif
+
+/* figure out which allocator to use */
+#if defined(GGGGC_USE_MALLOC)
+#define GGGGC_ALLOCATOR_MALLOC 1
+#include "../pool-alloc/allocate-malloc.c"
+
+#elif _POSIX_ADVISORY_INFO >= 200112L
+#define GGGGC_ALLOCATOR_POSIX_MEMALIGN 1
+#include "../pool-alloc/allocate-malign.c"
+
+#elif defined(MAP_ANON)
+#define GGGGC_ALLOCATOR_MMAP 1
+#include "../pool-alloc/allocate-mmap.c"
+
+#elif defined(_WIN32)
+#define GGGGC_ALLOCATOR_VIRTUALALLOC 1
+#include "../pool-alloc/allocate-win-valloc.c"
+
+#else
+#warning GGGGC: No allocator available other than malloc!
+#define GGGGC_ALLOCATOR_MALLOC 1
+#include "../pool-alloc/allocate-malloc.c"
+
+#endif
+
+void* pal_allocPool(size_t size, int mustSucceed)
+{
+      return allocPool(size, mustSucceed);
+}
+
+#ifdef __cforall
+}
+#endif
Index: tests/zombies/gc_no_raii/src/allocate-pool.h
===================================================================
--- tests/zombies/gc_no_raii/src/allocate-pool.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/allocate-pool.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,14 @@
+#ifndef _GGGGC_ALlOCATE_POOL_H_
+#define _GGGGC_ALlOCATE_POOL_H_
+
+#ifdef __cforall
+extern "C" {
+#endif
+
+void* pal_allocPool(size_t size, int mustSucceed);
+
+#ifdef __cforall
+}
+#endif
+
+#endif
Index: tests/zombies/gc_no_raii/src/gc.h
===================================================================
--- tests/zombies/gc_no_raii/src/gc.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/gc.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,21 @@
+#pragma once
+
+#include "gcpointers.h"
+#include "internal/collector.h"
+
+// forall(otype T)
+// static inline gcpointer(T) gcmalloc()
+// {
+//     gcpointer(T) ptr = { gc_allocate(sizeof(T)) };
+//     ptr{};
+//     gc_conditional_collect();
+//     return ptr;
+// }
+
+forall(otype T)
+static inline void gcmalloc(gcpointer(T)* ptr)
+{
+	ptr { gc_allocate(sizeof(T)) };
+	get(ptr) {};
+      gc_conditional_collect();
+}
Index: tests/zombies/gc_no_raii/src/gcpointers.c
===================================================================
--- tests/zombies/gc_no_raii/src/gcpointers.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/gcpointers.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,147 @@
+#include "gcpointers.h"
+
+// #include "gc.h"
+#include "internal/collector.h"
+#include "internal/object_header.h"
+#include "internal/state.h"
+
+void register_ptr(gcpointer_t* this)
+{
+	if(gcpointer_null(this)) return;
+
+	if(gc_is_managed(this))
+	{
+		gc_object_header* obj = gc_get_object_for_ref(gc_get_state(), (void*)this);
+		check(obj);
+		check(is_valid(obj));
+		check(gc_is_managed(this) == gc_is_managed(obj->type_chain) || !obj->type_chain);
+		this->next = obj->type_chain;
+		obj->type_chain = this;
+		check(is_valid(obj));
+	}
+	else
+	{
+		gc_object_header* obj = gc_get_object_ptr((void*)this->ptr);
+		check(obj);
+		check(is_valid(obj));
+		check(!obj->root_chain || this->ptr == obj->root_chain->ptr);
+		check(!obj->root_chain || gc_is_managed(this) == gc_is_managed(obj->root_chain));
+		this->next = obj->root_chain;
+		obj->root_chain = this;
+		check(is_valid(obj));
+	}
+}
+
+void unregister_ptr(gcpointer_t* this)
+{
+	if(gcpointer_null(this)) return;
+
+	gcpointer_t** prev_next_ptr = gc_find_previous_ref(this);
+	check((*prev_next_ptr) == this);
+
+	(*prev_next_ptr) = this->next;
+}
+
+void ?{}(gcpointer_t* this)
+{
+	this->ptr = (intptr_t)NULL;
+	this->next = NULL;
+}
+
+void ?{}(gcpointer_t* this, void* address)
+{
+	this->ptr = (intptr_t)address;
+	this->next = NULL;
+
+	register_ptr(this);
+}
+
+void ?{}(gcpointer_t* this, gcpointer_t other)
+{
+	this->ptr = other.ptr;
+	this->next = NULL;
+
+	register_ptr(this);
+}
+
+void ^?{}(gcpointer_t* this)
+{
+	unregister_ptr(this);
+}
+
+gcpointer_t ?=?(gcpointer_t* this, gcpointer_t rhs)
+{
+	unregister_ptr(this);
+	this->ptr = rhs.ptr;
+	register_ptr(this);
+
+	return *this;
+}
+
+//Logical operators
+bool gcpointer_equal(const gcpointer_t* this, const gcpointer_t* rhs)
+{
+	return this->ptr == rhs->ptr;
+}
+
+bool gcpointer_not_equal(const gcpointer_t* this, const gcpointer_t* rhs)
+{
+	return this->ptr != rhs->ptr;
+}
+
+bool gcpointer_null(const gcpointer_t* this)
+{
+	return this->ptr == (intptr_t)NULL;
+}
+
+#ifndef NDEBUG
+	bool is_valid(const gcpointer_t* this) {
+		if(gcpointer_null(this)) return true;
+
+		gc_object_header* obj = gc_get_object_ptr((void*)this->ptr);
+		check(obj);
+		check(is_valid(obj));
+		check(!obj->root_chain || this->ptr == obj->root_chain->ptr);
+
+		if( !gc_is_managed(this))
+		{
+			check( !(this->next) || this->ptr == this->next->ptr );
+		}
+
+		return true;
+	}
+#endif
+
+forall(otype T) void ?{}(gcpointer(T)* this) {
+	(&this->internal) {};
+}
+
+forall(otype T) void ?{}(gcpointer(T)* this, void* address) {
+	(&this->internal) { address };
+}
+
+forall(otype T) void ?{}(gcpointer(T)* this, gcpointer(T) other) {
+	(&this->internal) { other.internal };
+}
+
+forall(otype T) void ^?{}(gcpointer(T)* this) {
+	^?{}(&this->internal);
+}
+
+forall(otype T) gcpointer(T) ?=?(gcpointer(T)* this, gcpointer(T) rhs) {
+	this->internal = rhs.internal;
+	return *this;
+}
+//
+// forall(otype T) T *?(gcpointer(T) this);
+
+forall(otype T) T* get(gcpointer(T)* this) {
+	return (T*)this->internal.ptr;
+}
+//
+// //Logical operators
+forall(otype T) int ?!=?(gcpointer(T) this, int zero) {
+	return this.internal.ptr != 0;
+}
+// forall(otype T) int ?!=?(gcpointer(T) this, gcpointer(T) rhs);
+// forall(otype T) int ?==?(gcpointer(T) this, gcpointer(T) rhs);
Index: tests/zombies/gc_no_raii/src/gcpointers.h
===================================================================
--- tests/zombies/gc_no_raii/src/gcpointers.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/gcpointers.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,51 @@
+#pragma once
+
+#include <stdbool.h>
+#include <stdint.h>
+
+forall(dtype T)
+struct gcpointer;
+
+struct gcpointer_t
+{
+	intptr_t ptr;
+	struct gcpointer_t* next;
+};
+
+void ?{}(gcpointer_t* this);
+void ?{}(gcpointer_t* this, void* address);
+void ?{}(gcpointer_t* this, gcpointer_t other);
+void ^?{}(gcpointer_t* this);
+gcpointer_t ?=?(gcpointer_t* this, gcpointer_t rhs);
+
+//Logical operators
+bool gcpointer_equal(gcpointer_t* this, gcpointer_t* rhs);
+bool gcpointer_not_equal(gcpointer_t* this, gcpointer_t* rhs);
+bool gcpointer_null(const gcpointer_t* this);
+
+
+#ifndef NDEBUG
+	bool is_valid(const gcpointer_t* this);
+#endif
+
+forall(dtype T)
+struct gcpointer
+{
+	gcpointer_t internal;
+};
+
+//
+forall(otype T) void ?{}(gcpointer(T)* this);
+forall(otype T) void ?{}(gcpointer(T)* this, void* address);
+forall(otype T) void ?{}(gcpointer(T)* this, gcpointer(T) other);
+forall(otype T) void ^?{}(gcpointer(T)* this);
+forall(otype T) gcpointer(T) ?=?(gcpointer(T)* this, gcpointer(T) rhs);
+
+
+// forall(otype T) T *?(gcpointer(T) this);
+forall(otype T) T* get(gcpointer(T)* this);
+
+//Logical operators
+forall(otype T) int ?!=?(gcpointer(T) this, int zero);
+forall(otype T) int ?!=?(gcpointer(T) this, gcpointer(T) rhs);
+forall(otype T) int ?==?(gcpointer(T) this, gcpointer(T) rhs);
Index: tests/zombies/gc_no_raii/src/internal/card_table.h
===================================================================
--- tests/zombies/gc_no_raii/src/internal/card_table.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/internal/card_table.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,62 @@
+#pragma once
+
+#include "globals.h"
+#include "tools.h"
+
+static inline size_t card_of(void* address)
+{
+	size_t card = ( ((intptr_t)address) & CARDS_OFFSET_MASK ) >> CARDS_SIZE_EXP;
+	checkf(card < CARDS_COUNT, (const char*)"%lu %lu = (%lx & %lx) >> %lu\n", (size_t)CARDS_COUNT, (size_t)card, (size_t)address, (size_t)CARDS_OFFSET_MASK, (size_t)CARDS_SIZE_EXP);
+	check(card < CARDS_COUNT);
+	return card;
+}
+
+struct card_table_t
+{
+	size_t count;
+	void* cards_start[CARDS_COUNT];
+};
+
+static inline void ?{}(card_table_t* this)
+{
+	this->count = 0;
+}
+
+static inline void ^?{}(card_table_t* this)
+{
+
+}
+
+static inline void* object_at(card_table_t* const this, size_t card_number)
+{
+	return card_number < this->count ? this->cards_start[card_number] : NULL;
+}
+
+static inline void register_object(card_table_t* const this, void* object)
+{
+	size_t card = card_of(object);
+	if(card < this->count)
+	{
+		intptr_t card_obj_add = (intptr_t)object_at(this, card);
+		intptr_t obj_add = (intptr_t)object;
+		if(card_obj_add > obj_add)
+		{
+			this->cards_start[card] = object;
+		}
+	}
+	else
+	{
+		check(card == this->count);
+		this->count++;
+		this->cards_start[card] = object;
+	}
+}
+
+static inline void reset(card_table_t* const this)
+{
+	for(size_t i = 0; i < this->count; i++)
+	{
+		this->cards_start[i] = NULL;
+	}
+	this->count = 0;
+}
Index: tests/zombies/gc_no_raii/src/internal/collector.c
===================================================================
--- tests/zombies/gc_no_raii/src/internal/collector.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/internal/collector.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,152 @@
+#include "collector.h"
+
+#ifdef __cforall
+extern "C" {
+#endif
+#include <string.h>
+#ifdef __cforall
+}
+#endif
+
+#include <fstream.hfa>
+
+#include "state.h"
+#include "gcpointers.h"
+#include "memory_pool.h"
+
+void* gc_finish_alloc_block(void* block, size_t actual_size, size_t target_size);
+void gc_assign_reference(void** ref, gc_object_header* ptr);
+
+gcpointer_t** gc_find_previous_ref(gcpointer_t* target)
+{
+	if(!(target)) return NULL;
+
+	bool managed = gc_is_managed(target);
+	gc_object_header* obj = gc_get_object_ptr((void*)target->ptr);
+
+	check(is_valid(obj));
+
+	gcpointer_t** prev_next_ptr = managed ? &obj->type_chain : &obj->root_chain;
+	while((*prev_next_ptr) && (*prev_next_ptr) != target)
+	{
+		prev_next_ptr = &(*prev_next_ptr)->next;
+	}
+
+	return prev_next_ptr;
+}
+
+void* gc_allocate(size_t target_size)
+{
+	// sout | "Allocating " | target_size | " bytes";
+
+	size_t size = gc_compute_size(target_size + sizeof(gc_object_header));
+
+	// sout | "Object header size: " | sizeof(gc_object_header) | " bytes";
+	// sout | "Actual allocation size: " | size | " bytes";
+
+	check(size < POOL_SIZE_BYTES);
+
+	void* block = NULL;
+	gc_state* gc = gc_get_state();
+
+	if((intptr_t)(block = gc_try_allocate(gc, size))) return gc_finish_alloc_block(block, size, target_size);
+
+	gc_collect(gc);
+
+	if((intptr_t)(block = gc_try_allocate(gc, size))) return gc_finish_alloc_block(block, size, target_size);
+
+	gc_allocate_pool(gc);
+
+	if((intptr_t)(block = gc_try_allocate(gc, size))) return gc_finish_alloc_block(block, size, target_size);
+
+	checkf( (int) 0, "ERROR: allocation in new pool failed");
+
+	return NULL;
+}
+
+void* gc_finish_alloc_block(void* block, size_t actual_size, size_t target_size)
+{
+	intptr_t data = ((intptr_t)block) + sizeof(gc_object_header);
+	void* header = block;
+
+	check( data > ((intptr_t)block));
+	check( data >= ((intptr_t)header));
+	check( gc_is_aligned( (void*)data ) );
+	check( data + target_size <= ((intptr_t)block) + actual_size );
+
+	gc_object_header* obj = placement_ctor(header, actual_size);
+
+	(void)obj; //remove unsused warning since this is for debug
+	check(obj == gc_get_object_ptr( (void*)data ));
+
+	gc_register_allocation(gc_get_state(), actual_size);
+
+	return (void*)data;
+}
+
+void gc_process_reference(void** ref, worklist_t* worklist)
+{
+	check(!gc_is_in_heap(gc_get_state(), ref));
+
+	gc_object_header* ptr = gc_get_object_ptr(*ref);
+	if(ptr)
+	{
+		if(!ptr->is_forwarded)
+		{
+			gc_copy_object(ptr);
+
+			gc_scan_object(ptr->forward, worklist);
+
+			gc_assign_reference(ref, ptr->forward);
+		}
+		else
+		{
+			//duplication to help debug
+			gc_assign_reference(ref, ptr->forward);
+		}
+	}
+}
+
+void gc_assign_reference(void** ref, gc_object_header* ptr)
+{
+	void* address = (void*)(((intptr_t)ptr) + sizeof(gc_object_header));
+
+	gc_write_aligned_ptr(ref, address);
+}
+
+gc_object_header* gc_copy_object(gc_object_header* ptr)
+{
+	check(!ptr->forward);
+	check(!ptr->is_forwarded);
+	check(gc_pool_is_from_space(gc_pool_of(ptr)));
+
+	gc_memory_pool* pool = gc_pool_of(ptr)->mirror;
+
+	void* new_block = gc_pool_allocate(pool, ptr->size, true);
+
+	memcpy(new_block, ptr, ptr->size);
+
+	gc_object_header* fwd_ptr = placement_copy_ctor(new_block, ptr);
+
+	ptr->forward = fwd_ptr;
+	ptr->is_forwarded = true;
+
+	return fwd_ptr;
+}
+
+void gc_scan_object(gc_object_header* object, worklist_t* worklist)
+{
+	gcpointer_t* field = object->type_chain;
+	while(field)
+	{
+		check(((intptr_t)field) > ((intptr_t)object));
+		check(((intptr_t)field) < ((intptr_t)((intptr_t)object) + object->size));
+
+		check(gc_is_in_to_space(gc_get_state(), &field->ptr));
+
+		intptr_t* ref = &field->ptr;
+		push_back(worklist, ref);
+
+		field = field->next;
+	}
+}
Index: tests/zombies/gc_no_raii/src/internal/collector.h
===================================================================
--- tests/zombies/gc_no_raii/src/internal/collector.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/internal/collector.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,47 @@
+#pragma once
+
+#include <stdlib.h>
+
+#include "tools.h"
+//
+#include "gcpointers.h"
+#include "state.h"
+#include "internal/gc_tools.h"
+#include "internal/globals.h"
+#include "internal/object_header.h"
+#include "internal/state.h"
+#include "tools/worklist.h"
+
+static inline bool gc_is_managed(void* address)
+{
+	return gc_is_in_heap(gc_get_state(), address);
+}
+
+static inline gc_object_header* gc_get_object_ptr(void* ptr)
+{
+	void* clean = gc_get_aligned_ptr(ptr);
+	return ((gc_object_header*)clean) - 1;
+}
+
+static inline struct gc_memory_pool* gc_pool_of(void* address)
+{
+	return (struct gc_memory_pool*)(((intptr_t)address) & POOL_PTR_MASK);
+}
+
+static inline void gc_conditional_collect()
+{
+	if(gc_needs_collect(gc_get_state()))
+	{
+		gc_collect(gc_get_state());
+	}
+}
+
+gcpointer_t** gc_find_previous_ref(gcpointer_t* target);
+
+void* gc_allocate(size_t size);
+
+void gc_process_reference(void** ref, worklist_t* worklist);
+
+struct gc_object_header* gc_copy_object(struct gc_object_header* ptr);
+
+void gc_scan_object(struct gc_object_header* object, worklist_t* worklist);
Index: tests/zombies/gc_no_raii/src/internal/gc_tools.h
===================================================================
--- tests/zombies/gc_no_raii/src/internal/gc_tools.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/internal/gc_tools.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,40 @@
+#pragma once
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "tools.h"
+#include "globals.h"
+
+static inline bool gc_is_aligned(void* address)
+{
+	return (((intptr_t)address) & (~OBJECT_PTR_MASK)) == 0;
+}
+
+static inline void* gc_get_aligned_ptr(void* address)
+{
+	return (void*)(((intptr_t)address) & (OBJECT_PTR_MASK));
+}
+
+static inline void* gc_write_aligned_ptr(void** reference, void* address)
+{
+	size_t ref_last_bits = ((intptr_t)*reference) & (~OBJECT_PTR_MASK);
+
+      size_t new_val = ((intptr_t)address) & OBJECT_PTR_MASK;
+
+      (*reference) = (void*)(new_val | ref_last_bits);
+
+	return *reference;
+}
+
+static inline size_t gc_compute_size(size_t size)
+{
+	size_t word_size = ((size - 1) / OBJECT_ALLIGNMENT) + 1;
+	size_t ret = word_size * OBJECT_ALLIGNMENT;
+
+	check(ret >= size);
+	check((ret % OBJECT_ALLIGNMENT) == 0);
+	check( ((size % OBJECT_ALLIGNMENT) != 0) || (ret == size) );
+
+	return ret;
+}
Index: tests/zombies/gc_no_raii/src/internal/globals.h
===================================================================
--- tests/zombies/gc_no_raii/src/internal/globals.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/internal/globals.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,30 @@
+#pragma once
+
+// #include <stddef.h>
+// #include <stdint.h>
+//
+// static const size_t POOL_SIZE_EXP = 24;
+// static const size_t POOL_SIZE_BYTES = 0x1 << POOL_SIZE_EXP;
+// static const size_t POOL_PTR_MASK = ~(POOL_SIZE_BYTES - 1);
+//
+// static const size_t CARDS_SIZE_EXP = 12;
+// static const size_t CARDS_SIZE_BYTES = 0x1 << CARDS_SIZE_EXP;
+// static const size_t CARDS_OFFSET_MASK = (~(CARDS_SIZE_BYTES - 1)) & (POOL_SIZE_BYTES - 1);
+// static const size_t CARDS_COUNT = POOL_SIZE_BYTES / CARDS_SIZE_BYTES;
+//
+// static const size_t OBJECT_ALLIGNMENT = sizeof(size_t);
+// static const size_t OBJECT_PTR_MASK = ~(OBJECT_ALLIGNMENT - 1);
+
+enum {
+	POOL_SIZE_EXP 	= 24,
+	POOL_SIZE_BYTES 	= 0x1 << POOL_SIZE_EXP,
+	POOL_PTR_MASK 	= ~(POOL_SIZE_BYTES - 1),
+
+	CARDS_SIZE_EXP 	= 12,
+	CARDS_SIZE_BYTES 	= 0x1 << CARDS_SIZE_EXP,
+	CARDS_OFFSET_MASK	= (~(CARDS_SIZE_BYTES - 1)) & (POOL_SIZE_BYTES - 1),
+	CARDS_COUNT 	= POOL_SIZE_BYTES / CARDS_SIZE_BYTES,
+
+	OBJECT_ALLIGNMENT	= sizeof(size_t),
+	OBJECT_PTR_MASK 	= ~(OBJECT_ALLIGNMENT - 1),
+};
Index: tests/zombies/gc_no_raii/src/internal/memory_pool.c
===================================================================
--- tests/zombies/gc_no_raii/src/internal/memory_pool.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/internal/memory_pool.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,160 @@
+#include "memory_pool.h"
+
+extern "C" {
+	#include <stdlib.h>
+	#include <string.h>
+}
+
+#include "collector.h"
+#include "object_header.h"
+
+const size_t gc_pool_header_size = (size_t)(  &(((gc_memory_pool*)NULL)->start_p) );
+
+void ?{}(gc_memory_pool* this, size_t size, gc_memory_pool* next, gc_memory_pool* mirror, uint8_t type)
+{
+	this->mirror = mirror;
+	this->next = next;
+	this->type_code = type;
+
+	this->cards = ( (card_table_t*)malloc(sizeof(card_table_t)) ){};
+
+	this->end_p = ((uint8_t*)this) + size;
+	this->free_p = this->start_p;
+
+	check( gc_pool_of( (void*)this ) == this);
+	check(this->cards);
+	gc_reset_pool(this);
+}
+
+void ^?{}(gc_memory_pool* this)
+{
+	^(&this->cards){};
+	free(this->cards);
+}
+
+void gc_reset_pool(gc_memory_pool *const this)
+{
+	this->free_p = this->start_p;
+	#ifndef NDEBUG
+		memset(this->start_p, 0xCD, gc_pool_size_total(this));
+	#endif
+
+	check(this->cards);
+	reset(this->cards);
+
+	check(gc_pool_size_left(this) == gc_pool_size_total(this));
+}
+
+void* gc_pool_allocate(gc_memory_pool *const this, size_t size, bool zero)
+{
+	void* ret = this->free_p;
+
+	this->free_p += size;
+
+	if (zero) memset(ret, 0x00, size);
+
+	check(this->cards);
+	register_object(this->cards, ret);
+
+	return ret;
+}
+
+void ?{}(	gc_pool_object_iterator* this,
+		struct gc_object_header* start_object
+		#ifndef NDEBUG
+			, intptr_t pool_start
+			, intptr_t pool_end
+		#endif
+	)
+{
+	this->object = start_object;
+	#ifndef NDEBUG
+		this->lower_limit = pool_start;
+		this->upper_limit = pool_end;
+	#endif
+
+	check( ((intptr_t)start_object) >= this->lower_limit );
+	check( ((intptr_t)start_object) <= this->upper_limit );
+}
+
+void ^?{}( gc_pool_object_iterator* this ) {}
+
+gc_pool_object_iterator gc_pool_iterator_for(gc_memory_pool* const this, void* member)
+{
+	size_t card = card_of(member);
+	intptr_t member_add = (intptr_t)member;
+	intptr_t start_obj;
+
+	do
+	{
+		check(card < CARDS_COUNT);
+		start_obj = (intptr_t)object_at(this->cards, card);
+		check(card != 0 || start_obj);
+		card--;
+	}
+	while(start_obj > member_add || !(start_obj));
+
+	check( start_obj );
+
+	struct gc_object_header* start_obj_typed = (struct gc_object_header*)start_obj;
+
+	return (gc_pool_object_iterator) {
+		start_obj_typed
+		#ifndef NDEBUG
+			, (intptr_t)this->start_p
+			, (intptr_t)this->free_p
+		#endif
+	};
+}
+
+bool ?!=?(const gc_pool_object_iterator lhs, const gc_pool_object_iterator rhs)
+{
+	return lhs.object != rhs.object;
+}
+
+gc_pool_object_iterator begin(gc_memory_pool* const this)
+{
+	struct gc_object_header* start_obj = (struct gc_object_header*)this->start_p;
+	return (gc_pool_object_iterator) {
+		start_obj
+		#ifndef NDEBUG
+			, (intptr_t)this->start_p
+			, (intptr_t)this->free_p
+		#endif
+	};
+}
+
+gc_pool_object_iterator end(gc_memory_pool* const this)
+{
+	return (gc_pool_object_iterator) {
+		(struct gc_object_header*)this->free_p
+		#ifndef NDEBUG
+			, (intptr_t)this->start_p
+			, (intptr_t)this->free_p
+		#endif
+	};
+}
+
+gc_pool_object_iterator* ++?(gc_pool_object_iterator* it)
+{
+	struct gc_object_header* object = it->object;
+	intptr_t next_ptr = ((intptr_t)object) + object->size;
+	check(next_ptr > it->lower_limit);
+	check(next_ptr <= it->upper_limit);
+
+	struct gc_object_header* next_obj = ((struct gc_object_header*)next_ptr);
+	check(next_ptr == it->upper_limit || is_valid(next_obj));
+
+	it->object = next_obj;
+	return it;
+}
+
+const struct gc_object_header* *?(const gc_pool_object_iterator it)
+{
+	return it.object;
+}
+
+struct gc_object_header* *?(gc_pool_object_iterator it)
+{
+	return it.object;
+}
Index: tests/zombies/gc_no_raii/src/internal/memory_pool.h
===================================================================
--- tests/zombies/gc_no_raii/src/internal/memory_pool.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/internal/memory_pool.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,92 @@
+#pragma once
+
+extern "C" {
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+}
+
+#include "tools.h"
+
+#include "card_table.h"
+#include "globals.h"
+#include "state.h"
+
+struct gc_memory_pool
+{
+	struct memory_pool* mirror;
+	struct memory_pool* next;
+
+	uint8_t type_code;
+
+	card_table_t* cards;
+
+	uint8_t* end_p;
+	uint8_t* free_p;
+	uint8_t start_p[1];
+};
+
+void ?{}(	gc_memory_pool* this,
+		size_t size,
+		gc_memory_pool* next,
+		gc_memory_pool* mirror,
+		uint8_t type
+	);
+
+void ^?{}(gc_memory_pool* this);
+
+struct gc_pool_object_iterator
+{
+	struct gc_object_header* object;
+	#ifndef NDEBUG
+		intptr_t lower_limit;
+		intptr_t upper_limit;
+	#endif
+};
+
+
+void ?{}( 	gc_pool_object_iterator* this,
+		struct gc_object_header* start_object
+		#ifndef NDEBUG
+			, intptr_t pool_start
+			, intptr_t pool_end
+		#endif
+	);
+
+void ^?{}( gc_pool_object_iterator* this );
+
+bool ?!=?(const gc_pool_object_iterator lhs, const gc_pool_object_iterator rhs);
+
+gc_pool_object_iterator begin(gc_memory_pool* const this);
+gc_pool_object_iterator end(gc_memory_pool* const);
+
+gc_pool_object_iterator* ++?(gc_pool_object_iterator* it);
+
+const struct gc_object_header* *?(const gc_pool_object_iterator it);
+struct gc_object_header* *?(gc_pool_object_iterator it);
+
+static inline bool gc_pool_is_from_space(const gc_memory_pool* pool)
+{
+	return gc_from_space_code(gc_get_state()) == pool->type_code;
+}
+
+void gc_reset_pool(gc_memory_pool* const pool);
+
+static inline size_t gc_pool_size_used(const gc_memory_pool* pool)
+{
+	return pool->free_p - pool->start_p;
+}
+
+static inline size_t gc_pool_size_total(const gc_memory_pool* pool)
+{
+	return pool->end_p - pool->start_p;
+}
+
+static inline size_t gc_pool_size_left(const gc_memory_pool* pool)
+{
+	return pool->end_p - pool->free_p;
+}
+
+void* gc_pool_allocate(gc_memory_pool* const pool, size_t size, bool zero);
+
+gc_pool_object_iterator gc_pool_iterator_for(gc_memory_pool* const pool, void* member);
Index: tests/zombies/gc_no_raii/src/internal/object_header.c
===================================================================
--- tests/zombies/gc_no_raii/src/internal/object_header.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/internal/object_header.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,110 @@
+#include "object_header.h"
+
+#include <stdint.h>
+
+#include "collector.h"
+#include "globals.h"
+#include "gcpointers.h"
+
+void ctor(gc_object_header* const this, size_t inSize)
+{
+	#ifndef NDEBUG
+		this->canary_start = CANARY_VALUE;
+	#endif
+
+	this->size = inSize;
+	this->root_chain = NULL;
+	this->type_chain = NULL;
+	this->forward = NULL;
+	this->is_forwarded = false;
+
+	#ifndef NDEBUG
+		this->canary_end = CANARY_VALUE;
+	#endif
+}
+
+void copy_ctor(gc_object_header* const this, const gc_object_header* const other)
+{
+	#ifndef NDEBUG
+		this->canary_start = CANARY_VALUE;
+	#endif
+
+	this->size = other->size;
+	this->root_chain = other->root_chain;
+	this->type_chain = NULL;
+	this->forward = NULL;
+	this->is_forwarded = false;
+
+	#ifndef NDEBUG
+		this->canary_end = CANARY_VALUE;
+	#endif
+
+	gcpointer_t* root = this->root_chain;
+	while(root)
+	{
+		check(gc_get_object_ptr( (void*)root->ptr ) == other);
+		root->ptr = ((intptr_t)this) + sizeof(gc_object_header);
+
+		check(gc_get_object_ptr( (void*)root->ptr ) == this);
+		root = root->next;
+	}
+
+	gcpointer_t* type = other->type_chain;
+
+	while(type)
+	{
+		check((intptr_t)type < (intptr_t)((intptr_t)other + other->size));
+
+		size_t offset = (intptr_t)type - (intptr_t)other;
+		check(offset < this->size);
+
+		gcpointer_t* member_ptr = (gcpointer_t*)( (intptr_t)this + offset );
+
+		if(!this->type_chain) this->type_chain = member_ptr;
+
+		size_t next_offset = type->next ? (intptr_t)type->next - (intptr_t)other : 0;
+		check(next_offset < this->size);
+
+		gcpointer_t* next_ptr = type->next ? (gcpointer_t*)((intptr_t)this + next_offset) : NULL;
+
+		member_ptr->ptr = type->ptr;
+		member_ptr->next = next_ptr;
+
+		type = type->next;
+	}
+
+	check(is_valid(this));
+}
+
+#ifndef NDEBUG
+	bool is_valid(const gc_object_header* const this)
+	{
+		check((intptr_t)this->canary_start == (intptr_t)CANARY_VALUE);
+		check((intptr_t)this->canary_end == (intptr_t)CANARY_VALUE);
+
+		check(this->is_forwarded == ( (intptr_t)this->forward != (intptr_t)NULL));
+
+		check(this->size < POOL_SIZE_BYTES);
+
+		gcpointer_t* root = this->root_chain;
+		while(root)
+		{
+			checkf(gc_get_object_ptr( (void*)root->ptr ) == this, (const char*)"Expected %lX got %lX\n", gc_get_object_ptr( (void*)root->ptr ), this);
+
+			root = root->next;
+		}
+
+		gcpointer_t* type = this->type_chain;
+		while(type)
+		{
+			check((intptr_t)type > (intptr_t)this);
+			check((intptr_t)type < (intptr_t)(((intptr_t)this) + this->size));
+
+			type = type->next;
+		}
+
+		return true;
+	}
+	#else
+	#error blarg
+#endif
Index: tests/zombies/gc_no_raii/src/internal/object_header.h
===================================================================
--- tests/zombies/gc_no_raii/src/internal/object_header.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/internal/object_header.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,52 @@
+#pragma once
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#include "tools.h"
+
+#ifndef NDEBUG
+	static void* const CANARY_VALUE = (void*)0xCAFEBABACAFEBABA;
+#endif
+
+struct gcpointer_t;
+struct gc_object_header;
+
+struct gc_object_header
+{
+	#ifndef NDEBUG
+		void* canary_start;
+	#endif
+
+	size_t		size;
+	gcpointer_t* 	root_chain;
+	gcpointer_t*	type_chain;
+	gc_object_header*	forward;
+	bool			is_forwarded;
+
+	#ifndef NDEBUG
+		void* canary_end;
+	#endif
+};
+
+void ctor(gc_object_header* const this, size_t size);
+void copy_ctor(gc_object_header* const this, const gc_object_header* const other);
+
+static inline gc_object_header* placement_ctor(void* address, size_t size)
+{
+	gc_object_header* const this = (gc_object_header* const) address;
+	ctor(this, size);
+	return this;
+}
+
+static inline gc_object_header* placement_copy_ctor(void* address, const gc_object_header* const other)
+{
+	gc_object_header* const this = (gc_object_header* const) address;
+	copy_ctor(this, other);
+	return this;
+}
+
+#ifndef NDEBUG
+	bool is_valid(const gc_object_header* const this);
+#endif
Index: tests/zombies/gc_no_raii/src/internal/state.c
===================================================================
--- tests/zombies/gc_no_raii/src/internal/state.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/internal/state.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,312 @@
+#include "state.h"
+
+#include <stdlib.hfa>
+
+//general purpouse includes
+#include "tools.h"
+
+//platform abstraction includes
+#include "allocate-pool.h"
+
+//gc internal includes
+#include "collector.h"
+#include "globals.h"
+#include "memory_pool.h"
+#include "object_header.h"
+#include "tools/worklist.h"
+
+void gc_state_swap(gc_state *const this);
+void gc_state_sweep_roots(gc_state *const this, worklist_t* worklist);
+void gc_state_clear(gc_state *const this);
+void gc_state_calc_usage(gc_state *const this);
+
+#ifndef NDEBUG
+	bool gc_state_roots_match(gc_state *const this);
+	bool gc_state_no_from_space_ref(gc_state *const this);
+#endif
+
+static gc_state s;
+
+gc_state* gc_get_state()
+{
+	if(!s.is_initialized) ctor(&s);
+	return &s;
+}
+
+void ctor(gc_state *const this)
+{
+	this->from_code = 0;
+	this->to_space = NULL;
+	this->from_space = NULL;
+	this->total_space = 0;
+	this->used_space = 0;
+	ctor(&this->pools_table);
+
+	gc_allocate_pool(this);
+
+	this->is_initialized = true;
+}
+
+void dtor(gc_state *const this)
+{
+	dtor(&this->pools_table);
+	this->is_initialized = false;
+}
+
+bool gc_is_in_heap(const gc_state* const this, const void* const address)
+{
+	gc_memory_pool* target_pool = gc_pool_of(address);
+
+	gc_memory_pool** first = cbegin(&this->pools_table);
+	gc_memory_pool** last = cend(&this->pools_table);
+	gc_memory_pool** result = find(first, &last, target_pool);
+	return result != last && gc_pool_is_from_space(*result);
+}
+
+bool gc_is_in_to_space(const gc_state* const this, const void* const address)
+{
+	gc_memory_pool* target_pool = gc_pool_of(address);
+
+	gc_memory_pool** first = cbegin(&this->pools_table);
+	gc_memory_pool** last = cend(&this->pools_table);
+	gc_memory_pool** result = find(first, &last, target_pool);
+	return result != last && !gc_pool_is_from_space(*result);
+}
+
+gc_object_header* gc_get_object_for_ref(gc_state* state, void* member)
+{
+	volatile int stage = 0;
+	intptr_t target = ((intptr_t)member);
+	if(!gc_is_in_heap(state, member)) return NULL;
+	stage++;
+
+	gc_memory_pool* pool = gc_pool_of(member);
+	stage++;
+	gc_pool_object_iterator it = gc_pool_iterator_for(pool, member);
+	stage++;
+	gc_pool_object_iterator end = end(pool);
+	stage++;
+
+	while(it != end)
+	{
+		gc_object_header* object = *it;
+		check(object);
+		check( is_valid(object) );
+		{
+			intptr_t start = ((intptr_t)object);
+			intptr_t end = ((intptr_t)start + object->size);
+			if(start < target && end > target)
+			{
+				return object;
+			}
+		}
+		stage++;
+		++it;
+	}
+
+	checkf( (int) 0, "is_in_heap() and iterator_for() return inconsistent data");
+	abort();
+	return NULL;
+}
+
+void* gc_try_allocate(gc_state* const this, size_t size)
+{
+	gc_memory_pool* pool = this->from_space;
+	while(pool != (gc_memory_pool*)0)
+	{
+		if(gc_pool_size_left(pool) > size)
+		{
+			return gc_pool_allocate(pool, size, true);
+		}
+		pool = pool->next;
+	}
+
+	return (void*)0;
+}
+
+void gc_allocate_pool(gc_state *const this)
+{
+	gc_memory_pool* old_from_space = this->from_space;
+      gc_memory_pool* old_to_space = this->to_space;
+
+      this->from_space = (gc_memory_pool*)(pal_allocPool(POOL_SIZE_BYTES, 1));
+      this->to_space   = (gc_memory_pool*)(pal_allocPool(POOL_SIZE_BYTES, 1));
+
+      this->from_space{ POOL_SIZE_BYTES, old_from_space, this->to_space,   this->from_code };
+      this->to_space  { POOL_SIZE_BYTES, old_to_space,   this->from_space, (~this->from_code) & 0x01 };
+
+	this->total_space += gc_pool_size_used(this->from_space);
+
+	push_back(&this->pools_table, this->from_space);
+	push_back(&this->pools_table, this->to_space);
+}
+
+void gc_collect(gc_state* const this)
+{
+	// DEBUG("collecting");
+	// DEBUG("previous usage " << this->used_space << " / " << this->total_space);
+
+	worklist_t worklist;
+	ctor(&worklist);
+	gc_state_sweep_roots(this, &worklist);
+
+	while(!empty(&worklist))
+	{
+		intptr_t* ref = back(&worklist);
+		pop_back(&worklist);
+		gc_process_reference((void**)ref, &worklist);
+	}
+
+	check(gc_state_roots_match(this));
+	check(gc_state_no_from_space_ref(this));
+
+	gc_state_swap(this);
+
+	gc_state_calc_usage(this);
+
+	if(gc_needs_collect(this)) gc_allocate_pool(this);
+
+	// DEBUG("done");
+	dtor(&worklist);
+}
+
+void gc_state_swap(gc_state* const this)
+{
+	swap(&this->from_space, &this->to_space);
+
+	gc_memory_pool* pool = this->to_space;
+	while(pool)
+	{
+		gc_reset_pool(pool);
+		pool = pool->next;
+	}
+
+	this->from_code = (~this->from_code) & 0x01;
+
+	#ifndef NDEBUG
+		{
+			gc_memory_pool* pool = this->from_space;
+			while(pool)
+			{
+				check(gc_pool_is_from_space(pool));
+				pool = pool->next;
+			}
+
+			pool = this->to_space;
+			while(pool)
+			{
+				check(!gc_pool_is_from_space(pool));
+				pool = pool->next;
+			}
+		}
+	#endif
+}
+
+void gc_state_sweep_roots(gc_state* const this, worklist_t* worklist)
+{
+	gc_memory_pool* pool = this->from_space;
+	while(pool)
+	{
+		gc_pool_object_iterator it = begin(pool);
+		gc_pool_object_iterator end = end(pool);
+		for(;it != end; ++it)
+		{
+			gc_object_header* object = *it;
+			if(!object->root_chain) continue;
+
+			gc_copy_object(object);
+
+			gc_scan_object(object->forward, worklist);
+		}
+
+		pool = pool->next;
+	}
+}
+
+void gc_state_clear(gc_state* const this)
+{
+	gc_memory_pool* pool = this->from_space;
+	while(pool)
+	{
+		gc_reset_pool(pool);
+		pool = pool->next;
+	}
+
+	pool = this->to_space;
+	while(pool)
+	{
+		gc_reset_pool(pool);
+		pool = pool->next;
+	}
+}
+
+void gc_state_calc_usage(gc_state* const this)
+{
+	this->total_space = 0;
+	this->used_space = 0;
+
+	gc_memory_pool* pool = this->from_space;
+	while(pool)
+	{
+		size_t size = gc_pool_size_total(pool);
+		size_t used = gc_pool_size_used(pool);
+		check(used <= size);
+		this->total_space += size;
+		this->used_space += used;
+
+		pool = pool->next;
+	}
+}
+
+#ifndef NDEBUG
+	bool gc_state_roots_match(gc_state* const this)
+	{
+		gc_memory_pool* pool = this->to_space;
+		while(pool)
+		{
+			size_t size = 0;
+			gc_pool_object_iterator it = begin(pool);
+			gc_pool_object_iterator end = end(pool);
+			for(;it != end; ++it)
+			{
+				gc_object_header* object = *it;
+				size += object->size;
+
+				gcpointer_t* ptr = object->root_chain;
+				while(ptr)
+				{
+					check(gc_get_object_ptr( (void*)ptr->ptr ) == object);
+					ptr = ptr->next;
+				}
+			}
+
+			checkf(size + gc_pool_size_left(pool) == gc_pool_size_total(pool),
+				(const char*)"expected %lu + %lu == %lu\n",
+				(size_t)size,
+				(size_t)gc_pool_size_left(pool),
+				(size_t)gc_pool_size_total(pool));
+
+			pool = pool->next;
+		}
+
+		return true;
+	}
+
+	bool gc_state_no_from_space_ref(gc_state* const this)
+	{
+		gc_memory_pool* pool = this->to_space;
+		while(pool)
+		{
+			void** potential_ref = (void**)pool->start_p;
+			while(potential_ref < (void**)pool->free_p)
+			{
+				check(!gc_is_in_heap(this, *potential_ref));
+				potential_ref++;
+			}
+
+			pool = pool->next;
+		}
+
+		return true;
+	}
+#endif
Index: tests/zombies/gc_no_raii/src/internal/state.h
===================================================================
--- tests/zombies/gc_no_raii/src/internal/state.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/internal/state.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,64 @@
+#pragma once
+
+#ifdef __cforall
+extern "C" {
+#endif
+#include <stddef.h>
+#include <stdint.h>
+#ifdef __cforall
+}
+#endif
+#include <fstream.hfa>
+#include <vector>
+
+#include "tools.h"
+
+typedef vector(struct gc_memory_pool*, heap_allocator(struct gc_memory_pool*)) pools_table_t;
+
+struct gc_state
+{
+	bool is_initialized;
+	uint8_t from_code;
+	struct gc_memory_pool* to_space;
+	struct gc_memory_pool* from_space;
+
+	size_t total_space;
+	size_t used_space;
+
+	pools_table_t 	pools_table;
+	size_t 		pools_table_count;
+};
+
+void ctor(gc_state* const state);
+
+void dtor(gc_state* const state);
+
+gc_state* gc_get_state();
+
+static inline bool gc_needs_collect(gc_state* state)
+{
+	// sout | "Used Space: " | state->used_space | " bytes";
+	return state->used_space * 2 > state->total_space;
+}
+
+void gc_collect(gc_state* const this);
+
+void* gc_try_allocate(gc_state* const this, size_t size);
+
+void gc_allocate_pool(gc_state* const state);
+
+bool gc_is_in_heap(const gc_state* const state, const void* const address);
+
+bool gc_is_in_to_space(const gc_state* const state, const void* const address);
+
+static inline uint8_t gc_from_space_code(const gc_state *const this)
+{
+	return this->from_code;
+}
+
+struct gc_object_header* gc_get_object_for_ref(gc_state* state, void*);
+
+static inline void gc_register_allocation(gc_state* state, size_t size)
+{
+	state->used_space += size;
+}
Index: tests/zombies/gc_no_raii/src/test_include.c
===================================================================
--- tests/zombies/gc_no_raii/src/test_include.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/test_include.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,4 @@
+/* definition to expand macro for string conversion*/
+#define xstr(s) sstr(s)
+#define sstr(s) #s
+#include xstr(../test/TEST_FILE.c)
Index: tests/zombies/gc_no_raii/src/tools.h
===================================================================
--- tests/zombies/gc_no_raii/src/tools.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/tools.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,37 @@
+#pragma once
+
+#include "tools/checks.h"
+#include "tools/print.h"
+
+// forall(otype T)
+// inline void swap(T* const a, T* const b)
+// {
+// 	T* temp = a;
+// 	*a = *b;
+// 	*b = *temp;
+// }
+
+trait has_equal(otype T)
+{
+	signed int ?==?(T a, T b);
+};
+
+trait InputIterator_t(otype T, otype InputIterator)
+{
+	signed int ?==?(InputIterator a, InputIterator b);
+	signed int ?!=?(InputIterator a, InputIterator b);
+	T *?(InputIterator a);
+	InputIterator ++?(InputIterator* a);
+	InputIterator ?++(InputIterator* a);
+};
+
+forall(otype T | has_equal(T), otype InputIterator | InputIterator_t(T, InputIterator))
+static inline InputIterator find( InputIterator first, const InputIterator* const last, T val)
+{
+	while ( first != *last)
+	{
+		if(*first == val) return first;
+		++first;
+	}
+	return *last;
+}
Index: tests/zombies/gc_no_raii/src/tools/checks.h
===================================================================
--- tests/zombies/gc_no_raii/src/tools/checks.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/tools/checks.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,29 @@
+#pragma once
+
+#ifdef NDEBUG
+
+#define check(x)
+
+#define checkf(x, format, ...)
+
+#warning no debug checks
+
+#else
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#define check(x) do {\
+	if(!(x)) {\
+		printf("CHECK failed : %s at %s:%i\n", #x, __FILE__, __LINE__);\
+		abort();\
+	}}while( (int)0 )\
+
+#define checkf(x, ...) do {\
+	if(!(x)) {\
+		printf("CHECK failed : %s at %s:%i\n", #x, __FILE__, __LINE__);\
+		printf(__VA_ARGS__);\
+		abort();\
+	}}while( (int)0 )\
+
+#endif //NO_CHECKS
Index: tests/zombies/gc_no_raii/src/tools/print.c
===================================================================
--- tests/zombies/gc_no_raii/src/tools/print.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/tools/print.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,5 @@
+#include "tools.h"
+
+#ifndef NDEBUG
+	// ofstream *sout = ofstream_stdout();
+#endif
Index: tests/zombies/gc_no_raii/src/tools/print.h
===================================================================
--- tests/zombies/gc_no_raii/src/tools/print.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/tools/print.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,13 @@
+#pragma once
+
+// #ifndef NDEBUG
+//
+// #include <fstream.hfa>
+//
+// #define DEBUG_OUT(x) sout | x;
+//
+// #else
+
+#define DEBUG_OUT(x)
+
+// #endif //NO_CHECKS
Index: tests/zombies/gc_no_raii/src/tools/worklist.h
===================================================================
--- tests/zombies/gc_no_raii/src/tools/worklist.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/src/tools/worklist.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,14 @@
+#pragma once
+
+#ifdef __cforall
+extern "C" {
+#endif
+#include <stddef.h>
+#include <stdint.h>
+#ifdef __cforall
+}
+#endif
+
+#include <vector.hfa>
+
+typedef vector(intptr_t*, heap_allocator(intptr_t*)) worklist_t;
Index: tests/zombies/gc_no_raii/test/badlll.c
===================================================================
--- tests/zombies/gc_no_raii/test/badlll.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/test/badlll.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,71 @@
+#include "gc.h"
+
+#include <stdio.h>
+
+struct List_t
+{
+	gcpointer(List_t) next;
+	int val;
+};
+
+typedef gcpointer(List_t) LLL;
+
+#define MAX (1024 * 1)
+
+LLL buildLLL(int sz)
+{
+	int i = 0;
+	LLL ll0;
+
+	gcmalloc( &ll0 );
+	List_t* ll0_ptr = get( &ll0 );
+	ll0_ptr->val = i;
+	LLL lll = ll0;
+
+	for (i = 1; i < sz; i++)
+	{
+		LLL llc;
+		gcmalloc( &llc );
+		List_t* llc_ptr = get( &llc );
+		llc_ptr->val = i;
+		List_t* lll_ptr = get( &lll );
+		lll_ptr->next = llc;
+
+		lll = llc;
+	}
+
+	check(is_valid( &ll0.internal ));
+
+	return ll0;
+}
+
+void testLLL(LLL lll)
+{
+	unsigned char *counted;
+
+	counted = (unsigned char *) calloc(MAX, sizeof(unsigned char));
+	while (lll)
+	{
+		List_t* lll_ptr = get( &lll );
+		counted[lll_ptr->val]++;
+		if (counted[lll_ptr->val] > 1)
+		{
+			fprintf(stderr, "ERROR! Encountered %d twice!\n", lll_ptr->val);
+			exit(1);
+		}
+		lll = lll_ptr->next;
+	}
+
+	return;
+}
+
+int main(void)
+{
+	LLL mylll;
+
+	mylll = buildLLL(MAX);
+
+	testLLL(mylll);
+
+	return 0;
+}
Index: tests/zombies/gc_no_raii/test/gctest.c
===================================================================
--- tests/zombies/gc_no_raii/test/gctest.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/test/gctest.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,25 @@
+#include <fstream.hfa>
+
+#include "gc.h"
+#include "internal/collector.h"
+
+#warning default test
+
+int main() {
+	sout | "Bonjour au monde!\n";
+
+	gcpointer(int) theInt;
+	gcmalloc(&theInt);
+
+	for(int i = 0; i < 10; i++) {
+		int a;
+		{
+			gcpointer(int) anInt;
+			gcmalloc(&anInt);
+		}
+		int p;
+	}
+
+	gc_collect(gc_get_state());
+	gc_conditional_collect();
+}
Index: tests/zombies/gc_no_raii/test/operators.c
===================================================================
--- tests/zombies/gc_no_raii/test/operators.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/gc_no_raii/test/operators.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,22 @@
+#include "gc.h"
+
+#include <assert.h>
+
+int main(int argc, char *argv[])
+{
+	gcpointer(int) test, test1;
+
+	if(test != test1) { return 1; }
+	if(test == test1) { return 1; }
+	// if(test == 0)  { return 1; }
+	// if(test != 0)  { return 1; }
+	// if(test) { return 1; }
+
+	// *test.internal.ptr = 3;
+	// int i = *test;
+
+	gcmalloc();
+	// test = gcmalloc();
+
+	return 0;
+}
Index: tests/zombies/hashtable.cfa
===================================================================
--- tests/zombies/hashtable.cfa	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/hashtable.cfa	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,243 @@
+
+#include <containers/list.hfa>
+
+#include <exception.hfa>
+TRIVIAL_EXCEPTION(ht_fill_limit_crossed);
+
+
+
+void defaultResumptionHandler(ht_fill_limit_crossed &) {
+    printf("default resumption ht_fill_limit_crossed\n");
+}
+
+void defaultTerminationHandler(ht_fill_limit_crossed &) = void;
+
+
+trait has_hash( otype K ) {
+    size_t hash(K);
+    int ?==?( K, K );
+};
+
+trait hkey( otype K, dtype tN | has_hash(K) ) {
+    K key(tN &);
+};
+
+forall( otype K, dtype tN, dtype tE | $dlistable(tN, tE) | hkey(K, tN) ) {
+
+    struct hashtable {
+
+        size_t n_buckets;
+        dlist(tN, tE) *buckets;
+        
+        size_t item_count;
+        float ff_next_warn_up;
+
+        void (*defaultResumptionHandler) (ht_fill_limit_crossed &);
+    };
+
+    void ?{}( hashtable(K, tN, tE) & this ) = void;
+}
+
+forall( otype K, dtype tN, dtype tE | $dlistable(tN, tE) | hkey(K, tN) | { void defaultResumptionHandler(ht_fill_limit_crossed &); } ) {
+
+    void ?{}( hashtable(K, tN, tE) & this, size_t n_buckets, dlist(tN, tE) *buckets ) {
+
+        this.n_buckets = n_buckets;
+        this.buckets = buckets;
+
+        this.item_count = 0;
+        this.ff_next_warn_up = 0.5;
+
+        this.defaultResumptionHandler = defaultResumptionHandler;
+
+        for ( i; n_buckets ) {
+            ?{}( this.buckets[i] );
+        }
+    }
+}
+
+forall( otype K, dtype tN, dtype tE | $dlistable(tN, tE) | hkey(K, tN) ) {
+
+    float fill_frac( hashtable(K, tN, tE) & this ) with(this) {
+        return ((float)item_count) / n_buckets;
+    }
+
+    size_t bucket_of( hashtable(K, tN, tE) & this, K k ) {
+        return hash(k) % this.n_buckets;
+    }
+
+    tE & get( hashtable(K, tN, tE) & this, K k ) with (this) {
+
+        dlist(tN, tE) & bucket = buckets[ bucket_of(this, k) ];
+
+        for ( tN * item = & $tempcv_e2n(bucket`first);  item != 0p;  item = & $tempcv_e2n((*item)`next) ) {
+            if ( key(*item) == k ) {
+                return *item;
+            }
+        }
+
+        return *0p;
+    }
+
+    void check_ff_warning( hashtable(K, tN, tE) & this ) with (this) {
+        if (fill_frac(this) > ff_next_warn_up) {
+            throwResume (ht_fill_limit_crossed){};
+            ff_next_warn_up *= 2;
+        }
+    }
+
+    void put( hashtable(K, tN, tE) & this, tE & v ) with (this) {
+
+        check_ff_warning(this);
+
+        K k = key( $tempcv_e2n(v) );
+        dlist(tN, tE) & bucket = buckets[ bucket_of(this, k) ];
+
+        for ( tN * item = & $tempcv_e2n(bucket`first);  item != 0p;  item = & $tempcv_e2n((*item)`next) ) {
+            if ( key(*item) == k ) {
+                remove(*item);
+                break;
+            }
+        }
+
+        insert_first(bucket, v);
+        this.item_count ++;
+    }
+
+}
+
+// tactical usage:
+// HASHTABLE_STATIC(int, item_by_prority, item, n, ht)
+//
+// intended equivalent:
+// hashtable_static(int, item_by_prority, item, Z(n)) ht;
+#define HASHTABLE_STATIC(K, tN, tE, n_buckets, obj) \
+    struct __hashtable_static_ ## obj { \
+        inline hashtable(K, tN, tE); \
+        dlist(tN, tE) $items[n_buckets]; \
+    }; \
+    void ?{}( __hashtable_static_ ## obj & this )  { \
+        ((hashtable(K, tN, tE) &)this){ n_buckets, this.$items }; \
+    } \
+    __hashtable_static_ ## obj obj;
+
+
+
+trait heaped(dtype T) {
+    T * alloc( size_t );
+    void free( void * ); 
+};
+
+void __dynamic_defaultResumptionHandler(ht_fill_limit_crossed & ex) {
+    printf("dynamic limit crossed\n");
+}
+
+forall( otype K, dtype tN, dtype tE | $dlistable(tN, tE) | hkey(K, tN) | heaped( dlist(tN, tE) ) ) {
+
+    struct hashtable_dynamic { 
+        inline hashtable(K, tN, tE); 
+    };
+    void ?{}( hashtable_dynamic(K, tN, tE) & this, size_t n_buckets )  {
+        void (*defaultResumptionHandler) (ht_fill_limit_crossed &) = __dynamic_defaultResumptionHandler;
+        dlist(tN, tE) *buckets = alloc(n_buckets);
+        ((hashtable(K, tN, tE) &)this){ n_buckets, buckets };
+    }
+    void ^?{}( hashtable_dynamic(K, tN, tE) & this ) {
+        free(this.buckets);
+    }
+}
+
+
+
+
+struct request {
+
+    unsigned int src_id;
+    unsigned int tgt_id;
+
+    DLISTED_MGD_EXPL_IN(request, ht_by_src)
+    DLISTED_MGD_EXPL_IN(request, ht_by_tgt)
+};
+DLISTED_MGD_EXPL_OUT(request, ht_by_src)
+DLISTED_MGD_EXPL_OUT(request, ht_by_tgt)
+
+size_t hash( unsigned int k ) {
+    // not really a hash function, not really the point
+    return k;
+}
+
+unsigned int key( request_in_ht_by_src & v ) {
+    return v.src_id;
+}
+
+
+#include <stdlib.hfa>
+
+int main() {
+
+
+    HASHTABLE_STATIC(unsigned int, request_in_ht_by_src, request, 67, h_src)
+
+    request & wasnt_found = get(h_src, 17);
+    assert( &wasnt_found == 0p );
+
+    request r;
+    r.src_id = 117;
+    r.tgt_id = 998;
+
+    put(h_src, r);
+
+    request & found = get(h_src, 117);
+    assert( &found == &r );
+
+    & wasnt_found = & get(h_src, 998);
+    assert( &wasnt_found == 0p );
+
+    printf( "%f\n", fill_frac(h_src) );
+
+
+    request rs[500];
+    try {
+        for (i; 500) {
+            rs[i].src_id = 8000 * i;
+            put(h_src, rs[i]);
+        }
+    } catchResume(ht_fill_limit_crossed*) {
+        printf("fill limit tripped with h_src filled at %f\n", fill_frac(h_src));
+        throwResume;
+    }
+
+    assert(  & get(h_src, 117      ) );
+    assert(  & get(h_src, 8000*25  ) );
+    assert(! & get(h_src, 8000*25+1) );
+
+
+
+    dlist(request_in_ht_by_src, request) * (*old_alloc)( size_t ) = alloc;
+    dlist(request_in_ht_by_src, request) * alloc( size_t n ) {
+        dlist(request_in_ht_by_src, request) * ret = old_alloc(n);
+        printf("alloc'ed at %p\n", ret);
+        return ret;
+    }
+
+    void (*old_free)( void * ) = free;
+    void free( void * o ) {
+        printf("free'ing at %p\n", o);
+        old_free(o);
+    }
+
+    hashtable_dynamic(unsigned int, request_in_ht_by_src, request) ht2 = { 113 };
+    request rs2[500];
+    try {
+        for (i; 500) {
+            if (i % 10 == 0) {printf("%d(%f),", i, fill_frac(ht2));}
+            rs2[i].src_id = 8000 * i;
+            put(ht2, rs2[i]);
+        }
+    } catchResume(ht_fill_limit_crossed*) {
+        printf("fill limit tripped with ht2 filled at %f\n", fill_frac(ht2));
+        throwResume;
+    }
+
+
+}
Index: tests/zombies/hashtable2.cfa
===================================================================
--- tests/zombies/hashtable2.cfa	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/hashtable2.cfa	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,466 @@
+
+#include <containers/list.hfa>
+
+typedef unsigned int K;
+
+// workaround type for trac#185; used here as the ticket's examples use a spontaneous float
+typedef struct {} t_unused;
+
+struct request {
+
+    unsigned int src_id;
+    unsigned int tgt_id;
+
+    DLISTED_MGD_EXPL_IN(request, ht_by_src)
+    DLISTED_MGD_EXPL_IN(request, ht_by_tgt)
+};
+DLISTED_MGD_EXPL_OUT(request, ht_by_src)
+DLISTED_MGD_EXPL_OUT(request, ht_by_tgt)
+
+size_t hash( unsigned int k ) {
+    // not really a hash function, not really the point
+    return k;
+}
+
+unsigned int key( request_in_ht_by_src & v ) {
+    return v.src_id;
+}
+
+
+#include <exception.hfa>
+
+DATA_EXCEPTION(ht_fill_limit_crossed)(
+	void * theHashtable;
+    bool want_throwResume_ht_auto_resize_pending;
+    size_t size_for_ht_auto_resize_pending;
+);
+
+void ?{}(ht_fill_limit_crossed & this, void * theHashtable) {
+	VTABLE_INIT(this, ht_fill_limit_crossed);
+	this.theHashtable = theHashtable;
+    this.want_throwResume_ht_auto_resize_pending = false;
+    this.size_for_ht_auto_resize_pending = 0;
+}
+
+const char * ht_fill_limit_crossed_msg(ht_fill_limit_crossed * this) {
+	return "ht_fill_limit_crossed";
+}
+
+VTABLE_INSTANCE(ht_fill_limit_crossed)(ht_fill_limit_crossed_msg);
+
+
+DATA_EXCEPTION(ht_auto_resize_pending)(
+	void * theHashtable;
+    size_t new_size;
+);
+
+void ?{}(ht_auto_resize_pending & this, void * theHashtable, size_t new_size) {
+	VTABLE_INIT(this, ht_auto_resize_pending);
+	this.theHashtable = theHashtable;
+    this.new_size = new_size;
+}
+
+const char * ht_auto_resize_pending_msg(ht_auto_resize_pending * this) {
+	return "ht_auto_resize_pending";
+}
+
+VTABLE_INSTANCE(ht_auto_resize_pending)(ht_auto_resize_pending_msg);
+
+
+
+trait pretendsToMatter( dtype TTT ) {
+    void actsmart(TTT &);
+};
+
+forall( dtype TTTx )
+void actsmart(TTTx &) {}
+
+// probable bug, wrt otype Tt_unused...
+//   1. changing to dtype Tt_unused crashes GenPoly
+//   2. declaring function check_ff_warning as concrete, i.e. operating on type hashtable_rbs(t_unused) makes cfa-cc generate bad C
+// in both cases, it's on the throwResume call
+// where it implicitly uses this.defaultResumptionHandler as a throwResume argument
+// whereas that, of course, has to be surrounded in a cast
+// at GenPoly breakpoint, type of said cast appears as CFA generic struct, even as the "this" parameter appears as C struct; casted type ...
+//   1. is hashtable_rbs(Tt_unused); assertion complains you don't need a type arg here
+//   2. shows up in -CFA output as hashtable_rbs(), which is bad C; expecting hashtable_rbs*
+
+forall( otype Tt_unused | pretendsToMatter(Tt_unused) ) {
+
+    // hashtable of request by source
+    struct hashtable_rbs {
+
+        size_t n_buckets;
+        dlist(request_in_ht_by_src, request) *buckets;
+        
+        size_t item_count;
+        float ff_next_warn_up;
+        float ff_warn_step_factor;
+
+        void (*defaultResumptionHandler) (ht_fill_limit_crossed &);
+    };
+
+    void ?{}( hashtable_rbs(Tt_unused) & this ) = void;
+}
+
+forall( otype Tt_unused | pretendsToMatter(Tt_unused) | { void defaultResumptionHandler(ht_fill_limit_crossed &); } ) {
+
+    void ?{}( hashtable_rbs(Tt_unused) & this, size_t n_buckets, dlist(request_in_ht_by_src, request) *buckets,
+        float ff_next_warn_up, float ff_warn_step_factor ) {
+
+        printf( "base hashtable ctor with %ld buckets at %p\n", n_buckets, buckets);
+
+        this.n_buckets = n_buckets;
+        this.buckets = buckets;
+
+        this.item_count = 0;
+        this.ff_next_warn_up = ff_next_warn_up;
+        this.ff_warn_step_factor = ff_warn_step_factor;
+
+        this.defaultResumptionHandler = defaultResumptionHandler;
+
+        for ( i; n_buckets ) {
+            ?{}( this.buckets[i] );
+        }
+    }
+
+    void ?{}( hashtable_rbs(Tt_unused) & this, size_t n_buckets, dlist(request_in_ht_by_src, request) *buckets ) {
+        printf( "base hashtable ctor with default warning steps\n" );
+        ( this ) { n_buckets, buckets, 0.5, 2 };
+    }
+
+}
+
+// this fwd declaration is artifact of workaround trac#192
+void defaultResumptionHandler( ht_auto_resize_pending & ex );
+
+forall( otype Tt_unused | pretendsToMatter(Tt_unused) ) {
+
+    float fill_frac( hashtable_rbs(Tt_unused) & this ) with(this) {
+        return ((float)item_count) / n_buckets;
+    }
+
+    size_t bucket_of( hashtable_rbs(Tt_unused) & this, K k ) {
+        return hash(k) % this.n_buckets;
+    }
+
+    request & get( hashtable_rbs(Tt_unused) & this, K k ) with (this) {
+
+        dlist(request_in_ht_by_src, request) & bucket = buckets[ bucket_of(this, k) ];
+
+        for ( request_in_ht_by_src * item = & $tempcv_e2n(bucket`first);  item != 0p;  item = & $tempcv_e2n((*item)`next) ) {
+            if ( key(*item) == k ) {
+                return *item;
+            }
+        }
+
+        return *0p;
+    }
+
+    void check_ff_warning( hashtable_rbs(Tt_unused) & this ) with (this) {
+        if (fill_frac(this) > ff_next_warn_up) {
+            ht_fill_limit_crossed ex1 = { &this };
+            throwResume ex1;
+            // workaround trac#192: want the second throwResume to be in __dynamic_defaultResumptionHandler
+            // ... want base hashtable decoupled from resize
+            if ( ex1.want_throwResume_ht_auto_resize_pending ) {
+                throwResume( (ht_auto_resize_pending) { & this, ex1.size_for_ht_auto_resize_pending } );
+            }
+        }
+    }
+
+    void put( hashtable_rbs(Tt_unused) & this, request & v ) with (this) {
+
+        check_ff_warning(this);
+
+        K k = key( $tempcv_e2n(v) );
+        dlist(request_in_ht_by_src, request) & bucket = buckets[ bucket_of(this, k) ];
+
+        for ( request_in_ht_by_src * item = & $tempcv_e2n(bucket`first);  item != 0p;  item = & $tempcv_e2n((*item)`next) ) {
+            if ( key(*item) == k ) {
+                remove(*item);
+                break;
+            }
+        }
+
+        insert_first(bucket, v);
+        this.item_count ++;
+    }
+}
+
+
+
+
+// tactical usage:
+// HASHTABLE_RBS_STATIC(n, ht)
+//
+// intended equivalent:
+// hashtable_rbs_static(Z(n)) ht;
+#define HASHTABLE_RBS_STATIC(n_buckets, obj) \
+    struct __hashtable_static_ ## obj { \
+        inline hashtable_rbs(t_unused); \
+        dlist(request_in_ht_by_src, request) $items[n_buckets]; \
+    }; \
+    void ?{}( __hashtable_static_ ## obj & this )  { \
+        ((hashtable_rbs(t_unused) &)this){ n_buckets, this.$items }; \
+    } \
+    __hashtable_static_ ## obj obj;
+
+
+
+void defaultResumptionHandler(ht_fill_limit_crossed & ex) {
+    hashtable_rbs(t_unused) & ht = *(hashtable_rbs(t_unused) *)ex.theHashtable;
+    printf("base default resumption handler ht_fill_limit_crossed with ht filled at %f\n", fill_frac(ht));
+    ht.ff_next_warn_up *= ht.ff_warn_step_factor;
+}
+
+void defaultTerminationHandler(ht_fill_limit_crossed &) = void;
+
+
+
+
+
+trait heaped(dtype T) {
+    T * alloc( size_t );
+    void free( void * ); 
+};
+
+void __dynamic_defaultResumptionHandler(ht_fill_limit_crossed &);
+
+forall( otype Tt_unused ) {
+
+    struct hashtable_rbs_dynamic { 
+        inline hashtable_rbs(Tt_unused);
+
+        struct resize_policy {
+            // When fill factor exceeds grow limit, grow big enough for
+            // resulting fill factor to be lower than grow_target.  Vice versa.
+            // Using different grow and shrink limits prevents noisy current
+            // size from triggering grow-shrink oscillation.  OK to use same
+            // grow and shrink targets.
+            float grow_limit, shrink_limit, grow_target, shrink_target;
+
+            // warn with exception but do nothing, this many -1 times, then actually resize
+            unsigned short int warns_per_grow, warns_per_shrink;
+
+            // Don't shrink below.
+            size_t nbuckets_floor;
+        } policy;
+
+        dlist(request_in_ht_by_src, request) * (*alloc)( size_t );
+        void (*free)( void * ); 
+    };
+}
+
+// will be in list api
+void splice_all_to_last( dlist(request_in_ht_by_src, request) & src_to_empty, dlist(request_in_ht_by_src, request) & snk_to_fill_at_last ) {
+
+    // will re-implement as an actual splice
+    while ( & src_to_empty`first != 0p ) {
+        insert_last( snk_to_fill_at_last, pop_first( src_to_empty ) );
+    }
+}
+
+
+forall( otype Tt_unused | heaped( dlist(request_in_ht_by_src, request) ) ) {
+
+    void ?{}( hashtable_rbs_dynamic(Tt_unused).resize_policy & this, size_t nbuckets_floor ) {
+        printf("default dynamic policy ctor\n");
+
+        (this.grow_limit)      {2.0};
+        (this.shrink_limit)    {0.5};
+        (this.grow_target)     {1.0};
+        (this.shrink_target)   {1.0};
+        (this.warns_per_grow)  {4};
+        (this.warns_per_shrink){4};
+        (this.nbuckets_floor)  {nbuckets_floor};
+    }
+
+    void ?{}( hashtable_rbs_dynamic(Tt_unused) & this, size_t n_buckets, hashtable_rbs_dynamic(Tt_unused).resize_policy rp )  {
+        printf("ctor hashtable_rbs_dynamic{ size_t, resize_policy }\n");
+
+        float first_first_warn_up = rp.grow_target;
+        float ff_warn_step_factor = (rp.grow_limit / rp.grow_target) \ ( 1. / rp.warns_per_grow );
+
+        void (*defaultResumptionHandler) (ht_fill_limit_crossed &) = __dynamic_defaultResumptionHandler;
+        dlist(request_in_ht_by_src, request) *buckets = alloc(n_buckets);
+        ( ( hashtable_rbs( Tt_unused ) & ) this ){ n_buckets, buckets, first_first_warn_up, ff_warn_step_factor };
+        ( this.policy ){ rp };
+        this.alloc = alloc;
+        this.free = free;
+    }
+    void ?{}( hashtable_rbs_dynamic(Tt_unused) & this, hashtable_rbs_dynamic(Tt_unused).resize_policy rp )  {
+        printf("ctor hashtable_rbs_dynamic{ resize_policy }\n");
+        ( this ) { rp.nbuckets_floor, rp };
+    }
+    void ?{}( hashtable_rbs_dynamic(Tt_unused) & this, size_t n_buckets )  {
+        printf("ctor hashtable_rbs_dynamic{ size_t }\n");
+        ( this ) { n_buckets, (hashtable_rbs_dynamic(Tt_unused).resize_policy){ n_buckets } };
+    }
+    void ^?{}( hashtable_rbs_dynamic(Tt_unused) & this ) {
+        free(this.buckets);
+    }
+    void rehashToLarger( hashtable_rbs_dynamic(Tt_unused) & this, size_t new_n_buckets ) with(this) {
+        printf("resizing from %ld to %ld, old buckets at %p\n", n_buckets, new_n_buckets, buckets);
+
+        // collect hash items from old buckets
+        dlist(request_in_ht_by_src, request) items;
+        for (i; n_buckets) {
+            splice_all_to_last( buckets[i], items );
+        }
+
+        // make empty hash table of new size
+        dlist(request_in_ht_by_src, request) *oldBuckets = buckets;
+        float oldFfWarnStepFactor = ff_warn_step_factor;
+        float newFfNextWarnUp = ((float)item_count) / ((float) new_n_buckets);
+        ^?{}( (hashtable_rbs(Tt_unused) &)this );
+        free( oldBuckets );
+        ?{}( (hashtable_rbs(Tt_unused) &)this, new_n_buckets, alloc(new_n_buckets), newFfNextWarnUp, oldFfWarnStepFactor );
+
+        // fill new table with old items
+        while ( & items`first != 0p ) {
+            put( this, pop_first( items ) );
+        }
+    }
+}
+
+forall( otype Tt_unused ) {
+    void rehashToLarger_STEP( hashtable_rbs_dynamic(Tt_unused) & this, size_t new_n_buckets ) with (this) {
+        rehashToLarger( this, new_n_buckets );
+    }
+}
+
+void defaultResumptionHandler( ht_auto_resize_pending & ex ) {
+    hashtable_rbs_dynamic(t_unused) & ht = *(hashtable_rbs_dynamic(t_unused) *)ex.theHashtable;
+    printf("auto-resize unhandled: proceeding with resize\n");
+    rehashToLarger_STEP( ht, ex.new_size );
+}
+
+void __dynamic_defaultResumptionHandler(ht_fill_limit_crossed & ex) {
+    hashtable_rbs_dynamic(t_unused) & ht = *(hashtable_rbs_dynamic(t_unused) *)ex.theHashtable;
+    printf("dynamic warning received with fill_frac = %f and buckets at %p\n", fill_frac(ht), ht.buckets);
+    if ( fill_frac( ht ) >= ht.policy.grow_limit ) {
+        float grow_amount =  ht.policy.grow_limit / ht.policy.grow_target;
+        ex.want_throwResume_ht_auto_resize_pending = true;
+        ex.size_for_ht_auto_resize_pending = ( size_t )( grow_amount * ht.n_buckets );
+    } else {
+        // base handler, not specialized for dynamic
+        defaultResumptionHandler( ex );
+    }
+}
+
+
+
+
+
+
+#include <stdlib.hfa>
+
+void basicFillingTestHelper( hashtable_rbs(t_unused) & ht, size_t n_elems ) {
+
+    request & wasnt_found = get(ht, 17);
+    assert( &wasnt_found == 0p );
+
+    request r;
+    r.src_id = 117;
+    r.tgt_id = 998;
+
+    put(ht, r);
+
+    request & found = get(ht, 117);
+    assert( &found == &r );
+
+    & wasnt_found = & get(ht, 998);
+    assert( &wasnt_found == 0p );
+
+    request rs[n_elems];
+    for (i; n_elems) {
+        rs[i].src_id = 8000 * i;
+        put(ht, rs[i]);
+    }
+
+    assert(  & get(ht, 117      ) );
+    assert(  & get(ht, 8000*25  ) );
+    assert(! & get(ht, 8000*25+1) );
+}
+
+void basicFillingTest_static() {
+
+    printf("---start basic fill test static ----\n");
+
+    HASHTABLE_RBS_STATIC(67, ht)
+
+    basicFillingTestHelper(ht, 500);
+}
+
+void basicFillingTest_dynamic() {
+
+    dlist(request_in_ht_by_src, request) * (*old_alloc)( size_t ) = alloc;
+    dlist(request_in_ht_by_src, request) * alloc( size_t n ) {
+        dlist(request_in_ht_by_src, request) * ret = old_alloc(n);
+        printf("alloc'ed at %p\n", ret);
+        return ret;
+    }
+
+    void (*old_free)( void * ) = free;
+    void free( void * o ) {
+        printf("free'ing at %p\n", o);
+        old_free(o);
+    }
+
+    printf("---start basic fill test dynamic ----\n");
+
+    hashtable_rbs_dynamic(t_unused) ht = { 113 };
+
+    basicFillingTestHelper(ht, 500);
+}
+
+// Demonstrates user-provided instrumentation monitoring a fixed-size hash table
+void logTest() {
+
+    printf("---start log test ----\n");
+
+    HASHTABLE_RBS_STATIC(67, ht)
+
+    try {
+        basicFillingTestHelper(ht, 500);
+    } catchResume( ht_fill_limit_crossed * ) {
+        printf("log test instrumentation runs\n");
+        throwResume;
+    }
+}
+
+// Demonstrates "snoozing" a growing hash table's auto-resize event,
+// in that that next call to put will get the resize exception instead.
+void snoozeTest() {
+
+    printf("---start snooze test ----\n");
+
+    hashtable_rbs_dynamic(t_unused) ht = { 113 };
+
+    bool lastResizeSnoozed = false;
+
+    try {
+        basicFillingTestHelper(ht, 500);
+    } catchResume( ht_auto_resize_pending * ) {
+
+        if ( lastResizeSnoozed == false ) {
+            lastResizeSnoozed = true;
+            printf("snooze test intervention decides to snooze this time\n");
+        } else {
+            lastResizeSnoozed = false;
+            printf("snooze test intervention decides to allow the resize\n");
+            throwResume;
+        }
+
+    }
+}
+
+int main() {
+
+    basicFillingTest_static();
+    basicFillingTest_dynamic();
+
+    logTest();
+    snoozeTest();
+}
Index: tests/zombies/huge.c
===================================================================
--- tests/zombies/huge.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/huge.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,26 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// huge.c -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Mar  8 22:16:32 2016
+// Update Count     : 2
+//
+
+int huge( int n, forall( otype T ) T (*f)( T ) ) {
+	if ( n <= 0 )
+		return f( 0 );
+	else
+		return huge( n - 1, f( f ) );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa huge.c" //
+// End: //
Index: tests/zombies/includes.c
===================================================================
--- tests/zombies/includes.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/includes.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,248 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// includes.c -- 
+//
+// Author           : Peter A. Buhr
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Nov 15 23:06:24 2017
+// Update Count     : 597
+//
+
+// ***********************************************
+// USE -std=c99 WITH gxx TO GET SAME OUTPUT AS cfa
+// ***********************************************
+
+#ifdef __CFA__
+extern "C" {
+#endif // __CFA__
+
+#if 1
+#define _GNU_SOURCE
+#include <a.out.h>
+#include <aio.h>
+#include <aliases.h>
+#include <alloca.h>
+#include <ansidecl.h>
+#include <ar.h>
+#include <argp.h>
+#include <argz.h>
+#include <assert.h>
+//#include <bfd.h>
+// #include <bfdlink.h>				// keyword with
+#include <byteswap.h>
+#include <bzlib.h>
+#include <cblas.h>
+#include <cblas_f77.h>
+#include <complex.h>
+#include <com_err.h>
+#include <cpio.h>
+#include <crypt.h>
+#include <ctype.h>
+#include <curses.h>
+#include <dialog.h>
+#include <dirent.h>
+#include <dis-asm.h>
+#include <dlfcn.h>
+#include <dlg_colors.h>
+#include <dlg_config.h>
+#include <dlg_keys.h>
+#include <elf.h>
+#include <endian.h>
+#include <envz.h>
+#include <err.h>
+#include <errno.h>
+#include <error.h>
+#include <eti.h>
+#include <evdns.h>
+#include <event.h>
+
+// #include <evhttp.h>
+// #include <sys/queue.h>
+// #include <evrpc.h>					// evrpc.h depends on sys/queue.h
+// #include <evutil.h>
+// #include <execinfo.h>
+// #include <expat.h>
+// #include <expat_config.h>
+// #include <expat_external.h>
+// #include <fcntl.h>
+// #include <features.h>
+// #include <fenv.h>
+// #include <fmtmsg.h>
+// #include <fnmatch.h>
+// #include <form.h>
+// #include <fpu_control.h>
+// #include <fstab.h>
+// #include <fts.h>
+// #include <ftw.h>
+// #include <gconv.h>
+// #include <getopt.h>
+// #include <gettext-po.h>
+// #include <glob.h>
+// #include <gmp.h>
+// #include <gnu-versions.h>
+// #include <grp.h>
+// #include <gshadow.h>
+// #include <gssapi.h>
+// #include <hwloc.h>					// keyword thread (setjmp)
+// #include <iconv.h>
+// #include <idna.h>
+// #include <idn-free.h>
+// #include <idn-int.h>
+// #include <idn-int.h>
+// #include <ifaddrs.h>
+// #include <inttypes.h>
+// #include <jerror.h>
+
+//#include <jmorecfg.h>
+//#include <jpegint.h>
+// #include <jpeglib.h>
+// #include <kdb.h>
+// #include <krb5.h>					// keyword enable
+// #include <langinfo.h>
+// #include <lastlog.h>
+// #include <lber.h>
+// #include <lber_types.h>
+// #include <ldap.h>
+// #include <ldap_cdefs.h>
+// #include <ldap_features.h>
+// #include <ldap_schema.h>
+// #include <ldap_utf8.h>
+// #include <ldif.h>
+// #include <libgen.h>
+// #include <libintl.h>
+// #include <libio.h>
+// #include <libtasn1.h>
+// #include <libudev.h>
+// #include <limits.h>
+// #include <link.h>
+// #include <locale.h>
+// #include <ltdl.h>
+// #include <lzma.h>
+// #include <malloc.h>
+// #include <math.h>
+// #include <mcheck.h>
+// #include <memory.h>
+// #include <menu.h>
+// #include <mntent.h>
+// #include <monetary.h>
+// #include <mqueue.h>
+// #include <ncurses.h>
+// #include <ncurses_dll.h>
+// #include <nc_tparm.h>
+// #include <netdb.h>
+// #include <nl_types.h>
+// #include <nss.h>
+// #include <numa.h>
+// #include <numacompat1.h>
+// #include <numaif.h>
+// #include <obstack.h>
+// #include <panel.h>
+// #include <paths.h>
+// #include <pciaccess.h>
+// #include <pcre.h>
+// //#include <pcreposix.h>			// conflicts with regex.h
+// #include <plugin-api.h>
+// #include <png.h>										// setjmp
+// #include <pngconf.h>									// setjmp
+// #include <poll.h>
+// #include <pr29.h>
+// #include <printf.h>
+// #include <profile.h>
+// #include <pthread.h>									// setjmp
+// #include <pty.h>
+// #include <punycode.h>
+// #include <pwd.h>
+// #define INIT ;						// needed for regex.h
+// #define GETC() 'a'
+// #define PEEKC() 'a'
+// #define UNGETC( c ) ;
+// #define RETURN( ptr ) ;
+// #define ERROR( val ) ;
+// #include <regex.h>
+// //#include <regexp.h>				// GNU C Library no longer implements
+// #include <resolv.h>
+// #include <re_comp.h>
+// #include <sched.h>
+// #include <search.h>
+// #include <semaphore.h>
+// #include <setjmp.h>
+// #include <sgtty.h>
+// #include <shadow.h>
+// #include <signal.h>
+// #include <spawn.h>
+// #include <stab.h>
+// #include <stdatomic.h>
+// #include <stdarg.h>
+// #include <stdbool.h>
+// #include <stdint.h>
+// #include <stddef.h>
+// #include <stdio.h>
+// #include <stdio_ext.h>
+// #include <stdlib.h>
+// #include <string.h>
+// #include <stringprep.h>
+// #include <strings.h>
+// #include <stropts.h>
+// #include <sudo_plugin.h>
+// #include <symcat.h>
+// #include <syscall.h>
+// #include <sysexits.h>
+// #include <syslog.h>
+// #include <tar.h>
+// #include <term.h>
+// #include <termcap.h>
+// #include <termio.h>
+// #include <termios.h>
+// //#include <term_entry.h>
+// #include <tgmath.h>
+// #include <thread_db.h>			// CFA bug
+// #include <tic.h>
+// #include <time.h>
+// #include <tld.h>
+// #include <ttyent.h>
+// #include <turbojpeg.h>
+// #include <ucontext.h>
+// #include <ulimit.h>
+// #include <unctrl.h>
+// #include <unistd.h>
+// #include <ustat.h>
+// #include <utime.h>
+// #include <utmp.h>
+// #include <utmpx.h>
+// #include <wait.h>
+// #include <wchar.h>
+// #include <wctype.h>
+// #include <wordexp.h>
+// #include <xlocale.h>
+// #include <values.h>
+// #include <zconf.h>
+// #include <zlib.h>
+// #include <_G_config.h>
+
+// #include <jpeglib.h>				// after stdlib.h/stdio.h
+// #include <jpegint.h>
+// #include <jmorecfg.h>
+#if 0
+#endif // 0
+
+#else
+
+#define _GNU_SOURCE
+
+#include <setjmp.h>
+
+#endif // 0
+
+#ifdef __CFA__
+} // extern "C"
+#endif // __CFA__
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa includes.c" //
+// End: //
Index: tests/zombies/index.h
===================================================================
--- tests/zombies/index.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/index.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,25 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// index.h -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Mar  2 18:10:46 2016
+// Update Count     : 2
+//
+
+trait index( type T ) {
+	T ?+?( T, T );
+	T ?-?( T, T );
+	const T 0, 1;
+};
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa index.c" //
+// End: //
Index: tests/zombies/io/cat.c
===================================================================
--- tests/zombies/io/cat.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/io/cat.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,78 @@
+/*
+This is a simple "cat" example that uses io_uring in IORING_SETUP_IOPOLL mode.
+It demonstrates the bare minimum needed to use io_uring in polling mode.
+It uses liburing for simplicity.
+*/
+
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <fcntl.h>
+#include <liburing.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+struct io_uring ring;
+
+__attribute__((aligned(1024))) char data[1024];
+
+int main(int argc,  char * argv[]) {
+      if(argc != 2) {
+            printf("usage:   %s FILE - prints file to console.\n", argv[0]);
+            return 1;
+      }
+
+      int fd = open(argv[1], O_DIRECT);
+      if(fd < 0) {
+            printf("Could not open file %s.\n", argv[1]);
+            return 2;
+      }
+
+      /* prep the array */
+      struct iovec iov = { data, 1024 };
+
+      /* init liburing */
+      io_uring_queue_init(256, &ring, IORING_SETUP_IOPOLL);
+
+      /* declare required structs */
+      struct io_uring_sqe * sqe;
+      struct io_uring_cqe * cqe;
+
+      /* get an sqe and fill in a READV operation */
+      sqe = io_uring_get_sqe(&ring);
+      io_uring_prep_readv(sqe, fd, &iov, 1, 0);
+      // io_uring_prep_read(sqe, fd, data, 1024, 0);
+
+      sqe->user_data = (uint64_t)(uintptr_t)data;
+
+      /* tell the kernel we have an sqe ready for consumption */
+      io_uring_submit(&ring);
+
+      /* wait for the sqe to complete */
+      int ret = io_uring_wait_cqe(&ring, &cqe);
+
+      /* read and process cqe event */
+      if(ret == 0) {
+            char * out = (char *)(uintptr_t)cqe->user_data;
+            signed int len = cqe->res;
+            io_uring_cqe_seen(&ring, cqe);
+
+            if(len > 0) {
+                  printf("%.*s", len, out);
+            }
+            else if( len < 0 ) {
+                  fprintf(stderr, "readv/read returned error : %s\n", strerror(-len));
+            }
+      }
+      else {
+            printf("%d\n", ret);
+            io_uring_cqe_seen(&ring, cqe);
+      }
+
+      io_uring_queue_exit(&ring);
+
+      close(fd);
+}
Index: tests/zombies/io/filereader.c
===================================================================
--- tests/zombies/io/filereader.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/io/filereader.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,122 @@
+/*
+This is a file reading example that users io_uring in non-blocking mode.
+It demonstrates the bare minimum needed to use io_uring.
+It also optionally pre-registers the file descriptors (and a pipe, just to show it works).
+It uses liburing for simplicity.
+*/
+
+
+#include <errno.h>
+#include <fcntl.h>
+#include <liburing.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+int main(int argc, char * argv[]) {
+	if(argc != 3 && argc != 4) {
+            printf("usage:   %s FILE TIMES [fixed] - read FILE from disk TIMES times\n", argv[0]);
+            return EXIT_FAILURE;
+      }
+
+	bool fixed = false;
+	if(argc == 4) {
+		fixed = 0 == strcmp(argv[3], "fixed");
+	}
+
+      int times = atoi( argv[2] );
+      if(times <= 0) {
+            printf("Invalid number of times %d (from %s).\n", times, argv[2]);
+            return EXIT_FAILURE;
+      }
+
+      int fd = open(argv[1], 0);
+      if(fd < 0) {
+            printf("Could not open file %s.\n", argv[1]);
+            return EXIT_FAILURE;
+      }
+
+	int rfd = fd;
+
+	/* prep the array */
+      char data[100];
+      struct iovec iov = { data, 100 };
+
+	/* init liburing */
+	struct io_uring ring;
+      io_uring_queue_init(256, &ring, 0);
+
+	int pipefds[2];
+	if(fixed) {
+		int ret = pipe(pipefds);
+		if( ret < 0 ) {
+			printf("Pipe Error : %s\n", strerror( errno ));
+			return EXIT_FAILURE;
+		}
+		rfd = 0;
+		int fds[] = {
+			fd, pipefds[0], pipefds[1]
+		};
+		int cnt = sizeof(fds) / sizeof(fds[0]);
+		printf("Registering %d files as fixed\n", cnt);
+		ret = io_uring_register_files(&ring, fds, cnt);
+		if( ret < 0 ) {
+			printf("Register Error : %s\n", strerror( -ret ));
+			return EXIT_FAILURE;
+		}
+	}
+
+      /* declare required structs */
+	printf("Reading %s(%d) %d times\n", argv[1], fd, times);
+	size_t counter = 0;
+	for(int i = 0; i < times; i++) {
+		/* get an sqe and fill in a READV operation */
+	      struct io_uring_sqe * sqe = io_uring_get_sqe(&ring);
+		io_uring_prep_readv(sqe, rfd, &iov, 1, 0);
+		if(fixed) {
+			sqe->flags = IOSQE_FIXED_FILE;
+		}
+
+		/* tell the kernel we have an sqe ready for consumption */
+      	io_uring_submit(&ring);
+
+		/* poll the cq and count how much polling we did */
+		while(true) {
+			struct io_uring_cqe * cqe = NULL;
+			/* wait for the sqe to complete */
+			int ret = io_uring_wait_cqe_nr(&ring, &cqe, 0);
+
+			/* read and process cqe event */
+			switch(ret) {
+			case 0:
+				if( cqe->res < 0 ) {
+					printf("Completion Error : %s\n", strerror( -cqe->res ));
+					return EXIT_FAILURE;
+				}
+				io_uring_cqe_seen(&ring, cqe);
+				goto LOOP;
+			case -EAGAIN:
+				counter++;
+				break;
+			default:
+				printf("Wait Error : %s\n", strerror( -ret ));
+				return EXIT_FAILURE;
+			}
+		}
+
+		LOOP:;
+	}
+
+	printf("%zu\n", counter);
+
+      io_uring_queue_exit(&ring);
+
+      close(fd);
+
+	if(fixed) {
+		close(pipefds[0]);
+		close(pipefds[1]);
+	}
+}
Index: tests/zombies/io/simple/client.c
===================================================================
--- tests/zombies/io/simple/client.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/io/simple/client.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,85 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <netdb.h>
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int main(int argc, char * argv[]) {
+      if(argc != 2) {
+            printf("usage:    %s portnumber\n", argv[0]);
+            exit( EXIT_FAILURE );
+      }
+      int port = atoi(argv[1]);
+      if(port < 1) {
+            printf("Invalid port : %d (from %s)\n", port, argv[1]);
+            exit( EXIT_FAILURE );
+      }
+
+      int sock = socket(AF_INET, SOCK_STREAM, 0);
+      if(sock < 0) {
+            perror( "socket" );
+            exit( EXIT_FAILURE );
+      }
+
+      struct hostent * server = gethostbyname("localhost");
+      if(server == NULL) {
+            perror("localhost not found");
+            exit( EXIT_FAILURE );
+      }
+
+      struct sockaddr_in serv_addr;
+      memset(&serv_addr, 0, sizeof(serv_addr));
+      serv_addr.sin_family = AF_INET;
+      memcpy(&serv_addr.sin_addr.s_addr, server->h_addr, server->h_length);
+      serv_addr.sin_port = htons(port);
+
+      int ret = connect(sock, (struct sockaddr *)&serv_addr, sizeof(serv_addr));
+      if(ret < 0) {
+            perror( "connect" );
+            exit( EXIT_FAILURE );
+      }
+
+      char buffer[256];
+      struct iovec iov = { buffer, 0 };
+      struct msghdr msg;
+      msg.msg_name = NULL;
+      msg.msg_namelen = 0;
+      msg.msg_control = NULL;
+      msg.msg_controllen = 0;
+      msg.msg_iov = &iov;
+      msg.msg_iovlen = 1;
+      msg.msg_flags = 0;
+
+
+      int rd;
+      while(0 != (rd = read(STDIN_FILENO, buffer, 256))) {
+            if(rd < 0) {
+                  perror( "read" );
+                  exit( EXIT_FAILURE );
+            }
+
+            iov.iov_len = rd;
+            int sent = sendmsg(sock, &msg, 0);
+            if( sent < 0 ) {
+                  perror( "read" );
+                  exit( EXIT_FAILURE );
+            }
+
+            if(sent != rd) {
+                  printf("Expected to send %d bytes, sent %d\n", rd, sent);
+                  exit( EXIT_FAILURE );
+            }
+      }
+
+      ret = close(sock);
+      if(ret < 0) {
+            perror( "close" );
+            exit( EXIT_FAILURE );
+      }
+
+      exit( EXIT_SUCCESS );
+}
Index: tests/zombies/io/simple/server.c
===================================================================
--- tests/zombies/io/simple/server.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/io/simple/server.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,143 @@
+/*
+This is a simple server that users io_uring in blocking mode.
+It demonstrates the bare minimum needed to use io_uring.
+It uses liburing for simplicity.
+*/
+
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <unistd.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#include <liburing.h>
+
+struct io_uring ring;
+
+char data[256];
+struct iovec iov = { data, 256 };
+struct msghdr msg = { (void *)"", 0, &iov, 1, NULL, 0, 0 };
+static void async_read(int sock) {
+	/* get an sqe and fill in a READ operation */
+      struct io_uring_sqe * sqe = io_uring_get_sqe(&ring);
+      io_uring_prep_recvmsg(sqe, sock, &msg, 0);
+      sqe->user_data = 0;
+
+      /* tell the kernel we have an sqe ready for consumption */
+      int ret = io_uring_submit(&ring);
+      assert(ret == 1);
+}
+
+int main(int argc, char *argv[]) {
+	if(argc != 2) {
+            printf("usage:    %s portnumber\n", argv[0]);
+            exit( EXIT_FAILURE );
+      }
+      int port = atoi(argv[1]);
+      if(port < 1) {
+            printf("Invalid port : %d (from %s)\n", port, argv[1]);
+            exit( EXIT_FAILURE );
+      }
+
+	int sock = socket(AF_INET, SOCK_STREAM, 0);
+	if(sock < 0) {
+		perror( "socket" );
+		exit( EXIT_FAILURE );
+	}
+
+	struct sockaddr_in serv_addr;
+      memset(&serv_addr, 0, sizeof(serv_addr));
+      serv_addr.sin_family = AF_INET;
+      serv_addr.sin_addr.s_addr = INADDR_ANY;
+      serv_addr.sin_port = htons(port);
+
+	int ret = bind(sock, (struct sockaddr *) &serv_addr, sizeof(serv_addr));
+	if(ret < 0) {
+		perror( "bind" );
+		exit( EXIT_FAILURE );
+	}
+
+
+     	listen(sock,1);
+
+	struct sockaddr_in cli_addr;
+     	__socklen_t clilen = sizeof(cli_addr);
+	int newsock = accept(sock, (struct sockaddr *) &cli_addr, &clilen);
+     	if (newsock < 0) {
+		perror( "accept" );
+		exit( EXIT_FAILURE );
+	}
+
+	io_uring_queue_init( 16, &ring, 0 );
+
+	async_read( newsock );
+
+	while(1) {
+		struct io_uring_cqe * cqe;
+		struct __kernel_timespec ts = { 2, 0 };
+		// int ret = io_uring_wait_cqes( &ring, &cqe, 1, &ts, NULL); // Requires Linux 5.4
+		int ret = io_uring_wait_cqe( &ring, &cqe );
+
+		if( ret < 0 ) {
+                  printf( "Main Loop Error : %s\n", strerror(-ret) );
+			close( sock );
+                  exit( EXIT_FAILURE );
+            }
+
+		switch(cqe->user_data) {
+                  // Read completed
+                  case 0:
+                        // If it is the end of file we are done
+                        if( cqe->res == 0 ) {
+                              goto END;
+                        }
+
+				if( cqe->res < 0 ) {
+					perror( "Main Loop Error" );
+					close( sock );
+					exit( EXIT_FAILURE );
+				}
+
+				printf("'%.*s'\n", cqe->res, data);
+
+				async_read( newsock );
+
+                        // otherwise prepare a new read
+                        break;
+                  // Wait timed out, time to print
+			// Requires Linux 5.4
+                  case LIBURING_UDATA_TIMEOUT:
+                  	printf(".");
+                        break;
+                  // Problem
+                  default:
+                        printf("Unexpected user data : %llu", cqe->user_data);
+                        exit( EXIT_FAILURE );
+            }
+
+     		io_uring_cqe_seen( &ring, cqe );
+	}
+END:
+
+	io_uring_queue_exit( &ring );
+
+	ret = close(newsock);
+      if(ret < 0) {
+            perror( "close new" );
+            exit( EXIT_FAILURE );
+      }
+
+	ret = close(sock);
+      if(ret < 0) {
+            perror( "close old" );
+            exit( EXIT_FAILURE );
+      }
+
+	return 0;
+}
Index: tests/zombies/io/simple/server.cfa
===================================================================
--- tests/zombies/io/simple/server.cfa	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/io/simple/server.cfa	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,137 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <unistd.h>
+
+extern "C" {
+	#include <sys/types.h>
+	#include <sys/socket.h>
+	#include <netinet/in.h>
+}
+
+#include <time.hfa>
+#include <thread.hfa>
+
+//----------
+monitor Printer {};
+
+void heartbeat( Printer & mutex ) {
+	fprintf(stderr, ".");
+}
+
+void message( Printer & mutex, char * msg, size_t len ) {
+	fprintf(stderr, "'%.*s'", len, msg);
+}
+
+void status( Printer & mutex, const char * st ) {
+	fprintf(stderr, "%s\n", st);
+}
+
+void error( Printer & mutex, const char * msg, int error) {
+	fprintf(stderr, "%s - %s\n", msg, strerror(error));
+}
+
+Printer printer;
+
+//----------
+thread HeartBeat {};
+
+void ^?{}( HeartBeat & mutex ) {}
+
+void main( HeartBeat & this ) {
+	while(true) {
+		waitfor( ^?{} : this ) { break; }
+		or else{
+			sleep( 5`s );
+			heartbeat( printer );
+		}
+	}
+}
+
+//----------
+extern ssize_t cfa_recvmsg(int sockfd, struct msghdr *msg, int flags);
+extern int cfa_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);
+extern int cfa_close(int fd);
+
+//----------
+thread Server { int port; };
+void main( Server & this ) {
+	char data[256];
+	struct iovec iov = { data, 256 };
+	struct msghdr msg = { "", 0, &iov, 1, NULL, 0, 0 };
+
+	int sock = socket(AF_INET, SOCK_STREAM, 0);
+	if(sock < 0) {
+		error( printer, "socket", -sock);
+		exit( EXIT_FAILURE );
+	}
+
+	status( printer, "Socket created" );
+
+	struct sockaddr_in serv_addr;
+      memset(&serv_addr, 0, sizeof(serv_addr));
+      serv_addr.sin_family = AF_INET;
+      serv_addr.sin_addr.s_addr = INADDR_ANY;
+      serv_addr.sin_port = htons(this.port);
+
+	int ret = bind(sock, (struct sockaddr *) &serv_addr, sizeof(serv_addr));
+	if(ret < 0) {
+		error( printer, "bind", -ret);
+		exit( EXIT_FAILURE );
+	}
+
+	status( printer, "Socket bound" );
+
+     	listen(sock,1);
+
+	struct sockaddr_in cli_addr;
+     	__socklen_t clilen = sizeof(cli_addr);
+	int newsock = cfa_accept4(sock, (struct sockaddr *) &cli_addr, &clilen, 0);
+     	if (newsock < 0) {
+		error( printer, "accept", -newsock);
+		exit( EXIT_FAILURE );
+	}
+
+	status( printer, "Socket accepted, looping" );
+
+	while(1) {
+		int res = cfa_recvmsg(newsock, &msg, 0);
+		if(res == 0) break;
+		if(res < 0) {
+			error( printer, "recvmsg", -res);
+			exit( EXIT_FAILURE );
+		}
+
+		message(printer, data, res);
+	}
+
+	ret = cfa_close(newsock);
+      if(ret < 0) {
+            error( printer, "close new", -ret);
+            exit( EXIT_FAILURE );
+      }
+
+	ret = cfa_close(sock);
+      if(ret < 0) {
+            error( printer, "close old", -ret);
+            exit( EXIT_FAILURE );
+      }
+}
+
+//----------
+int main(int argc, char * argv []) {
+	if(argc != 2) {
+            printf("usage:    %s portnumber\n", argv[0]);
+            exit( EXIT_FAILURE );
+      }
+      int port = atoi(argv[1]);
+      if(port < 1) {
+            printf("Invalid port : %d (from %s)\n", port, argv[1]);
+            exit( EXIT_FAILURE );
+      }
+
+	HeartBeat heartbeat;
+	Server server = { port };
+	// while(true);
+}
Index: tests/zombies/io/simple/server_epoll.c
===================================================================
--- tests/zombies/io/simple/server_epoll.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/io/simple/server_epoll.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,177 @@
+/*
+Similar to the server in servier.c, this is a simple server
+that instead uses epoll to block.
+It opens the door to have several polling user-thread per cluster.
+It uses liburing for simplicity.
+*/
+
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <unistd.h>
+
+#include <sys/epoll.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#include <liburing.h>
+
+#define MAX_EVENTS 10
+struct epoll_event ev, events[MAX_EVENTS];
+
+struct io_uring ring;
+
+char data[256];
+struct iovec iov = { data, 256 };
+struct msghdr msg = { (void *)"", 0, &iov, 1, NULL, 0, 0 };
+static void async_read(int sock) {
+	/* get an sqe and fill in a READ operation */
+      struct io_uring_sqe * sqe = io_uring_get_sqe(&ring);
+      io_uring_prep_recvmsg(sqe, sock, &msg, 0);
+      sqe->user_data = 0;
+
+      /* tell the kernel we have an sqe ready for consumption */
+      int ret = io_uring_submit(&ring);
+      assert(ret == 1);
+}
+
+int main(int argc, char *argv[]) {
+	if(argc != 2) {
+            printf("usage:    %s portnumber\n", argv[0]);
+            exit( EXIT_FAILURE );
+      }
+      int port = atoi(argv[1]);
+      if(port < 1) {
+            printf("Invalid port : %d (from %s)\n", port, argv[1]);
+            exit( EXIT_FAILURE );
+      }
+
+	int sock = socket(AF_INET, SOCK_STREAM, 0);
+	if(sock < 0) {
+		perror( "socket" );
+		exit( EXIT_FAILURE );
+	}
+
+	struct sockaddr_in serv_addr;
+      memset(&serv_addr, 0, sizeof(serv_addr));
+      serv_addr.sin_family = AF_INET;
+      serv_addr.sin_addr.s_addr = INADDR_ANY;
+      serv_addr.sin_port = htons(port);
+
+	int ret = bind(sock, (struct sockaddr *) &serv_addr, sizeof(serv_addr));
+	if(ret < 0) {
+		perror( "bind" );
+		exit( EXIT_FAILURE );
+	}
+
+
+     	listen(sock,1);
+
+	struct sockaddr_in cli_addr;
+     	__socklen_t clilen = sizeof(cli_addr);
+	int newsock = accept(sock, (struct sockaddr *) &cli_addr, &clilen);
+     	if (newsock < 0) {
+		perror( "accept" );
+		exit( EXIT_FAILURE );
+	}
+
+	io_uring_queue_init( 16, &ring, 0 );
+
+      int epollfd = epoll_create1(0);
+      if (epollfd == -1) {
+            perror("epoll_create1");
+            exit(EXIT_FAILURE);
+      }
+
+      ev.events = EPOLLIN | EPOLLONESHOT;
+      ev.data.u64 = (uint64_t)&ring;
+      if (epoll_ctl(epollfd, EPOLL_CTL_ADD, ring.ring_fd, &ev) == -1) {
+            perror("epoll_ctl: first");
+            exit(EXIT_FAILURE);
+      }
+
+
+	async_read( newsock );
+
+	while(1) {
+            BLOCK:
+            int nfds = epoll_wait(epollfd, events, MAX_EVENTS, -1);
+            if (nfds == -1) {
+                  perror("epoll_wait");
+                  exit(EXIT_FAILURE);
+            }
+
+
+		while(1) {
+                  struct io_uring_cqe * cqe;
+                  int ret = io_uring_peek_cqe( &ring, &cqe );
+
+                  if( ret < 0 ) {
+                        if(-ret == EAGAIN) {
+                              if (epoll_ctl(epollfd, EPOLL_CTL_MOD, ring.ring_fd, &ev) == -1) {
+                                    perror("epoll_ctl: loop");
+                                    exit(EXIT_FAILURE);
+                              }
+                              goto BLOCK;
+                        }
+                        printf( "Main Loop Error : %s\n", strerror(-ret) );
+                        close( sock );
+                        exit( EXIT_FAILURE );
+                  }
+
+                  switch(cqe->user_data) {
+                        // Read completed
+                        case 0:
+                              // If it is the end of file we are done
+                              if( cqe->res == 0 ) {
+                                    goto END;
+                              }
+
+                              if( cqe->res < 0 ) {
+                                    perror( "Main Loop Error" );
+                                    close( sock );
+                                    exit( EXIT_FAILURE );
+                              }
+
+                              printf("'%.*s'\n", cqe->res, data);
+
+                              async_read( newsock );
+
+                              // otherwise prepare a new read
+                              break;
+                        // Wait timed out, time to print
+                        // Requires Linux 5.4
+                        case LIBURING_UDATA_TIMEOUT:
+                              printf(".");
+                              break;
+                        // Problem
+                        default:
+                              printf("Unexpected user data : %llu", cqe->user_data);
+                              exit( EXIT_FAILURE );
+                  }
+
+                  io_uring_cqe_seen( &ring, cqe );
+            }
+	}
+END:
+
+	io_uring_queue_exit( &ring );
+
+	ret = close(newsock);
+      if(ret < 0) {
+            perror( "close new" );
+            exit( EXIT_FAILURE );
+      }
+
+	ret = close(sock);
+      if(ret < 0) {
+            perror( "close old" );
+            exit( EXIT_FAILURE );
+      }
+
+	return 0;
+}
Index: tests/zombies/io_uring.txt
===================================================================
--- tests/zombies/io_uring.txt	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/io_uring.txt	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,1 @@
+Hello World!
Index: tests/zombies/it_out.c
===================================================================
--- tests/zombies/it_out.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/it_out.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,69 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// it_out.c -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Mar  8 22:14:39 2016
+// Update Count     : 8
+//
+
+typedef unsigned long streamsize_type;
+
+trait ostream( dtype os_type ) {
+	os_type *write( os_type *, const char *, streamsize_type );
+	int fail( os_type * );
+};
+
+trait writeable( otype T ) {
+	forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, T );
+};
+
+forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, char );
+forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, int );
+forall( dtype os_type | ostream( os_type ) ) os_type * ?<<?( os_type *, const char * );
+
+trait istream( dtype is_type ) {
+	is_type *read( is_type *, char *, streamsize_type );
+	is_type *unread( is_type *, char );
+	int fail( is_type * );
+	int eof( is_type * );
+};
+
+trait readable( otype T ) {
+	forall( dtype is_type | istream( is_type ) ) is_type * ?<<?( is_type *, T );
+};
+
+forall( dtype is_type | istream( is_type ) ) is_type * ?>>?( is_type *, char* );
+forall( dtype is_type | istream( is_type ) ) is_type * ?>>?( is_type *, int* );
+
+trait iterator( otype iterator_type, otype elt_type ) {
+	iterator_type ?++( iterator_type* );
+	iterator_type ++?( iterator_type* );
+	int ?==?( iterator_type, iterator_type );
+	int ?!=?( iterator_type, iterator_type );
+
+	lvalue elt_type *?( iterator_type );
+};
+
+forall( otype elt_type | writeable( elt_type ),
+		otype iterator_type | iterator( iterator_type, elt_type ),
+		dtype os_type | ostream( os_type ) )
+void write_all( iterator_type begin, iterator_type end, os_type *os );
+
+forall( otype elt_type | writeable( elt_type ),
+		otype iterator_type | iterator( iterator_type, elt_type ),
+		dtype os_type | ostream( os_type ) )
+void write_all( elt_type begin, iterator_type end, os_type *os ) {
+	os << begin;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa it_out.c" //
+// End: //
Index: tests/zombies/multicore.c
===================================================================
--- tests/zombies/multicore.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/multicore.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,25 @@
+#include <kernel.hfa>
+#include <thread.hfa>
+
+struct MyThread { thread_desc __thrd; };
+
+DECL_THREAD(MyThread);
+
+void ?{}( MyThread * this ) {}
+
+void main( MyThread* this ) {
+	for(int i = 0; i < 1000000; i++) {
+		yield();
+	}
+}
+
+int main(int argc, char* argv[]) {
+	// sout | "User main begin";
+	{
+		processor p;
+		{
+			scoped(MyThread) f[4];
+		}
+	}
+	// sout | "User main end";
+}
Index: tests/zombies/new.c
===================================================================
--- tests/zombies/new.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/new.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,32 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// new.c -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Mar  8 22:13:20 2016
+// Update Count     : 4
+//
+
+forall( otype T )
+void f( T *t ) {
+	t--;
+	*t;
+	++t;
+	t += 2;
+	t + 2;
+	--t;
+	t -= 2;
+	t - 4;
+	t[7];
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa new.c" //
+// End: //
Index: tests/zombies/poly-bench.c
===================================================================
--- tests/zombies/poly-bench.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/poly-bench.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,207 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// poly-bench.cc -- 
+//
+// Author           : Aaron Moss
+// Created On       : Sat May 16 07:26:30 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed May 27 18:25:19 2015
+// Update Count     : 5
+//
+
+extern "C" {
+#include <stdio.h>
+//#include "my_time.h"
+}
+
+#define N 200000000
+
+struct ipoint {
+	int x;
+	int y;
+};
+
+struct ipoint ?+?(struct ipoint a, struct ipoint b) {
+	struct ipoint r;
+	r.x = a.x + b.x;
+	r.y = a.y + b.y;
+	return r;
+}
+
+struct ipoint ?-?(struct ipoint a, struct ipoint b) {
+	struct ipoint r;
+	r.x = a.x - b.x;
+	r.y = a.y - b.y;
+	return r;
+}
+
+struct ipoint ?*?(struct ipoint a, struct ipoint b) {
+	struct ipoint r;
+	r.x = a.x * b.x;
+	r.y = a.y * b.y;
+	return r;
+}
+
+struct dpoint {
+	double x;
+	double y;
+};
+
+struct dpoint ?+?(struct dpoint a, struct dpoint b) {
+	struct dpoint r;
+	r.x = a.x + b.x;
+	r.y = a.y + b.y;
+	return r;
+}
+
+struct dpoint ?-?(struct dpoint a, struct dpoint b) {
+	struct dpoint r;
+	r.x = a.x - b.x;
+	r.y = a.y - b.y;
+	return r;
+}
+
+struct dpoint ?*?(struct dpoint a, struct dpoint b) {
+	struct dpoint r;
+	r.x = a.x * b.x;
+	r.y = a.y * b.y;
+	return r;
+}
+
+int a2b2_mono_int(int a, int b) {
+	return (a - b)*(a + b);
+}
+
+double a2b2_mono_double(double a, double b) {
+	return (a - b)*(a + b);
+}
+
+struct ipoint a2b2_mono_ipoint(struct ipoint a, struct ipoint b) {
+	return (a - b)*(a + b);
+}
+
+struct dpoint a2b2_mono_dpoint(struct dpoint a, struct dpoint b) {
+	return (a - b)*(a + b);
+}
+
+forall(type T | { T ?+?(T,T); T ?-?(T,T); T ?*?(T,T); })
+T a2b2_poly(T a, T b) {
+	return (a - b)*(a + b);
+}
+
+typedef int clock_t;
+long ms_between(clock_t start, clock_t end) {
+//	return (end - start) / (CLOCKS_PER_SEC / 1000);
+	return 0;
+}
+int clock() { return 3; }
+
+int main(int argc, char** argv) {
+	clock_t start, end;
+	int i;
+	
+	int a, b;
+	double c, d;
+	struct ipoint p, q;
+	struct dpoint r, s;
+	
+	printf("\n## a^2-b^2 ##\n");
+	
+	a = 5, b = 3;
+	start = clock();
+	for (i = 0; i < N/2; ++i) {
+		a = a2b2_mono_int(a, b);
+		b = a2b2_mono_int(b, a);
+	}
+	end = clock();
+	printf("mono_int:   %7ld  [%d,%d]\n", ms_between(start, end), a, b);
+	
+	a = 5, b = 3;
+	start = clock();
+	for (i = 0; i < N/2; ++i) {
+		a = a2b2_poly(a, b);
+		b = a2b2_poly(b, a);
+	}
+	end = clock();
+	printf("poly_int:   %7ld  [%d,%d]\n", ms_between(start, end), a, b);
+	
+/*	{
+	a = 5, b = 3;
+	// below doesn't actually work; a2b2_poly isn't actually assigned, just declared
+	* [int] (int, int) a2b2_poly = a2b2_mono_int;
+	start = clock();
+	for (i = 0; i < N/2; ++i) {
+//			printf("\t[%d,%d]\n", a, b);
+a = a2b2_poly(a, b);
+//			printf("\t[%d,%d]\n", a, b);
+b = a2b2_poly(b, a);
+}
+end = clock();
+printf("spec_int:   %7ld  [%d,%d]\n", ms_between(start, end), a, b);
+}
+*/	
+	c = 5.0, d = 3.0;
+	start = clock();
+	for (i = 0; i < N/2; ++i) {
+		c = a2b2_mono_double(c, d);
+		d = a2b2_mono_double(d, c);
+	}
+	end = clock();
+	printf("mono_double:%7ld  [%f,%f]\n", ms_between(start, end), c, d);
+		
+	c = 5.0, d = 3.0;
+	start = clock();
+	for (i = 0; i < N/2; ++i) {
+		c = a2b2_poly(c, d);
+		d = a2b2_poly(d, c);
+	}
+	end = clock();
+	printf("poly_double:%7ld  [%f,%f]\n", ms_between(start, end), c, d);
+	
+	p.x = 5, p.y = 5, q.x = 3, q.y = 3;
+	start = clock();
+	for (i = 0; i < N/2; ++i) {
+		p = a2b2_mono_ipoint(p, q);
+		q = a2b2_mono_ipoint(q, p);
+	}
+	end = clock();
+	printf("mono_ipoint:%7ld  [(%d,%d),(%d,%d)]\n", ms_between(start, end), p.x, p.y, q.x, q.y);
+		
+	p.x = 5, p.y = 5, q.x = 3, q.y = 3;
+	start = clock();
+	for (i = 0; i < N/2; ++i) {
+		p = a2b2_poly(p, q);
+		q = a2b2_poly(q, p);
+	}
+	end = clock();
+	printf("poly_ipoint:%7ld  [(%d,%d),(%d,%d)]\n", ms_between(start, end), p.x, p.y, q.x, q.y);
+	
+	r.x = 5.0, r.y = 5.0, s.x = 3.0, s.y = 3.0;
+	start = clock();
+	for (i = 0; i < N/2; ++i) {
+		r = a2b2_mono_dpoint(r, s);
+		s = a2b2_mono_dpoint(s, r);
+	}
+	end = clock();
+	printf("mono_dpoint:%7ld  [(%f,%f),(%f,%f)]\n", ms_between(start, end), r.x, r.y, s.x, s.y);
+		
+	r.x = 5.0, r.y = 5.0, s.x = 3.0, s.y = 3.0;
+	start = clock();
+	for (i = 0; i < N/2; ++i) {
+		r = a2b2_poly(r, s);
+		s = a2b2_poly(s, r);
+	}
+	end = clock();
+	printf("poly_dpoint:%7ld  [(%f,%f),(%f,%f)]\n", ms_between(start, end), r.x, r.y, s.x, s.y);
+
+	return 0;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa poly-bench.c" //
+// End: //
Index: tests/zombies/prolog.c
===================================================================
--- tests/zombies/prolog.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/prolog.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,50 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// prolog.c --
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 23:27:19 2018
+// Update Count     : 6
+//
+
+#include <fstream.hfa>
+
+void printResult( int x ) { sout | "int"; }
+void printResult( double x ) { sout | "double"; }
+void printResult( char * x ) { sout | "char*"; }
+
+void is_arithmetic( int x ) {}
+void is_arithmetic( double x ) {}
+
+void is_integer( int x ) {}
+
+trait ArithmeticType( otype T ) {
+	void is_arithmetic( T );
+};
+
+trait IntegralType( otype T | ArithmeticType( T ) ) {
+	void is_integer( T );
+};
+
+forall( otype T | IntegralType( T ) | { void printResult( T ); } )
+void hornclause( T param ) {
+	printResult( param );
+}
+
+int main() {
+	int x;
+	double x;
+	char * x;
+	hornclause( x );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa prolog.c" //
+// End: //
Index: tests/zombies/quad.c
===================================================================
--- tests/zombies/quad.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/quad.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,36 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// quad.c --
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 23:26:58 2018
+// Update Count     : 9
+//
+
+#include <fstream.hfa>
+
+forall( otype T | { T ?*?( T, T ); } )
+T square( T t ) {
+	return t * t;
+}
+
+forall( otype U | { U square( U ); } )
+U quad( U u ) {
+	return square( square( u ) );
+}
+
+int main() {
+	int N = 2;
+	sout | "result of quad of" | N | "is" | quad( N );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa quad.c" //
+// End: //
Index: tests/zombies/s.c
===================================================================
--- tests/zombies/s.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/s.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,28 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// s.c -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Sun Jan  3 22:38:45 2016
+// Update Count     : 3
+//
+
+//int ?!=?( int, int );
+
+void f() {
+	int a;
+	a ? 4 : 5;
+	1 ? 4 : 5;
+	0 ? 4 : 5;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa s.c" //
+// End: //
Index: tests/zombies/simplePoly.c
===================================================================
--- tests/zombies/simplePoly.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/simplePoly.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,34 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// simplePoly.c -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Mar  8 22:06:41 2016
+// Update Count     : 3
+//
+
+forall( otype T, otype U | { T f( T, U ); } )
+T q( T t, U u ) {
+	return f( t, u );
+//  return t;
+}
+
+int f( int, double* );
+
+void g( void ) {
+	int y;
+	double x;
+//  if ( y )
+	q( 3, &x );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa simplePoly.c" //
+// End: //
Index: tests/zombies/simpler.c
===================================================================
--- tests/zombies/simpler.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/simpler.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,25 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// simpler.c -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Mar  8 22:06:30 2016
+// Update Count     : 2
+//
+
+forall( otype T ) T id( T, T );
+
+int main() {
+	id( 0, 7 );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa simpler.c" //
+// End: //
Index: tests/zombies/specialize.c
===================================================================
--- tests/zombies/specialize.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/specialize.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,59 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// specialize.c -- 
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Mar  8 22:06:17 2016
+// Update Count     : 3
+//
+
+/// void f( const int * );
+/// 
+/// void m()
+/// {
+///   f( 0 );
+/// }
+
+/// forall( dtype T ) T* f( T* );
+/// void g( int* (*)(int*) );
+/// 
+/// int m() {
+///   g( f );
+/// }
+
+/// void f1( void (*q)( forall( dtype U ) U* (*p)( U* ) ) );
+/// void g1( int* (*)(int*) );
+/// 
+/// int m1() {
+///   f1( g1 );
+/// }
+
+extern "C" {
+	int printf( const char*, ... );
+}
+
+forall( otype T ) T f( T t )
+{
+	printf( "in f; sizeof T is %d\n", sizeof( T ) );
+	return t;
+}
+
+void g( int (*p)(int) )
+{
+	printf( "g: f(7) returned %d\n", f(7) );
+}
+
+int main() {
+	g( f );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa specialize.c" //
+// End: //
Index: tests/zombies/square.c
===================================================================
--- tests/zombies/square.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/square.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,71 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// square.c --
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 23:28:24 2018
+// Update Count     : 28
+//
+
+#include <fstream.hfa>
+
+forall( otype T | { T ?*?( T, T ); } )
+T square( T t ) {
+	return t * t;
+} // square
+
+int main() {
+#if 0
+	sout | "result of squaring 9 is ";
+
+	// char does not have multiplication.
+	char ?*?( char a1, char a2 ) {
+		return (char)((int)a1 * (int)a2);
+	} // ?*?
+	char c = 9;
+	sout | "char\t\t\t" | square( c );
+
+	sout | square( s );
+#endif
+	short s = 9;
+	square( s );
+#if 0
+	signed int i = 9;
+	sout | "signed int\t\t" | square( i );
+
+	unsigned int ui = 9;
+	sout | "unsigned int\t\t" | square( ui );
+
+	long int li = 9;
+	sout | "signed long int\t\t" | square( li );
+
+	unsigned long int uli = 9;
+	sout | "unsigned long int\t" | square( uli );
+
+	signed long long int lli = 9;
+	sout | "signed long long int\t" | square( lli );
+
+	unsigned long long int ulli = 9;
+	sout | "unsigned long long int\t" | square( ulli );
+
+	float f = 9.0;
+	sout | "float\t\t\t" | square( f );
+
+	double d = 9.0;
+	sout | "double\t\t\t" | square( d );
+
+	long double ld = 9.0;
+	sout | "long double\t\t" | square( ld );
+#endif
+} // main
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa square.c" //
+// End: //
Index: tests/zombies/twice.c
===================================================================
--- tests/zombies/twice.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/twice.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,36 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// twice.c --
+//
+// Author           : Peter A. Buhr
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Dec 11 23:28:08 2018
+// Update Count     : 47
+//
+
+#include <fstream.hfa>
+
+forall( otype T | { T ?+?( T, T ); } )
+T twice( const T t ) {
+	return t + t;
+}
+
+// char does not have addition
+char ?+?( char op1, char op2 ) { return (int)op1 + op2; } // cast forces integer addition or recursion
+
+// signed char does not have addition
+signed char ?+?( signed char op1, signed char op2 ) { return (int)op1 + op2; } // cast forces integer addition or recursion
+
+int main( void ) {
+	sout | twice( ' ' ) | ' ' | twice( (signed char)0 ) | twice( (int)1 ) | twice( 3.2 );
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa twice.c" //
+// End: //
Index: tests/zombies/wrapper/.gitignore
===================================================================
--- tests/zombies/wrapper/.gitignore	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/wrapper/.gitignore	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,3 @@
+.tags
+build/
+test
Index: tests/zombies/wrapper/premake4.lua
===================================================================
--- tests/zombies/wrapper/premake4.lua	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/wrapper/premake4.lua	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,79 @@
+#!lua
+
+-- Additional Linux libs: "X11", "Xxf86vm", "Xi", "Xrandr", "stdc++"
+
+includeDirList = {
+	"src/",
+	"../",
+}
+
+libDirectories = {
+
+}
+
+
+if os.get() == "linux" then
+    linkLibs = {
+	"bsd"
+    }
+end
+
+-- Build Options:
+buildOptions = {"\n  CC = cfa\n  CXX = cfa"}
+
+solution "strings"
+	configurations  { "debug", "release",
+				"cproc-debug", "cproc-release",
+				"cfa-debug", "cfa-release" }
+
+	project "test"
+		kind "ConsoleApp"
+		language "C"
+		location "build"
+		objdir "build"
+		targetdir "."
+		buildoptions (buildOptions)
+		defines {	"bool=_Bool",
+				"\"true=((_Bool)(const signed int)1)\"",
+				"\"false=((_Bool)(const signed int)0)\"",
+				"_GNU_SOURCE",
+				"__cforall",
+				"USE_BSD_LIB"
+			}
+		libdirs (libDirectories)
+		links (linkLibs)
+		linkoptions (linkOptionList)
+		includedirs (includeDirList)
+		files { "src/**.c" }
+
+	configuration "debug"
+		defines { "DEBUG" }
+		flags { "Symbols" }
+
+	configuration "release"
+		defines { "NDEBUG" }
+		flags { "Optimize" }
+
+	configuration "cproc-debug"
+		buildoptions ({"-E"})
+		linkoptions ({"-E"})
+	      defines { "DEBUG" }
+	      flags { "Symbols" }
+
+	configuration "cproc-release"
+		buildoptions ({"-E"})
+		linkoptions ({"-E"})
+	      defines { "DEBUG" }
+	      flags { "Symbols" }
+
+	configuration "cfa-debug"
+		linkoptions ({"-E"})
+		files { "build/cproc-debug/*.o" }
+	      defines { "DEBUG" }
+	      flags { "Symbols" }
+
+	configuration "cfa-release"
+		linkoptions ({"-E"})
+		files { "build/cproc-debug/*.o" }
+	      defines { "DEBUG" }
+	      flags { "Symbols" }
Index: tests/zombies/wrapper/src/main.c
===================================================================
--- tests/zombies/wrapper/src/main.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/wrapper/src/main.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,16 @@
+#include "pointer.h"
+
+wrapper_t make_copy(wrapper_t copy) {
+	return copy;
+}
+
+int main(int argc, char const *argv[]) {
+	wrapper_t p = wrap(6);
+	sout | nl | "test started";
+	wrapper_t p2 = p;
+	clear(&p);
+	p = p2;
+	wrapper_t p3 = make_copy(p2);
+	sout | nl | "test ended";
+	return 0;
+}
Index: tests/zombies/wrapper/src/pointer.h
===================================================================
--- tests/zombies/wrapper/src/pointer.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/wrapper/src/pointer.h	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,122 @@
+#pragma once
+
+#include <fstream.hfa>
+#include <stddef.h>
+#include <stdlib.hfa>
+
+//==============================================================================
+// type safe malloc / free
+
+forall(otype T)
+T* new()
+{
+	T* p = malloc();
+	p{};
+	return p;
+}
+
+forall(otype T)
+void delete(T* p)
+{
+	^p{};
+	free(p);
+}
+
+//==============================================================================
+// ref counter content
+
+struct content_t
+{
+	int value;
+	size_t count;
+};
+
+void ?{}(content_t* this)
+{
+	sout | "Constructing content";
+	this->count = 0;
+}
+
+void ^?{}(content_t* this)
+{
+	sout | "Destroying content";
+}
+
+//==============================================================================
+// ref counter wrapper
+
+struct wrapper_t
+{
+	content_t* ptr;
+};
+
+void ?{}(wrapper_t* this)
+{
+	sout | "Constructing empty ref pointer" | nl;
+	this->ptr = NULL;
+}
+
+void ?{}(wrapper_t* this, wrapper_t rhs)
+{
+	sout | "Constructing ref pointer from copy";
+	this->ptr = rhs.ptr;
+	this->ptr->count++;
+	sout | "Reference is " | this->ptr->count | nl;
+}
+
+void ^?{}(wrapper_t* this)
+{
+	if(this->ptr)
+	{
+		sout | "Destroying ref pointer";
+		this->ptr->count--;
+		sout | "Reference is " | this->ptr->count | nl;
+		if(!this->ptr->count) delete(this->ptr);
+	}
+	else
+	{
+		sout | "Destroying empty ref pointer" | nl;
+	}
+}
+
+wrapper_t ?=?(wrapper_t* this, wrapper_t rhs)
+{
+	sout | "Setting ref pointer";
+	if(this->ptr)
+	{
+		this->ptr->count--;
+		sout | "Reference is " | this->ptr->count | nl;
+		if(!this->ptr->count) delete(this->ptr);
+	}
+	this->ptr = rhs.ptr;
+	this->ptr->count++;
+	sout | "Reference is " | this->ptr->count | nl;
+}
+
+void set(wrapper_t* this, content_t* c)
+{
+	this->ptr = c;
+	this->ptr->count++;
+	sout | "Setting ref pointer";
+	sout | "Reference is " | this->ptr->count | nl;
+}
+
+void clear(wrapper_t* this)
+{
+	sout | "Clearing ref pointer";
+	this->ptr->count--;
+	sout | "Reference is " | this->ptr->count | nl;
+	if(!this->ptr->count) delete(this->ptr);
+	this->ptr = NULL;
+}
+
+
+wrapper_t wrap(int val)
+{
+	wrapper_t w;
+	content_t* c = malloc();
+	c{};
+	c->value = val;
+	set(&w, c);
+	return w;
+}
Index: tests/zombies/zero_one.c
===================================================================
--- tests/zombies/zero_one.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
+++ tests/zombies/zero_one.c	(revision 87b93323c11d412259391b6741a7bc4dcad8981e)
@@ -0,0 +1,24 @@
+#include <fstream.hfa>
+
+void foo(zero_t o)
+{
+	sout | "It's a Zero!";
+}
+
+void foo(one_t o)
+{
+	sout | "It's a One!";
+}
+
+void foo(int o)
+{
+	sout | "It's a Number!";
+}
+
+int main()
+{
+	foo(0);
+	foo(1);
+	foo(2);
+	return 0;
+}
