Index: libcfa/prelude/builtins.c
===================================================================
--- libcfa/prelude/builtins.c	(revision ca7949b76a85d5849fcb348fbe59dde3c18c66a8)
+++ libcfa/prelude/builtins.c	(revision 5b544a6a33b882680dc245c678d32ddb6742f4a2)
@@ -48,4 +48,28 @@
 void exit( int status, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ ));
 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
+
+forall(dtype T)
+static inline T & identity(T & i) {
+	return i;
+}
+
+// generator support
+struct $generator {
+	inline int;
+};
+
+static inline void  ?{}($generator & this) { ((int&)this) = 0; }
+static inline void ^?{}($generator &) {}
+
+trait is_generator(dtype T) {
+      void main(T & this);
+      $generator * get_generator(T & this);
+};
+
+forall(dtype T | is_generator(T))
+static inline T & resume(T & gen) {
+	main(gen);
+	return gen;
+}
 
 // implicit increment, decrement if += defined, and implicit not if != defined
Index: libcfa/src/concurrency/coroutine.cfa
===================================================================
--- libcfa/src/concurrency/coroutine.cfa	(revision ca7949b76a85d5849fcb348fbe59dde3c18c66a8)
+++ libcfa/src/concurrency/coroutine.cfa	(revision 5b544a6a33b882680dc245c678d32ddb6742f4a2)
@@ -208,5 +208,5 @@
 
 		if(cor->state == Primed) {
-			suspend();
+			__cfactx_suspend();
 		}
 
Index: libcfa/src/concurrency/coroutine.hfa
===================================================================
--- libcfa/src/concurrency/coroutine.hfa	(revision ca7949b76a85d5849fcb348fbe59dde3c18c66a8)
+++ libcfa/src/concurrency/coroutine.hfa	(revision 5b544a6a33b882680dc245c678d32ddb6742f4a2)
@@ -46,9 +46,4 @@
 //-----------------------------------------------------------------------------
 // Public coroutine API
-static inline void suspend(void);
-
-forall(dtype T | is_coroutine(T))
-static inline T & resume(T & cor);
-
 forall(dtype T | is_coroutine(T))
 void prime(T & cor);
@@ -96,22 +91,24 @@
 
 // Suspend implementation inlined for performance
-static inline void suspend(void) {
-	// optimization : read TLS once and reuse it
-	// Safety note: this is preemption safe since if
-	// preemption occurs after this line, the pointer
-	// will also migrate which means this value will
-	// stay in syn with the TLS
-	$coroutine * src = TL_GET( this_thread )->curr_cor;
+extern "C" {
+	static inline void __cfactx_suspend(void) {
+		// optimization : read TLS once and reuse it
+		// Safety note: this is preemption safe since if
+		// preemption occurs after this line, the pointer
+		// will also migrate which means this value will
+		// stay in syn with the TLS
+		$coroutine * src = TL_GET( this_thread )->curr_cor;
 
-	assertf( src->last != 0,
-		"Attempt to suspend coroutine \"%.256s\" (%p) that has never been resumed.\n"
-		"Possible cause is a suspend executed in a member called by a coroutine user rather than by the coroutine main.",
-		src->name, src );
-	assertf( src->last->state != Halted,
-		"Attempt by coroutine \"%.256s\" (%p) to suspend back to terminated coroutine \"%.256s\" (%p).\n"
-		"Possible cause is terminated coroutine's main routine has already returned.",
-		src->name, src, src->last->name, src->last );
+		assertf( src->last != 0,
+			"Attempt to suspend coroutine \"%.256s\" (%p) that has never been resumed.\n"
+			"Possible cause is a suspend executed in a member called by a coroutine user rather than by the coroutine main.",
+			src->name, src );
+		assertf( src->last->state != Halted,
+			"Attempt by coroutine \"%.256s\" (%p) to suspend back to terminated coroutine \"%.256s\" (%p).\n"
+			"Possible cause is terminated coroutine's main routine has already returned.",
+			src->name, src, src->last->name, src->last );
 
-	$ctx_switch( src, src->last );
+		$ctx_switch( src, src->last );
+	}
 }
 
