Index: libcfa/src/Makefile.am
===================================================================
--- libcfa/src/Makefile.am	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ libcfa/src/Makefile.am	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -59,4 +59,5 @@
 	containers/array.hfa \
 	concurrency/iofwd.hfa \
+	concurrency/mutex_stmt.hfa \
 	containers/list.hfa \
 	containers/queueLockFree.hfa \
Index: libcfa/src/concurrency/monitor.cfa
===================================================================
--- libcfa/src/concurrency/monitor.cfa	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ libcfa/src/concurrency/monitor.cfa	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -990,4 +990,62 @@
 }
 
+//-----------------------------------------------------------------------------
+// Enter routine for mutex stmt
+// Can't be accepted since a mutex stmt is effectively an anonymous routine
+// Thus we do not need a monitor group
+void lock( monitor$ * this ) {
+	thread$ * thrd = active_thread();
+
+	// Lock the monitor spinlock
+	lock( this->lock __cfaabi_dbg_ctx2 );
+
+	__cfaabi_dbg_print_safe( "Kernel : %10p Entering mon %p (%p)\n", thrd, this, this->owner);
+
+	if( unlikely(0 != (0x1 & (uintptr_t)this->owner)) ) {
+		abort( "Attempt by thread \"%.256s\" (%p) to access joined monitor %p.", thrd->self_cor.name, thrd, this );
+	}
+	else if( !this->owner ) {
+		// No one has the monitor, just take it
+		__set_owner( this, thrd );
+
+		__cfaabi_dbg_print_safe( "Kernel :  mon is free \n" );
+	}
+	else if( this->owner == thrd) {
+		// We already have the monitor, just note how many times we took it
+		this->recursion += 1;
+
+		__cfaabi_dbg_print_safe( "Kernel :  mon already owned \n" );
+	}
+	else {
+		__cfaabi_dbg_print_safe( "Kernel :  blocking \n" );
+
+		// Some one else has the monitor, wait in line for it
+		/* paranoid */ verify( thrd->link.next == 0p );
+		append( this->entry_queue, thrd );
+		/* paranoid */ verify( thrd->link.next == 1p );
+
+		unlock( this->lock );
+		park();
+
+		__cfaabi_dbg_print_safe( "Kernel : %10p Entered  mon %p\n", thrd, this);
+
+		/* paranoid */ verifyf( active_thread() == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", active_thread(), this->owner, this->recursion, this );
+		return;
+	}
+
+	__cfaabi_dbg_print_safe( "Kernel : %10p Entered  mon %p\n", thrd, this);
+
+	/* paranoid */ verifyf( active_thread() == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", active_thread(), this->owner, this->recursion, this );
+	/* paranoid */ verify( this->lock.lock );
+
+	// Release the lock and leave
+	unlock( this->lock );
+	return;
+}
+
+// Leave routine for mutex stmt
+// Is just a wrapper around __leave for the is_lock trait to see
+void unlock( monitor$ * this ) { __leave( this ); }
+
 // Local Variables: //
 // mode: c //
Index: libcfa/src/concurrency/monitor.hfa
===================================================================
--- libcfa/src/concurrency/monitor.hfa	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ libcfa/src/concurrency/monitor.hfa	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -149,4 +149,8 @@
 void __waitfor_internal( const __waitfor_mask_t & mask, int duration );
 
+// lock and unlock routines for mutex statements to use
+void lock( monitor$ * this );
+void unlock( monitor$ * this );
+
 // Local Variables: //
 // mode: c //
Index: libcfa/src/concurrency/mutex_stmt.hfa
===================================================================
--- libcfa/src/concurrency/mutex_stmt.hfa	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
+++ libcfa/src/concurrency/mutex_stmt.hfa	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -0,0 +1,46 @@
+#include "bits/algorithm.hfa"
+#include <assert.h>
+#include "invoke.h"
+#include "stdlib.hfa"
+#include <stdio.h>
+
+//-----------------------------------------------------------------------------
+// is_lock
+trait is_lock(L & | sized(L)) {
+	// For acquiring a lock
+	void lock( L & );
+
+	// For releasing a lock
+	void unlock( L & );
+};
+
+forall(L & | is_lock(L)) {
+
+    struct __mutex_stmt_lock_guard {
+        L ** lockarr;
+        __lock_size_t count;
+    };
+    
+    static inline void ?{}( __mutex_stmt_lock_guard(L) & this, L * lockarr [], __lock_size_t count  ) {
+        this.lockarr = lockarr;
+        this.count = count;
+
+        // Sort locks based on address
+        __libcfa_small_sort(this.lockarr, count);
+
+        // acquire locks in order
+        for ( size_t i = 0; i < count; i++ ) {
+            lock(*this.lockarr[i]);
+        }
+    }
+    
+    static inline void ^?{}( __mutex_stmt_lock_guard(L) & this ) with(this) {
+        for ( size_t i = count; i > 0; i-- ) {
+            unlock(*lockarr[i - 1]);
+        }
+    }
+
+    static inline L * __get_pointer( L & lock ) {
+        return &lock;
+    }
+}
Index: src/Concurrency/Keywords.cc
===================================================================
--- src/Concurrency/Keywords.cc	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ src/Concurrency/Keywords.cc	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -93,4 +93,5 @@
 		ObjectDecl * addField( StructDecl * );
 		void addRoutines( ObjectDecl *, FunctionDecl * );
+		void addLockUnlockRoutines( StructDecl * );
 
 		virtual bool is_target( StructDecl * decl ) = 0;
@@ -322,4 +323,5 @@
 		StructDecl* dtor_guard_decl = nullptr;
 		StructDecl* thread_guard_decl = nullptr;
+		StructDecl* lock_guard_decl = nullptr;
 
 		static std::unique_ptr< Type > generic_func;
@@ -463,5 +465,4 @@
 	}
 
-
 	void ConcurrentSueKeyword::handle( StructDecl * decl ) {
 		if( ! decl->body ) return;
@@ -479,5 +480,9 @@
 		FunctionDecl * func = forwardDeclare( decl );
 		ObjectDecl * field = addField( decl );
+
+		// add get_.* routine
 		addRoutines( field, func );
+		// add lock/unlock routines to monitors for use by mutex stmt
+		addLockUnlockRoutines( decl );
 	}
 
@@ -612,4 +617,6 @@
 	}
 
+	// This function adds the get_.* routine body for coroutines, monitors etc
+	// 		after their corresponding struct has been made
 	void ConcurrentSueKeyword::addRoutines( ObjectDecl * field, FunctionDecl * func ) {
 		CompoundStmt * statement = new CompoundStmt();
@@ -634,4 +641,112 @@
 
 		declsToAddAfter.push_back( get_decl );
+	}
+
+	// Generates lock/unlock routines for monitors to be used by mutex stmts
+	void ConcurrentSueKeyword::addLockUnlockRoutines( StructDecl * decl ) {
+		// this routine will be called for all ConcurrentSueKeyword children so only continue if we are a monitor
+		if ( !decl->is_monitor() ) return;
+
+		FunctionType * lock_fn_type = new FunctionType( noQualifiers, false );
+		FunctionType * unlock_fn_type = new FunctionType( noQualifiers, false );
+
+		// create this ptr parameter for both routines
+		ObjectDecl * this_decl = new ObjectDecl(
+			"this",
+			noStorageClasses,
+			LinkageSpec::Cforall,
+			nullptr,
+			new ReferenceType(
+				noQualifiers,
+				new StructInstType(
+					noQualifiers,
+					decl
+				)
+			),
+			nullptr
+		);
+
+		lock_fn_type->get_parameters().push_back( this_decl->clone() );
+		unlock_fn_type->get_parameters().push_back( this_decl->clone() );
+		fixupGenerics(lock_fn_type, decl);
+		fixupGenerics(unlock_fn_type, decl);
+
+		delete this_decl;
+
+
+		//////////////////////////////////////////////////////////////////////
+		// The following generates this lock routine for all monitors
+		/*
+			void lock (monitor_t & this) {
+				lock(get_monitor(this));
+			}	
+		*/
+		FunctionDecl * lock_decl = new FunctionDecl(
+			"lock",
+			Type::Static,
+			LinkageSpec::Cforall,
+			lock_fn_type,
+			nullptr,
+			{ },
+			Type::Inline
+		);
+
+		UntypedExpr * get_monitor_lock =  new UntypedExpr (
+			new NameExpr( "get_monitor" ),
+			{ new VariableExpr( lock_fn_type->get_parameters().front() ) }
+		);
+
+		CompoundStmt * lock_statement = new CompoundStmt();
+		lock_statement->push_back(
+			new ExprStmt( 
+				new UntypedExpr (
+					new NameExpr( "lock" ),
+					{
+						get_monitor_lock
+					}
+				)
+			)
+		);
+		lock_decl->set_statements( lock_statement );
+
+		//////////////////////////////////////////////////////////////////
+		// The following generates this routine for all monitors
+		/*
+			void unlock (monitor_t & this) {
+				unlock(get_monitor(this));
+			}	
+		*/
+		FunctionDecl * unlock_decl = new FunctionDecl(
+			"unlock",
+			Type::Static,
+			LinkageSpec::Cforall,
+			unlock_fn_type,
+			nullptr,
+			{ },
+			Type::Inline
+		);
+
+		CompoundStmt * unlock_statement = new CompoundStmt();
+
+		UntypedExpr * get_monitor_unlock =  new UntypedExpr (
+			new NameExpr( "get_monitor" ),
+			{ new VariableExpr( unlock_fn_type->get_parameters().front() ) }
+		);
+
+		unlock_statement->push_back(
+			new ExprStmt( 
+				new UntypedExpr(
+					new NameExpr( "unlock" ),
+					{
+						get_monitor_unlock
+					}
+				)
+			)
+		);
+		unlock_decl->set_statements( unlock_statement );
+		
+		// pushes routines to declsToAddAfter to add at a later time
+		declsToAddAfter.push_back( lock_decl );
+		declsToAddAfter.push_back( unlock_decl );
 	}
 
@@ -937,4 +1052,8 @@
 			assert( !thread_guard_decl );
 			thread_guard_decl = decl;
+		} 
+		else if ( decl->name == "__mutex_stmt_lock_guard" && decl->body ) {
+			assert( !lock_guard_decl );
+			lock_guard_decl = decl;
 		}
 	}
@@ -1081,8 +1200,5 @@
 				new PointerType(
 					noQualifiers,
-					new StructInstType(
-						noQualifiers,
-						monitor_decl
-					)
+					new TypeofType( noQualifiers, args.front()->clone() )
 				),
 				new ConstantExpr( Constant::from_ulong( args.size() ) ),
@@ -1093,5 +1209,5 @@
 				map_range < std::list<Initializer*> > ( args, [](Expression * var ){
 					return new SingleInit( new UntypedExpr(
-						new NameExpr( "get_monitor" ),
+						new NameExpr( "__get_pointer" ),
 						{ var }
 					) );
@@ -1099,4 +1215,9 @@
 			)
 		);
+
+		StructInstType * lock_guard_struct = new StructInstType( noQualifiers, lock_guard_decl );
+		TypeExpr * lock_type_expr = new TypeExpr( new TypeofType( noQualifiers, args.front()->clone() ) );
+
+		lock_guard_struct->parameters.push_back( lock_type_expr ) ;
 
 		// in reverse order :
@@ -1108,8 +1229,5 @@
 				LinkageSpec::Cforall,
 				nullptr,
-				new StructInstType(
-					noQualifiers,
-					guard_decl
-				),
+				lock_guard_struct,
 				new ListInit(
 					{
Index: src/MakeLibCfa.h
===================================================================
--- src/MakeLibCfa.h	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ src/MakeLibCfa.h	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -19,7 +19,11 @@
 
 class Declaration;
+namespace ast {
+	struct TranslationUnit;
+}
 
 namespace LibCfa {
 	void makeLibCfa( std::list< Declaration* > &prelude );
+	void makeLibCfa( ast::TranslationUnit & translationUnit );
 } // namespace LibCfa
 
Index: src/MakeLibCfaNew.cpp
===================================================================
--- src/MakeLibCfaNew.cpp	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
+++ src/MakeLibCfaNew.cpp	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -0,0 +1,146 @@
+//
+// 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.
+//
+// MakeLibCfaNew.cpp --
+//
+// Author           : Henry Xue
+// Created On       : Fri Aug 27 15:50:14 2021
+// Last Modified By : Henry Xue
+// Last Modified On : Fri Aug 27 15:50:14 2021
+// Update Count     : 1
+//
+
+#include "MakeLibCfa.h"
+
+#include "AST/Fwd.hpp"
+#include "AST/Pass.hpp"
+#include "CodeGen/OperatorTable.h"
+#include "Common/UniqueName.h"
+
+namespace LibCfa {
+namespace {
+	struct MakeLibCfa {
+		const ast::DeclWithType * postvisit( const ast::FunctionDecl * funcDecl );
+		std::list< ast::ptr< ast::Decl > > newDecls;
+	};
+}
+
+void makeLibCfa( ast::TranslationUnit & prelude ) {
+	ast::Pass< MakeLibCfa > maker;
+	accept_all( prelude, maker );
+	prelude.decls.splice( prelude.decls.end(), maker.core.newDecls );
+}
+
+namespace {
+	struct TypeFinder {
+		void postvisit( const ast::TypeInstType * inst ) {
+			// if a type variable is seen, assume all zero_t/one_t in the parameter list
+			//  can be replaced with the equivalent 'general' pointer.
+			if ( type ) return;
+			if ( inst->kind == ast::TypeDecl::Ftype ) {
+				type = new ast::PointerType( new ast::FunctionType() );
+			} else {
+				type = new ast::PointerType( new ast::VoidType() );
+			}
+		}
+		ast::ptr< ast::Type > type;
+	};
+
+	struct ZeroOneReplacer {
+		ZeroOneReplacer( const ast::Type * t ) : type( t ) {}
+		ast::ptr< ast::Type > type;
+
+		const ast::Type * common( const ast::Type * t ) {
+			if ( ! type ) return t;
+			return type;
+		}
+
+		const ast::Type * postvisit( const ast::OneType * t ) { return common( t ); }
+		const ast::Type * postvisit( const ast::ZeroType * t ) { return common( t ); }
+	};
+
+	// const ast::Type * fixZeroOneType( ast::FunctionDecl * origFuncDecl ) {
+	// 	// find appropriate type to replace zero_t/one_t with
+	// 	ast::Pass< TypeFinder > finder;
+	// 	origFuncDecl->type->accept( finder );
+	// 	// replace zero_t/one_t in function type
+	// 	ast::Pass< ZeroOneReplacer > replacer( finder.core.type );
+	// 	//auto funcDecl = mutate( origFuncDecl );
+	// 	return origFuncDecl->type->accept( replacer );
+	// }
+
+	const ast::DeclWithType * MakeLibCfa::postvisit( const ast::FunctionDecl * origFuncDecl ) {
+		// don't change non-intrinsic functions
+		if ( origFuncDecl->linkage != ast::Linkage::Intrinsic ) return origFuncDecl;
+		// replace zero_t/one_t with void */void (*)(void)
+		auto mutDecl = mutate( origFuncDecl );
+		//mutDecl->type = fixZeroOneType( mutDecl );
+
+		// find appropriate type to replace zero_t/one_t with
+		ast::Pass< TypeFinder > finder;
+		mutDecl->type->accept( finder );
+		// replace zero_t/one_t in function type
+		ast::Pass< ZeroOneReplacer > replacer( finder.core.type );
+		mutDecl->type = mutDecl->type->accept( replacer );
+
+		// skip functions already defined
+		if ( mutDecl->has_body() ) return mutDecl;
+
+		const CodeLocation loc = mutDecl->location;
+		auto funcDecl = dynamic_cast<ast::FunctionDecl *>(ast::deepCopy( (ast::DeclWithType*)mutDecl ));
+		const CodeGen::OperatorInfo * opInfo;
+		opInfo = CodeGen::operatorLookup( funcDecl->name );
+		assert( opInfo );
+		assert( ! funcDecl->has_body() );
+		// build a recursive call - this is okay, as the call will actually be codegen'd using operator syntax
+		auto newExpr = new ast::UntypedExpr( loc, new ast::NameExpr( loc, funcDecl->name ) );
+		UniqueName paramNamer( "_p" );
+		auto param = funcDecl->params.begin();
+		assert( param != funcDecl->params.end() );
+
+		for ( ; param != funcDecl->params.end(); ++param ) {
+			// name each unnamed parameter
+			if ( (*param)->name == "" ) {
+				auto _param = param->get_and_mutate();
+				_param->name = paramNamer.newName() ;
+				_param->linkage = ast::Linkage::C;
+			}
+			// add parameter to the expression
+			newExpr->args.push_back( new ast::VariableExpr( loc, *param ) );
+		} // for
+
+		auto stmts = new ast::CompoundStmt( loc );;
+		newDecls.push_back( funcDecl );
+
+		ast::ptr< ast::Stmt > stmt;
+		switch ( opInfo->type ) {
+			case CodeGen::OT_INDEX:
+			case CodeGen::OT_CALL:
+			case CodeGen::OT_PREFIX:
+			case CodeGen::OT_POSTFIX:
+			case CodeGen::OT_INFIX:
+			case CodeGen::OT_PREFIXASSIGN:
+			case CodeGen::OT_POSTFIXASSIGN:
+			case CodeGen::OT_INFIXASSIGN:
+				// return the recursive call
+				stmt = new ast::ReturnStmt( loc, newExpr );
+				break;
+			case CodeGen::OT_CTOR:
+			case CodeGen::OT_DTOR:
+				// execute the recursive call
+				stmt = new ast::ExprStmt( loc, newExpr );
+				break;
+			case CodeGen::OT_CONSTANT:
+			case CodeGen::OT_LABELADDRESS:
+			// there are no intrinsic definitions of 0/1 or label addresses as functions
+			assert( false );
+		} // switch
+		stmts->push_back( stmt );
+		funcDecl->stmts = stmts;
+		return mutDecl;
+	}
+} // namespace
+} // namespace LibCfa
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ src/Makefile.am	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -23,4 +23,5 @@
       CompilationState.h \
       MakeLibCfa.cc \
+	  MakeLibCfaNew.cpp \
 	MakeLibCfa.h
 
Index: src/Tuples/TupleExpansionNew.cpp
===================================================================
--- src/Tuples/TupleExpansionNew.cpp	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
+++ src/Tuples/TupleExpansionNew.cpp	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -0,0 +1,68 @@
+//
+// 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.
+//
+// TupleExpansionNew.cpp --
+//
+// Author           : Henry Xue
+// Created On       : Mon Aug 23 15:36:09 2021
+// Last Modified By : Henry Xue
+// Last Modified On : Mon Aug 23 15:36:09 2021
+// Update Count     : 1
+//
+
+#include "Tuples.h"
+
+namespace Tuples {
+namespace {
+	struct MemberTupleExpander final : public ast::WithShortCircuiting, public ast::WithVisitorRef< MemberTupleExpander > {
+		void previsit( const ast::UntypedMemberExpr * ) { visit_children = false; }
+        const ast::Expr * postvisit( const ast::UntypedMemberExpr * memberExpr );
+	};
+} // namespace
+
+void expandMemberTuples( ast::TranslationUnit & translationUnit ) {
+	ast::Pass< MemberTupleExpander >::run( translationUnit );
+}
+
+namespace {
+	namespace {
+		/// given a expression representing the member and an expression representing the aggregate,
+		/// reconstructs a flattened UntypedMemberExpr with the right precedence
+		const ast::Expr * reconstructMemberExpr( const ast::Expr * member, const ast::Expr * aggr, const CodeLocation & loc ) {
+			if ( auto memberExpr = dynamic_cast< const ast::UntypedMemberExpr * >( member ) ) {
+				// construct a new UntypedMemberExpr with the correct structure , and recursively
+				// expand that member expression.
+				ast::Pass< MemberTupleExpander > expander;
+				auto inner = new ast::UntypedMemberExpr( loc, memberExpr->aggregate, aggr );
+				auto newMemberExpr = new ast::UntypedMemberExpr( loc, memberExpr->member, inner );
+				//delete memberExpr;
+				return newMemberExpr->accept( expander );
+			} else {
+				// not a member expression, so there is nothing to do but attach and return
+				return new ast::UntypedMemberExpr( loc, member, aggr );
+			}
+		}
+	}
+
+	const ast::Expr * MemberTupleExpander::postvisit( const ast::UntypedMemberExpr * memberExpr ) {
+		const CodeLocation loc = memberExpr->location;
+        if ( auto tupleExpr = memberExpr->member.as< ast::UntypedTupleExpr >() ) {
+			auto mutExpr = mutate( tupleExpr );
+			ast::ptr< ast::Expr > aggr = memberExpr->aggregate->accept( *visitor );
+			// aggregate expressions which might be impure must be wrapped in unique expressions
+			if ( Tuples::maybeImpureIgnoreUnique( memberExpr->aggregate ) ) aggr = new ast::UniqueExpr( loc, aggr );
+			for ( auto & expr : mutExpr->exprs ) {
+				expr = reconstructMemberExpr( expr, aggr, loc );
+			}
+			//delete aggr;
+			return mutExpr;
+		} else {
+			// there may be a tuple expr buried in the aggregate
+			return new ast::UntypedMemberExpr( loc, memberExpr->member, memberExpr->aggregate->accept( *visitor ) );
+		}
+	}
+} // namespace
+} // namespace Tuples
Index: src/Tuples/Tuples.h
===================================================================
--- src/Tuples/Tuples.h	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ src/Tuples/Tuples.h	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -9,7 +9,7 @@
 // Author           : Rodolfo G. Esteves
 // Created On       : Mon May 18 07:44:20 2015
-// Last Modified By : Andrew Beach
-// Last Modified On : Tue Jun 18 09:36:00 2019
-// Update Count     : 18
+// Last Modified By : Henry Xue
+// Last Modified On : Mon Aug 23 15:36:09 2021
+// Update Count     : 19
 //
 
@@ -39,4 +39,5 @@
 	/// expands z.[a, b.[x, y], c] into [z.a, z.b.x, z.b.y, z.c], inserting UniqueExprs as appropriate
 	void expandMemberTuples( std::list< Declaration * > & translationUnit );
+	void expandMemberTuples( ast::TranslationUnit & translationUnit );
 
 	/// replaces tuple-related elements, such as TupleType, TupleExpr, TupleAssignExpr, etc.
Index: src/Tuples/module.mk
===================================================================
--- src/Tuples/module.mk	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ src/Tuples/module.mk	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -10,7 +10,7 @@
 ## Author           : Richard C. Bilson
 ## Created On       : Mon Jun  1 17:49:17 2015
-## Last Modified By : Peter A. Buhr
-## Last Modified On : Mon Jun  1 17:54:33 2015
-## Update Count     : 1
+## Last Modified By : Henry Xue
+## Last Modified On : Mon Aug 23 15:36:09 2021
+## Update Count     : 2
 ###############################################################################
 
@@ -20,4 +20,5 @@
 	Tuples/TupleAssignment.cc \
 	Tuples/TupleExpansion.cc \
+	Tuples/TupleExpansionNew.cpp \
 	Tuples/Tuples.cc \
 	Tuples/Tuples.h
Index: src/main.cc
===================================================================
--- src/main.cc	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ src/main.cc	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -10,6 +10,6 @@
 // Created On       : Fri May 15 23:12:02 2015
 // Last Modified By : Henry Xue
-// Last Modified On : Tue Jul 20 04:27:35 2021
-// Update Count     : 658
+// Last Modified On : Mon Aug 23 15:42:08 2021
+// Update Count     : 650
 //
 
@@ -335,5 +335,5 @@
 		PASS( "Fix Names", CodeGen::fixNames( translationUnit ) );
 		PASS( "Gen Init", InitTweak::genInit( translationUnit ) );
-		PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );
+
 		if ( libcfap ) {
 			// generate the bodies of cfa library functions
@@ -365,4 +365,7 @@
 			}
 			auto transUnit = convert( move( translationUnit ) );
+
+			PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( transUnit ) );
+			
 			PASS( "Resolve", ResolvExpr::resolve( transUnit ) );
 			if ( exprp ) {
@@ -376,4 +379,6 @@
 			translationUnit = convert( move( transUnit ) );
 		} else {
+			PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );
+
 			PASS( "Resolve", ResolvExpr::resolve( translationUnit ) );
 			if ( exprp ) {
Index: tests/Makefile.am
===================================================================
--- tests/Makefile.am	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ tests/Makefile.am	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -82,6 +82,5 @@
 	concurrent/clib_tls.c \
 	exceptions/with-threads.hfa \
-	exceptions/except-io.hfa \
-	unified_locking/mutex_test.hfa
+	exceptions/except-io.hfa
 
 dist-hook:
Index: tests/concurrent/mutexstmt/.expect/locks.txt
===================================================================
--- tests/concurrent/mutexstmt/.expect/locks.txt	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
+++ tests/concurrent/mutexstmt/.expect/locks.txt	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -0,0 +1,4 @@
+Start Test: single lock mutual exclusion
+End Test: single lock mutual exclusion
+Start Test: multi lock deadlock/mutual exclusion
+End Test: multi lock deadlock/mutual exclusion
Index: tests/concurrent/mutexstmt/locks.cfa
===================================================================
--- tests/concurrent/mutexstmt/locks.cfa	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ tests/concurrent/mutexstmt/locks.cfa	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -1,3 +1,3 @@
-#include <mutex_stmt_locks.hfa>
+#include <mutex_stmt.hfa>
 #include <locks.hfa>
 
@@ -13,5 +13,5 @@
 	for (unsigned int i = 0; i < num_times; i++) {
 		mutex ( m1 ) count++;
-		mutex ( m1 ) {
+		mutex ( m1 ) { 
 			assert(!insideFlag);
 			insideFlag = true;
@@ -65,5 +65,5 @@
 	printf("Start Test: single lock mutual exclusion\n");
 	{
-		T_Mutex t[10];
+		T_Mutex t[1];
 	}
 	printf("End Test: single lock mutual exclusion\n");
Index: tests/concurrent/mutexstmt/monitors.cfa
===================================================================
--- tests/concurrent/mutexstmt/monitors.cfa	(revision cfbab079bede7e2b9a9c69c159d6182db091eff9)
+++ tests/concurrent/mutexstmt/monitors.cfa	(revision eaeca5f23e76ee6a6e339574fa4dcb93d881eef0)
@@ -1,3 +1,4 @@
 #include <monitor.hfa>
+#include <mutex_stmt.hfa>
 #include <stdio.h>
 #include <stdlib.hfa>
@@ -13,4 +14,5 @@
 bool insideFlag = false;
 int count = 0;
+bool startFlag = false;
 
 void main( T_Mutex & this ) {
