Index: kernel/generic/src/synch/rcu.c
===================================================================
--- kernel/generic/src/synch/rcu.c	(revision 827195897bcb3224e1e2c0e46a9c8649c05bd714)
+++ kernel/generic/src/synch/rcu.c	(revision deacc58d86dbbc4e37a7d1534bd9933e671162e1)
@@ -123,5 +123,6 @@
  * 
  */
- 
+
+#include <assert.h>
 #include <synch/rcu.h>
 #include <synch/condvar.h>
@@ -404,5 +405,5 @@
 	/* Stop and wait for reclaimers. */
 	for (unsigned int cpu_id = 0; cpu_id < config.cpu_active; ++cpu_id) {
-		ASSERT(cpus[cpu_id].rcu.reclaimer_thr != NULL);
+		assert(cpus[cpu_id].rcu.reclaimer_thr != NULL);
 	
 		if (cpus[cpu_id].rcu.reclaimer_thr) {
@@ -487,5 +488,5 @@
 static void read_unlock_impl(size_t *pnesting_cnt)
 {
-	ASSERT(PREEMPTION_DISABLED || interrupts_disabled());
+	assert(PREEMPTION_DISABLED || interrupts_disabled());
 	
 	if (0 == --(*pnesting_cnt)) {
@@ -509,5 +510,5 @@
 void _rcu_signal_read_unlock(void)
 {
-	ASSERT(PREEMPTION_DISABLED || interrupts_disabled());
+	assert(PREEMPTION_DISABLED || interrupts_disabled());
 	
 	/*
@@ -531,5 +532,5 @@
 	 */
 	if (THREAD && local_atomic_exchange(&THREAD->rcu.was_preempted, false)) {
-		ASSERT(link_used(&THREAD->rcu.preempt_link));
+		assert(link_used(&THREAD->rcu.preempt_link));
 
 		rm_preempted_reader();
@@ -563,5 +564,5 @@
 {
 	/* Calling from a reader section will deadlock. */
-	ASSERT(!rcu_read_locked());
+	assert(!rcu_read_locked());
 	
 	synch_item_t completion; 
@@ -576,5 +577,5 @@
 {
 	synch_item_t *completion = member_to_inst(rcu_item, synch_item_t, rcu_item);
-	ASSERT(completion);
+	assert(completion);
 	waitq_wakeup(&completion->wq, WAKEUP_FIRST);
 }
@@ -615,5 +616,5 @@
 static void add_barrier_cb(void *arg)
 {
-	ASSERT(interrupts_disabled() || PREEMPTION_DISABLED);
+	assert(interrupts_disabled() || PREEMPTION_DISABLED);
 	atomic_inc(&rcu.barrier_wait_cnt);
 	rcu_call(&CPU->rcu.barrier_item, barrier_complete);
@@ -657,5 +658,5 @@
 	rcu_func_t func)
 {
-	ASSERT(rcu_item);
+	assert(rcu_item);
 	
 	rcu_item->func = func;
@@ -689,5 +690,5 @@
 static bool cur_cbs_empty(void)
 {
-	ASSERT(THREAD && THREAD->wired);
+	assert(THREAD && THREAD->wired);
 	return NULL == CPU->rcu.cur_cbs;
 }
@@ -695,5 +696,5 @@
 static bool next_cbs_empty(void)
 {
-	ASSERT(THREAD && THREAD->wired);
+	assert(THREAD && THREAD->wired);
 	return NULL == CPU->rcu.next_cbs;
 }
@@ -702,5 +703,5 @@
 static bool arriving_cbs_empty(void)
 {
-	ASSERT(THREAD && THREAD->wired);
+	assert(THREAD && THREAD->wired);
 	/* 
 	 * Accessing with interrupts enabled may at worst lead to 
@@ -719,6 +720,6 @@
 static void reclaimer(void *arg)
 {
-	ASSERT(THREAD && THREAD->wired);
-	ASSERT(THREAD == CPU->rcu.reclaimer_thr);
+	assert(THREAD && THREAD->wired);
+	assert(THREAD == CPU->rcu.reclaimer_thr);
 
 	rcu_gp_t last_compl_gp = 0;
@@ -726,5 +727,5 @@
 	
 	while (ok && wait_for_pending_cbs()) {
-		ASSERT(CPU->rcu.reclaimer_thr == THREAD);
+		assert(CPU->rcu.reclaimer_thr == THREAD);
 		
 		exec_completed_cbs(last_compl_gp);
@@ -765,5 +766,5 @@
 	/* Both next_cbs and cur_cbs GP elapsed. */
 	if (CPU->rcu.next_cbs_gp <= last_completed_gp) {
-		ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
+		assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
 		
 		size_t exec_cnt = CPU->rcu.cur_cbs_cnt + CPU->rcu.next_cbs_cnt;
@@ -864,5 +865,5 @@
 	 */
 	if (CPU->rcu.next_cbs) {
-		ASSERT(CPU->rcu.parriving_cbs_tail != &CPU->rcu.arriving_cbs);
+		assert(CPU->rcu.parriving_cbs_tail != &CPU->rcu.arriving_cbs);
 		
 		CPU->rcu.arriving_cbs = NULL;
@@ -913,5 +914,5 @@
 	}
 	
-	ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
+	assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
 	
 	return expedite;	
@@ -933,6 +934,6 @@
 	spinlock_lock(&rcu.gp_lock);
 
-	ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
-	ASSERT(CPU->rcu.cur_cbs_gp <= _rcu_cur_gp + 1);
+	assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
+	assert(CPU->rcu.cur_cbs_gp <= _rcu_cur_gp + 1);
 	
 	while (rcu.completed_gp < CPU->rcu.cur_cbs_gp) {
@@ -1029,5 +1030,5 @@
 static void sample_local_cpu(void *arg)
 {
-	ASSERT(interrupts_disabled());
+	assert(interrupts_disabled());
 	cpu_mask_t *reader_cpus = (cpu_mask_t *)arg;
 	
@@ -1054,5 +1055,5 @@
 void rcu_after_thread_ran(void)
 {
-	ASSERT(interrupts_disabled());
+	assert(interrupts_disabled());
 
 	/* 
@@ -1116,5 +1117,5 @@
 void rcu_before_thread_runs(void)
 {
-	ASSERT(!rcu_read_locked());
+	assert(!rcu_read_locked());
 	
 	/* Load the thread's saved nesting count from before it was preempted. */
@@ -1129,5 +1130,5 @@
 void rcu_thread_exiting(void)
 {
-	ASSERT(THE->rcu_nesting == 0);
+	assert(THE->rcu_nesting == 0);
 	
 	/* 
@@ -1157,5 +1158,5 @@
 void _rcu_preempted_unlock(void)
 {
-	ASSERT(0 == THE->rcu_nesting || RCU_WAS_PREEMPTED == THE->rcu_nesting);
+	assert(0 == THE->rcu_nesting || RCU_WAS_PREEMPTED == THE->rcu_nesting);
 	
 	size_t prev = local_atomic_exchange(&THE->rcu_nesting, 0);
@@ -1220,6 +1221,6 @@
 	}
 	
-	ASSERT(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
-	ASSERT(_rcu_cur_gp <= CPU->rcu.cur_cbs_gp);
+	assert(CPU->rcu.cur_cbs_gp <= CPU->rcu.next_cbs_gp);
+	assert(_rcu_cur_gp <= CPU->rcu.cur_cbs_gp);
 	
 	/* 
@@ -1262,5 +1263,5 @@
 static bool cv_wait_for_gp(rcu_gp_t wait_on_gp)
 {
-	ASSERT(spinlock_locked(&rcu.gp_lock));
+	assert(spinlock_locked(&rcu.gp_lock));
 	
 	bool interrupted = false;
@@ -1284,5 +1285,5 @@
 
 		if (detector_idle) {
-			ASSERT(_rcu_cur_gp == rcu.completed_gp);
+			assert(_rcu_cur_gp == rcu.completed_gp);
 			condvar_signal(&rcu.req_gp_changed);
 		}
@@ -1323,5 +1324,5 @@
 static bool wait_for_detect_req(void)
 {
-	ASSERT(spinlock_locked(&rcu.gp_lock));
+	assert(spinlock_locked(&rcu.gp_lock));
 	
 	bool interrupted = false;
@@ -1340,5 +1341,5 @@
 static void end_cur_gp(void)
 {
-	ASSERT(spinlock_locked(&rcu.gp_lock));
+	assert(spinlock_locked(&rcu.gp_lock));
 	
 	rcu.completed_gp = _rcu_cur_gp;
@@ -1423,6 +1424,6 @@
 static void sample_local_cpu(void *arg)
 {
-	ASSERT(interrupts_disabled());
-	ASSERT(!CPU->rcu.is_delaying_gp);
+	assert(interrupts_disabled());
+	assert(!CPU->rcu.is_delaying_gp);
 	
 	/* Cpu did not pass a quiescent state yet. */
@@ -1430,5 +1431,5 @@
 		/* Interrupted a reader in a reader critical section. */
 		if (0 < CPU->rcu.nesting_cnt) {
-			ASSERT(!CPU->idle);
+			assert(!CPU->idle);
 			/* 
 			 * Note to notify the detector from rcu_read_unlock(). 
@@ -1492,5 +1493,5 @@
 void rcu_after_thread_ran(void)
 {
-	ASSERT(interrupts_disabled());
+	assert(interrupts_disabled());
 
 	/* 
@@ -1559,6 +1560,6 @@
 void rcu_before_thread_runs(void)
 {
-	ASSERT(PREEMPTION_DISABLED || interrupts_disabled());
-	ASSERT(0 == CPU->rcu.nesting_cnt);
+	assert(PREEMPTION_DISABLED || interrupts_disabled());
+	assert(0 == CPU->rcu.nesting_cnt);
 	
 	/* Load the thread's saved nesting count from before it was preempted. */
@@ -1590,7 +1591,7 @@
 void rcu_thread_exiting(void)
 {
-	ASSERT(THREAD != NULL);
-	ASSERT(THREAD->state == Exiting);
-	ASSERT(PREEMPTION_DISABLED || interrupts_disabled());
+	assert(THREAD != NULL);
+	assert(THREAD->state == Exiting);
+	assert(PREEMPTION_DISABLED || interrupts_disabled());
 	
 	/* 
@@ -1615,5 +1616,5 @@
 static void start_new_gp(void)
 {
-	ASSERT(spinlock_locked(&rcu.gp_lock));
+	assert(spinlock_locked(&rcu.gp_lock));
 	
 	irq_spinlock_lock(&rcu.preempt_lock, true);
@@ -1734,5 +1735,5 @@
 static void upd_missed_gp_in_wait(rcu_gp_t completed_gp)
 {
-	ASSERT(CPU->rcu.cur_cbs_gp <= completed_gp);
+	assert(CPU->rcu.cur_cbs_gp <= completed_gp);
 	
 	size_t delta = (size_t)(completed_gp - CPU->rcu.cur_cbs_gp);
@@ -1764,5 +1765,5 @@
 	irq_spinlock_lock(&rcu.preempt_lock, true);
 	
-	ASSERT(link_used(&THREAD->rcu.preempt_link));
+	assert(link_used(&THREAD->rcu.preempt_link));
 
 	bool prev_empty = list_empty(&rcu.cur_preempted);
