Index: libcfa/src/bits/locks.hfa
===================================================================
--- libcfa/src/bits/locks.hfa	(revision dd4e2d7a1ba13c040f8d0eb5c9b0c672b5755c3a)
+++ libcfa/src/bits/locks.hfa	(revision 6c12fd28ccd5d0df5de4277788cba0edd4a3bc8c)
@@ -115,5 +115,5 @@
 		char * strerror(int);
 	}
-	#define CHECKED(x) { int err = x; if( err != 0 ) abort("KERNEL ERROR: %s\n", strerror(err)); }
+	#define CHECKED(x) { int err = x; if( err != 0 ) abort("KERNEL ERROR: Operation \"" #x "\" return error %d - %s\n", err, strerror(err)); }
 
 	struct __bin_sem_t {
Index: libcfa/src/concurrency/kernel.cfa
===================================================================
--- libcfa/src/concurrency/kernel.cfa	(revision dd4e2d7a1ba13c040f8d0eb5c9b0c672b5755c3a)
+++ libcfa/src/concurrency/kernel.cfa	(revision 6c12fd28ccd5d0df5de4277788cba0edd4a3bc8c)
@@ -901,4 +901,5 @@
 	// Wake them up
 	__cfadbg_print_safe(runtime_core, "Kernel : waking Processor %p\n", this->idles.head);
+	/* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
 	post( this->idles.head->idle );
 
@@ -911,5 +912,11 @@
 static bool __wake_proc(processor * this) {
 	__cfadbg_print_safe(runtime_core, "Kernel : waking Processor %p\n", this);
-	return post( this->idle );
+
+	disable_interrupts();
+		/* paranoid */ verify( ! kernelTLS.preemption_state.enabled );
+		bool ret = post( this->idle );
+	enable_interrupts( __cfaabi_dbg_ctx );
+
+	return ret;
 }
 
Index: libcfa/src/exception.hfa
===================================================================
--- libcfa/src/exception.hfa	(revision 6c12fd28ccd5d0df5de4277788cba0edd4a3bc8c)
+++ libcfa/src/exception.hfa	(revision 6c12fd28ccd5d0df5de4277788cba0edd4a3bc8c)
@@ -0,0 +1,106 @@
+//
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+//
+// exception.hfa -- User facing tools for working with exceptions.
+//
+// Author           : Andrew Beach
+// Created On       : Thu Apr  7 10:25:00 2020
+// Last Modified By : Andrew Beach
+// Last Modified On : Thu Apr  7 10:25:00 2020
+// Update Count     : 0
+//
+
+// Everything below this line should be considered a patch while the exception
+// objects themselves are designed and  created and should be removed in time.
+// -----------------------------------------------------------------------------------------------
+
+// All internals helper macros begin with an underscore.
+#define _CLOSE(...) __VA_ARGS__ }
+#define _GLUE2(left, right) left##right
+#define _GLUE3(left, middle, right) left##middle##right
+#define _EXC_DISPATCH(to, ...) to(__VA_ARGS__,__cfaehm_base_exception_t,)
+
+// FWD_TRIVIAL_EXCEPTION(exception_name);
+// Declare a trivial exception, one that adds no fields or features.
+// This will make the exception visible and may go in a .hfa or .cfa file.
+#define FWD_TRIVIAL_EXCEPTION(...) _EXC_DISPATCH(_FWD_TRIVIAL_EXCEPTION, __VA_ARGS__)
+// INST_TRIVIAL_EXCEPTION(exception_name);
+// Create the trival exception. This must be used exactly once and should be used in a .cfa file,
+// as it creates the unique instance of the virtual table.
+#define INST_TRIVIAL_EXCEPTION(...) _EXC_DISPATCH(_INST_TRIVIAL_EXCEPTION, __VA_ARGS__)
+// TRIVIAL_EXCEPTION(exception_name[, parent_name]);
+// Does both of the above, a short hand if the exception is only used in one .cfa file.
+// For legacy reasons this is the only one that official supports having a parent other than the
+// base exception. This feature may be removed or changed.
+#define TRIVIAL_EXCEPTION(...) \
+	_EXC_DISPATCH(_FWD_TRIVIAL_EXCEPTION, __VA_ARGS__); \
+	_EXC_DISPATCH(_INST_TRIVIAL_EXCEPTION, __VA_ARGS__)
+#define _FWD_TRIVIAL_EXCEPTION(exception_name, parent_name, ...) \
+	_VTABLE_DECLARATION(exception_name, parent_name)(); \
+	struct exception_name { \
+		VTABLE_FIELD(exception_name); \
+	}; \
+	void ?{}(exception_name & this); \
+	const char * _GLUE2(exception_name,_msg)(exception_name * this)
+#define _INST_TRIVIAL_EXCEPTION(exception_name, parent_name, ...) \
+	void ?{}(exception_name & this) { \
+		VTABLE_INIT(this, exception_name); \
+	} \
+	const char * _GLUE2(exception_name,_msg)(exception_name * this) { \
+		return #exception_name; \
+	} \
+	_VTABLE_INSTANCE(exception_name, parent_name,)(_GLUE2(exception_name,_msg))
+
+// DATA_EXCEPTION(exception_name)(fields...);
+// Forward declare an exception that adds fields but no features. The added fields go in the
+// second argument list. The virtual table instance must be provided later (see VTABLE_INSTANCE).
+#define DATA_EXCEPTION(...) _EXC_DISPATCH(_DATA_EXCEPTION, __VA_ARGS__)
+#define _DATA_EXCEPTION(exception_name, parent_name, ...) \
+	_VTABLE_DECLARATION(exception_name, parent_name)(); \
+	struct exception_name { VTABLE_FIELD(exception_name); _CLOSE
+
+// VTABLE_DECLARATION(exception_name)([new_features...]);
+// Declare a virtual table type for an exception with exception_name. You may also add features
+// (fields on the virtual table) by including them in the second list.
+#define VTABLE_DECLARATION(...) _EXC_DISPATCH(_VTABLE_DECLARATION, __VA_ARGS__)
+#define _VTABLE_DECLARATION(exception_name, parent_name, ...) \
+	struct exception_name; \
+	VTABLE_TYPE(exception_name); \
+	extern VTABLE_TYPE(exception_name) VTABLE_NAME(exception_name); \
+	VTABLE_TYPE(exception_name) { \
+		VTABLE_TYPE(parent_name) const * parent; \
+		size_t size; \
+		void (*copy)(exception_name * this, exception_name * other); \
+		void (*free)(exception_name & this); \
+		const char * (*msg)(exception_name * this); \
+		_CLOSE
+
+// VTABLE_INSTANCE(exception_name)(msg [, others...]);
+// Create the instance of the virtual table. There must be exactly one instance of a virtual table
+// for each exception type. This fills in most of the fields of the virtual table (uses ?=? and
+// ^?{}) but you must provide the message function and any other fields added in the declaration.
+#define VTABLE_INSTANCE(...) _EXC_DISPATCH(_VTABLE_INSTANCE, __VA_ARGS__)
+#define _VTABLE_INSTANCE(exception_name, parent_name, ...) \
+	void _GLUE2(exception_name,_copy)(exception_name * this, exception_name * other) { \
+		*this = *other; \
+	} \
+	VTABLE_TYPE(exception_name) VTABLE_NAME(exception_name) @= { \
+		&VTABLE_NAME(parent_name), sizeof(exception_name), \
+		_GLUE2(exception_name,_copy), ^?{}, \
+		_CLOSE
+
+// VTABLE_TYPE(exception_name) | VTABLE_NAME(exception_name)
+// Get the name of the vtable type or the name of the vtable instance for an exception type.
+#define VTABLE_TYPE(exception_name) struct _GLUE2(exception_name,_vtable)
+#define VTABLE_NAME(exception_name) _GLUE3(_,exception_name,_vtable_instance)
+
+// VTABLE_FIELD(exception_name);
+// The declaration of the virtual table field. Should be the first declaration in a virtual type.
+#define VTABLE_FIELD(exception_name) VTABLE_TYPE(exception_name) const * virtual_table
+
+// VTABLE_INIT(object_reference, exception_name);
+// Sets a virtual table field on an object to the virtual table instance for the type.
+#define VTABLE_INIT(this, exception_name) (this).virtual_table = &VTABLE_NAME(exception_name)
Index: libcfa/src/heap.cfa
===================================================================
--- libcfa/src/heap.cfa	(revision dd4e2d7a1ba13c040f8d0eb5c9b0c672b5755c3a)
+++ libcfa/src/heap.cfa	(revision 6c12fd28ccd5d0df5de4277788cba0edd4a3bc8c)
@@ -10,6 +10,6 @@
 // Created On       : Tue Dec 19 21:58:35 2017
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sat Apr 18 17:43:15 2020
-// Update Count     : 718
+// Last Modified On : Wed May  6 17:29:26 2020
+// Update Count     : 727
 //
 
@@ -19,9 +19,9 @@
 #include <errno.h>										// errno
 #include <string.h>										// memset, memcpy
+#include <limits.h>										// ULONG_MAX
 extern "C" {
 #include <sys/mman.h>									// mmap, munmap
 } // extern "C"
 
-// #comment TD : Many of these should be merged into math I believe
 #include "bits/align.hfa"								// libPow2
 #include "bits/defs.hfa"								// likely, unlikely
@@ -30,4 +30,5 @@
 //#include "stdlib.hfa"									// bsearchl
 #include "malloc.h"
+#include "bitmanip.hfa"									// ceiling
 
 #define MIN(x, y) (y > x ? x : y)
@@ -81,11 +82,11 @@
 };
 
+size_t default_heap_expansion() __attribute__(( weak )) {
+	return __CFA_DEFAULT_HEAP_EXPANSION__;
+} // default_heap_expansion
+
 size_t default_mmap_start() __attribute__(( weak )) {
 	return __CFA_DEFAULT_MMAP_START__;
 } // default_mmap_start
-
-size_t default_heap_expansion() __attribute__(( weak )) {
-	return __CFA_DEFAULT_HEAP_EXPANSION__;
-} // default_heap_expansion
 
 
@@ -360,11 +361,4 @@
 
 
-static inline bool setHeapExpand( size_t value ) {
-  if ( heapExpand < pageSize ) return true;
-	heapExpand = value;
-	return false;
-} // setHeapExpand
-
-
 // thunk problem
 size_t Bsearchl( unsigned int key, const unsigned int * vals, size_t dim ) {
@@ -383,5 +377,5 @@
 
 static inline bool setMmapStart( size_t value ) {		// true => mmapped, false => sbrk
-  if ( value < pageSize || bucketSizes[NoBucketSizes - 1] < value ) return true;
+  if ( value < pageSize || bucketSizes[NoBucketSizes - 1] < value ) return false;
 	mmapStart = value;									// set global
 
@@ -390,5 +384,5 @@
 	assert( maxBucketsUsed < NoBucketSizes );			// subscript failure ?
 	assert( mmapStart <= bucketSizes[maxBucketsUsed] ); // search failure ?
-	return false;
+	return true;
 } // setMmapStart
 
@@ -449,5 +443,5 @@
 
 	#ifdef __CFA_DEBUG__
-	checkHeader( addr < heapBegin || header < (HeapManager.Storage.Header *)heapBegin, name, addr ); // bad low address ?
+	checkHeader( addr < heapBegin, name, addr );		// bad low address ?
 	#endif // __CFA_DEBUG__
 
@@ -508,5 +502,5 @@
 	// along with the block and is a multiple of the alignment size.
 
-  if ( unlikely( size > ~0ul - sizeof(HeapManager.Storage) ) ) return 0p;
+  if ( unlikely( size > ULONG_MAX - sizeof(HeapManager.Storage) ) ) return 0p;
 	size_t tsize = size + sizeof(HeapManager.Storage);
 	if ( likely( tsize < mmapStart ) ) {				// small size => sbrk
@@ -560,5 +554,5 @@
 		block->header.kind.real.home = freeElem;		// pointer back to free list of apropriate size
 	} else {											// large size => mmap
-  if ( unlikely( size > ~0ul - pageSize ) ) return 0p;
+  if ( unlikely( size > ULONG_MAX - pageSize ) ) return 0p;
 		tsize = libCeiling( tsize, pageSize );			// must be multiple of page size
 		#ifdef __STATISTICS__
@@ -702,5 +696,5 @@
 	#endif // FASTLOOKUP
 
-	if ( setMmapStart( default_mmap_start() ) ) {
+	if ( ! setMmapStart( default_mmap_start() ) ) {
 		abort( "HeapManager : internal error, mmap start initialization failure." );
 	} // if
@@ -708,6 +702,5 @@
 
 	char * end = (char *)sbrk( 0 );
-	sbrk( (char *)libCeiling( (long unsigned int)end, libAlign() ) - end ); // move start of heap to multiple of alignment
-	heapBegin = heapEnd = sbrk( 0 );					// get new start point
+	heapBegin = heapEnd = sbrk( (char *)libCeiling( (long unsigned int)end, libAlign() ) - end ); // move start of heap to multiple of alignment
 } // HeapManager
 
@@ -735,5 +728,5 @@
 	//assert( heapManager.heapBegin != 0 );
 	//heapManager{};
-	if ( heapManager.heapBegin == 0p ) heapManager{};
+	if ( heapManager.heapBegin == 0p ) heapManager{};	// sanity check
 } // memory_startup
 
@@ -863,15 +856,5 @@
 		#endif // __STATISTICS__
 
-		size_t size = dim * elemSize;
-		char * addr = (char *)mallocNoStats( size );
-	  if ( unlikely( addr == 0p ) ) return 0p;
-
-		HeapManager.Storage.Header * header;
-		HeapManager.FreeHeader * freeElem;
-		size_t bsize, alignment;
-		headers( "aalloc", addr, header, freeElem, bsize, alignment );
-
-		header->kind.real.blockSize |= 2;				// mark as zero filled
-		return addr;
+		return mallocNoStats( dim * elemSize );
 	} // aalloc
 
@@ -914,6 +897,6 @@
 	
 		// change size, DO NOT preserve STICKY PROPERTIES.
+		free( oaddr );
 		void * naddr = mallocNoStats( size );			// create new area
-		free( oaddr );
 		return naddr;
 	} // resize
@@ -988,14 +971,5 @@
 		#endif // __STATISTICS__
 
-		size_t size = dim * elemSize;
-		char * addr = (char *)memalignNoStats( alignment, size );
-	  if ( unlikely( addr == 0p ) ) return 0p;
-		HeapManager.Storage.Header * header;
-		HeapManager.FreeHeader * freeElem;
-		size_t bsize;
-		headers( "amemalign", addr, header, freeElem, bsize, alignment );
-
-		header->kind.real.blockSize |= 2;				// mark as zero filled
-		return addr;
+		return memalignNoStats( alignment, dim * elemSize );
 	} // amemalign
 
@@ -1043,5 +1017,5 @@
 
 	// Frees the memory space pointed to by ptr, which must have been returned by a previous call to malloc(), calloc()
-	// or realloc().  Otherwise, or if free(ptr) has already been called before, undefined behavior occurs. If ptr is
+	// or realloc().  Otherwise, or if free(ptr) has already been called before, undefined behaviour occurs. If ptr is
 	// 0p, no operation is performed.
 	void free( void * addr ) {
@@ -1170,12 +1144,13 @@
 
 
-	// Adjusts parameters that control the behavior of the memory-allocation functions (see malloc). The param argument
+	// Adjusts parameters that control the behaviour of the memory-allocation functions (see malloc). The param argument
 	// specifies the parameter to be modified, and value specifies the new value for that parameter.
 	int mallopt( int option, int value ) {
 		choose( option ) {
 		  case M_TOP_PAD:
-			if ( setHeapExpand( value ) ) return 1;
+			heapExpand = ceiling( value, pageSize ); return 1;
 		  case M_MMAP_THRESHOLD:
 			if ( setMmapStart( value ) ) return 1;
+			break;
 		} // switch
 		return 0;										// error, unsupported
Index: libcfa/src/iostream.cfa
===================================================================
--- libcfa/src/iostream.cfa	(revision dd4e2d7a1ba13c040f8d0eb5c9b0c672b5755c3a)
+++ libcfa/src/iostream.cfa	(revision 6c12fd28ccd5d0df5de4277788cba0edd4a3bc8c)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Apr 30 10:50:31 2020
-// Update Count     : 1001
+// Last Modified On : Sat May  2 18:30:25 2020
+// Update Count     : 1017
 //
 
@@ -583,27 +583,20 @@
 					if ( fmt.flags.pc && fmt.pc > 64 ) fmt.pc -= 64; else { fmt.flags.pc = false; fmt.pc = 0; } \
 					if ( fmt.flags.left ) { \
-						fmt2.wd = fmt.wd; \
-						if ( fmt2.wd <= 64 ) { \
-							fmt2.wd = 64; \
-						} else { \
-							if ( fmt.pc > 0 ) { \
-								fmt2.wd -= fmt.pc; \
-							} else { \
-								fmt2.wd = fmt.wd - high1( msig ); \
-							} /* if */ \
-							if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; \
-							if ( fmt2.wd < 0 ) fmt2.wd = 0; \
-							fmt2.flags.left = true; \
-							fmt.wd = 0; \
-						} /* if */ \
-						printf( "left %d %d %x\n", f.wd, f.pc, f.all ); \
-						printf( "left %d %d %x\n", fmt.wd, fmt.pc, fmt.all ); \
+						fmt.flags.left = false; \
+						fmt.wd = 0; \
+						/* printf( "L %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \
+						fmt2.flags.left = true;	\
+						int msigd = high1( msig ); \
+						fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd); \
+						if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; /* compensate for 0b base specifier */ \
+						if ( (int)fmt2.wd < 64 ) fmt2.wd = 64; /* cast deals with negative value */ \
+						fmt2.flags.pc = true; fmt2.pc = 64; \
 					} else { \
 						if ( fmt.wd > 64 ) fmt.wd -= 64; \
-						/* if ( ! fmt.flags.nobsdp && fmt.pc < fmt.wd ) fmt.wd -= 1; */ \
+						else fmt.wd = 1; \
+						/* printf( "R %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \
 						fmt2.wd = 64; \
-						/* printf( "R %llo %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt2.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \
 					} /* if */ \
-					/* printf( "\nC %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
+					/* printf( "C %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
 					(ostype &)(os | fmt | "" | fmt2); \
 				} else if ( f.base == 'o' ) { \
@@ -614,18 +607,16 @@
 						fmt.flags.left = false; \
 						fmt.wd = 0; \
-						/* if ( fmt2.val > 1 && fmt.flags.pc && fmt.pc > 0 ) fmt.pc -= 1; */ \
 						/* printf( "L %llo %llo %llo %d %d '%c' %x %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all, fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
 						(ostype &)(os | fmt | "" | fmt2); \
 						sepOff( os ); \
 						fmt2.flags.left = true;	\
-						int msigd = ceiling( high1( fmt.val ), 3 ) + 1; \
-						fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd) - 1; \
+						int msigd = ceiling( high1( fmt.val ), 3 ); \
+						fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd); \
+						if ( ! fmt.flags.nobsdp ) fmt2.wd -= 1; /* compensate for 0 base specifier */ \
 						if ( (int)fmt2.wd < 21 ) fmt2.wd = 21; /* cast deals with negative value */ \
 						fmt2.flags.pc = true; fmt2.pc = 21; \
 					} else { \
 						if ( fmt.wd > 22 ) fmt.wd -= 22; \
-						/* compensate for leading 0 */ \
-						/*if ( ! fmt.flags.nobsdp && fmt.pc < fmt.wd ) fmt.wd -= 1;*/ \
-						fmt2.wd = 1; \
+						else fmt.wd = 1; \
 						/* printf( "R %llo %llo %llo %d %d '%c' %x %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all, fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
 						(ostype &)(os | fmt | "" | fmt2); \
@@ -636,26 +627,23 @@
 					/* printf( "\nC %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
 					(ostype &)(os | fmt2); \
-				} else { \
-					if ( fmt.flags.pc && fmt.pc > 16 ) fmt.pc -= 16; \
+				} else { /* f.base == 'x'  | f.base == 'X' */ \
+					if ( fmt.flags.pc && fmt.pc > 16 ) fmt.pc -= 16; else { fmt.flags.pc = false; fmt.pc = 0; } \
 					if ( fmt.flags.left ) { \
-						fmt2.wd = fmt.wd; \
-						if ( fmt2.wd <= 16 ) { \
-							fmt2.wd = 16; \
-						} else { \
-							if ( fmt.pc > 0 ) { \
-								fmt2.wd -= fmt.pc; \
-							} else { \
-								fmt2.wd = fmt.wd - ceiling2( high1( msig ), 4 ) / 4; \
-							} /* if */ \
-							if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; \
-							if ( fmt2.wd < 0 ) fmt2.wd = 0; \
-							fmt2.flags.left = true; \
-							fmt.wd = 0; \
-						} /* if */ \
+						fmt.flags.left = false; \
+						fmt.wd = 0; \
+						/* printf( "L %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \
+						fmt2.flags.left = true;	\
+						int msigd = high1( msig ); \
+						fmt2.wd = f.wd - (fmt.pc > msigd ? fmt.pc : msigd); \
+						if ( ! fmt.flags.nobsdp ) fmt2.wd -= 2; /* compensate for 0x base specifier */ \
+						if ( (int)fmt2.wd < 16 ) fmt2.wd = 16; /* cast deals with negative value */ \
+						fmt2.flags.pc = true; fmt2.pc = 16; \
 					} else { \
+						if ( fmt.wd > 16 ) fmt.wd -= 16; \
+						else fmt.wd = 1; \
+						/* printf( "R %llo %llo %llo %d %d '%c' %x\n", msig, lsig, fmt.val, fmt.wd, fmt.pc, fmt.base, fmt.all ); */ \
 						fmt2.wd = 16; \
-						if ( fmt.wd > 16 ) fmt.wd -= 16; \
 					} /* if */ \
-					fmt2.pc = 16; fmt2.flags.pc = true; \
+					/* printf( "C %llo %d %d '%c' %x\n", fmt2.val, fmt2.wd, fmt2.pc, fmt2.base, fmt2.all ); */ \
 					(ostype &)(os | fmt | "" | fmt2); \
 				} /* if */ \
