Changes in / [9b443c7f:5a3ac84]
- Files:
-
- 4 added
- 4 deleted
- 43 edited
-
Jenkins/FullBuild (modified) (3 diffs)
-
Jenkinsfile (modified) (6 diffs)
-
doc/proposals/concurrency/thePlan.md (modified) (1 diff)
-
src/CodeGen/CodeGenerator.cc (modified) (2 diffs)
-
src/Common/utility.h (modified) (1 diff)
-
src/Concurrency/Keywords.cc (modified) (1 diff)
-
src/Concurrency/Keywords.h (modified) (1 diff)
-
src/GenPoly/Box.cc (modified) (2 diffs)
-
src/InitTweak/FixGlobalInit.cc (modified) (3 diffs)
-
src/InitTweak/FixInit.cc (modified) (6 diffs)
-
src/InitTweak/GenInit.cc (modified) (2 diffs)
-
src/InitTweak/InitTweak.cc (modified) (1 diff)
-
src/Parser/DeclarationNode.cc (modified) (18 diffs)
-
src/Parser/ParseNode.h (modified) (5 diffs)
-
src/Parser/TypeData.cc (modified) (5 diffs)
-
src/Parser/TypeData.h (modified) (2 diffs)
-
src/SymTab/Autogen.cc (modified) (3 diffs)
-
src/SymTab/Autogen.h (modified) (1 diff)
-
src/SymTab/Indexer.cc (modified) (2 diffs)
-
src/SymTab/Validate.cc (modified) (1 diff)
-
src/SynTree/Type.h (modified) (5 diffs)
-
src/Tuples/TupleAssignment.cc (modified) (1 diff)
-
src/Tuples/TupleExpansion.cc (modified) (1 diff)
-
src/benchmark/CorCtxSwitch.c (modified) (2 diffs)
-
src/benchmark/ThrdCtxSwitch.c (modified) (1 diff)
-
src/benchmark/bench.c (modified) (5 diffs)
-
src/benchmark/csv-data.c (modified) (2 diffs)
-
src/examples/multicore.c (modified) (1 diff)
-
src/libcfa/Makefile.am (modified) (1 diff)
-
src/libcfa/Makefile.in (modified) (10 diffs)
-
src/libcfa/concurrency/coroutine (deleted)
-
src/libcfa/concurrency/coroutine.c (deleted)
-
src/libcfa/concurrency/coroutines (added)
-
src/libcfa/concurrency/coroutines.c (added)
-
src/libcfa/concurrency/invoke.c (modified) (3 diffs)
-
src/libcfa/concurrency/invoke.h (modified) (3 diffs)
-
src/libcfa/concurrency/kernel (modified) (3 diffs)
-
src/libcfa/concurrency/kernel.c (modified) (13 diffs)
-
src/libcfa/concurrency/kernel_private.h (modified) (5 diffs)
-
src/libcfa/concurrency/monitor (modified) (3 diffs)
-
src/libcfa/concurrency/monitor.c (modified) (6 diffs)
-
src/libcfa/concurrency/thread (deleted)
-
src/libcfa/concurrency/thread.c (deleted)
-
src/libcfa/concurrency/threads (added)
-
src/libcfa/concurrency/threads.c (added)
-
src/main.cc (modified) (2 diffs)
-
src/tests/coroutine.c (modified) (3 diffs)
-
src/tests/monitor.c (modified) (3 diffs)
-
src/tests/multi-monitor.c (modified) (2 diffs)
-
src/tests/test.py (modified) (1 diff)
-
src/tests/thread.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Jenkins/FullBuild
r9b443c7f r5a3ac84 20 20 21 21 parallel ( 22 gcc_6_x64: { trigger_build( 'gcc-6', 'x64' , true) },23 gcc_6_x86: { trigger_build( 'gcc-6', 'x86' , true) },24 gcc_5_x64: { trigger_build( 'gcc-5', 'x64' , false) },25 gcc_5_x86: { trigger_build( 'gcc-5', 'x86' , false) },26 gcc_4_x64: { trigger_build( 'gcc-4.9', 'x64' , false) },27 gcc_4_x86: { trigger_build( 'gcc-4.9', 'x86' , false) },28 clang_x64: { trigger_build( 'clang', 'x64' , false) },29 clang_x86: { trigger_build( 'clang', 'x86' , false) },22 gcc_6_x64: { trigger_build( 'gcc-6', 'x64' ) }, 23 gcc_6_x86: { trigger_build( 'gcc-6', 'x86' ) }, 24 gcc_5_x64: { trigger_build( 'gcc-5', 'x64' ) }, 25 gcc_5_x86: { trigger_build( 'gcc-5', 'x86' ) }, 26 gcc_4_x64: { trigger_build( 'gcc-4.9', 'x64' ) }, 27 gcc_4_x86: { trigger_build( 'gcc-4.9', 'x86' ) }, 28 clang_x64: { trigger_build( 'clang', 'x64' ) }, 29 clang_x86: { trigger_build( 'clang', 'x86' ) }, 30 30 ) 31 31 … … 62 62 //=========================================================================================================== 63 63 64 def trigger_build(String cc, String arch , Boolean publish) {64 def trigger_build(String cc, String arch) { 65 65 def result = build job: 'Cforall/master', \ 66 66 parameters: [ \ … … 82 82 [$class: 'BooleanParameterValue', \ 83 83 name: 'pPublish', \ 84 value: publish], \84 value: true], \ 85 85 [$class: 'BooleanParameterValue', \ 86 86 name: 'pSilent', \ -
Jenkinsfile
r9b443c7f r5a3ac84 13 13 14 14 compiler = null 15 arch_name = ''16 15 architecture = '' 17 16 … … 131 130 [$class: 'BooleanParameterDefinition', \ 132 131 description: 'If true, jenkins also builds documentation', \ 133 name: 'pBuildDocumentation', \132 name: 'pBuildDocumentation', \ 134 133 defaultValue: true, \ 135 134 ], \ … … 137 136 description: 'If true, jenkins also publishes results', \ 138 137 name: 'pPublish', \ 139 defaultValue: false, \138 defaultValue: true, \ 140 139 ], \ 141 140 [$class: 'BooleanParameterDefinition', \ 142 141 description: 'If true, jenkins will not send emails', \ 143 name: 'pSilent', \142 name: 'pSilent', \ 144 143 defaultValue: false, \ 145 144 ], \ … … 148 147 149 148 compiler = compiler_from_params( pCompiler ) 150 arch_name = pArchitecture 151 architecture = architecture_from_params( arch_name ) 149 architecture = architecture_from_params( pArchitecture ) 152 150 153 151 do_alltests = (pRunAllTests == 'true') … … 158 156 159 157 echo """Compiler : ${compiler.cc_name} (${compiler.cpp_cc}/${compiler.cfa_cc}) 160 Architecture : ${arch_name} 161 Arc Flags : ${architecture} 158 Architecture : ${architecture} 162 159 Run All Tests : ${ pRunAllTests.toString() } 163 160 Run Benchmark : ${ pRunBenchmark.toString() } … … 290 287 291 288 //Write the commit id to Benchmark 292 writeFile file: 'bench.csv', text:'data=' + gitRefNewValue + ',' + arch_name + ','289 writeFile file: 'bench.csv', text:'data=' + gitRefNewValue + ',' 293 290 294 291 //Append bench results -
doc/proposals/concurrency/thePlan.md
r9b443c7f r5a3ac84 7 7 8 8 _Phase 2_ : Minimum Viable Product 9 done -Monitor type and enter/leave mutex member routines9 Monitor type and enter/leave mutex member routines 10 10 Monitors as a language feature (not calling enter/leave by hand) 11 11 Internal scheduling -
src/CodeGen/CodeGenerator.cc
r9b443c7f r5a3ac84 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 13 23:56:59201713 // Update Count : 47 712 // Last Modified On : Sun Mar 5 17:13:33 2017 13 // Update Count : 475 14 14 // 15 15 … … 895 895 896 896 void CodeGenerator::handleStorageClass( DeclarationWithType * decl ) { 897 if ( decl->get_storageClasses(). val != 0) {897 if ( decl->get_storageClasses().any() ) { 898 898 DeclarationNode::print_StorageClass( output, decl->get_storageClasses() ); 899 899 } // if -
src/Common/utility.h
r9b443c7f r5a3ac84 265 265 reverse_iterate_t< T > reverseIterate( T & ref ) { 266 266 return reverse_iterate_t< T >( ref ); 267 }268 269 template< typename OutType, typename Range, typename Functor >270 OutType map_range( const Range& range, Functor&& functor ) {271 OutType out;272 273 std::transform(274 begin( range ),275 end( range ),276 std::back_inserter( out ),277 std::forward< Functor >( functor )278 );279 280 return out;281 267 } 282 268 -
src/Concurrency/Keywords.cc
r9b443c7f r5a3ac84 1 // -*- Mode: CPP -*-2 //3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo4 //5 // The contents of this file are covered under the licence agreement in the6 // file "LICENCE" distributed with Cforall.7 //8 // Keywords.cc --9 //10 // Author : Thierry Delisle11 // Created On : Mon Mar 13 12:41:22 201712 // Last Modified By :13 // Last Modified On :14 // Update Count : 015 //16 17 #include "Concurrency/Keywords.h"18 19 #include "SynTree/Declaration.h"20 #include "SynTree/Expression.h"21 #include "SynTree/Initializer.h"22 #include "SynTree/Mutator.h"23 #include "SynTree/Statement.h"24 #include "SynTree/Type.h"25 #include "SynTree/Visitor.h"26 27 namespace Concurrency {28 29 namespace {30 const std::list<Label> noLabels;31 DeclarationNode::StorageClasses noStorage;32 Type::Qualifiers noQualifiers;33 }34 35 //=============================================================================================36 // Visitors declaration37 //=============================================================================================38 39 //-----------------------------------------------------------------------------40 //Handles thread type declarations :41 // thread Mythread { struct MyThread {42 // int data; int data;43 // a_struct_t more_data; a_struct_t more_data;44 // => thread_desc __thrd_d;45 // }; };46 // static inline thread_desc * get_thread( MyThread * this ) { return &this->__thrd_d; }47 // void main( MyThread * this );48 //49 class ThreadKeyword final : public Mutator {50 public:51 52 static void implement( std::list< Declaration * > & translationUnit ) {}53 };54 55 //-----------------------------------------------------------------------------56 //Handles coroutine type declarations :57 // coroutine MyCoroutine { struct MyCoroutine {58 // int data; int data;59 // a_struct_t more_data; a_struct_t more_data;60 // => coroutine_desc __cor_d;61 // }; };62 // static inline coroutine_desc * get_coroutine( MyCoroutine * this ) { return &this->__cor_d; }63 // void main( MyCoroutine * this );64 //65 class CoroutineKeyword final : public Mutator {66 public:67 68 static void implement( std::list< Declaration * > & translationUnit ) {}69 };70 71 //-----------------------------------------------------------------------------72 //Handles monitor type declarations :73 // monitor MyMonitor { struct MyMonitor {74 // int data; int data;75 // a_struct_t more_data; a_struct_t more_data;76 // => monitor_desc __mon_d;77 // }; };78 // static inline monitor_desc * get_coroutine( MyMonitor * this ) { return &this->__cor_d; }79 // void main( MyMonitor * this );80 //81 class MonitorKeyword final : public Mutator {82 public:83 84 static void implement( std::list< Declaration * > & translationUnit ) {}85 };86 87 //-----------------------------------------------------------------------------88 //Handles mutex routines definitions :89 // void foo( A * mutex a, B * mutex b, int i ) { void foo( A * a, B * b, int i ) {90 // monitor_desc * __monitors[] = { get_monitor(a), get_monitor(b) };91 // monitor_guard_t __guard = { __monitors, 2 };92 // /*Some code*/ => /*Some code*/93 // } }94 //95 class MutexKeyword final : public Visitor {96 public:97 98 using Visitor::visit;99 virtual void visit( FunctionDecl *functionDecl ) override final;100 virtual void visit( StructDecl *functionDecl ) override final;101 102 std::list<DeclarationWithType*> findMutexArgs( FunctionDecl* );103 void validate( DeclarationWithType * );104 void addStatments( CompoundStmt *, const std::list<DeclarationWithType * > &);105 106 static void implement( std::list< Declaration * > & translationUnit ) {107 MutexKeyword impl;108 acceptAll( translationUnit, impl );109 }110 111 private:112 StructDecl* monitor_decl = nullptr;113 };114 115 //=============================================================================================116 // General entry routine117 //=============================================================================================118 void applyKeywords( std::list< Declaration * > & translationUnit ) {119 ThreadKeyword ::implement( translationUnit );120 CoroutineKeyword ::implement( translationUnit );121 MonitorKeyword ::implement( translationUnit );122 MutexKeyword ::implement( translationUnit );123 }124 125 //=============================================================================================126 // Mutex keyword implementation127 //=============================================================================================128 void MutexKeyword::visit(FunctionDecl* decl) {129 std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl );130 if( mutexArgs.empty() ) return;131 132 for(auto arg : mutexArgs) {133 validate( arg );134 }135 136 CompoundStmt* body = decl->get_statements();137 if( ! body ) return;138 139 assert(monitor_decl);140 addStatments( body, mutexArgs );141 }142 143 void MutexKeyword::visit(StructDecl* decl) {144 if( decl->get_name() == "monitor_desc" ) {145 assert( !monitor_decl );146 monitor_decl = decl;147 }148 }149 150 std::list<DeclarationWithType*> MutexKeyword::findMutexArgs( FunctionDecl* decl ) {151 std::list<DeclarationWithType*> mutexArgs;152 153 for( auto arg : decl->get_functionType()->get_parameters()) {154 //Find mutex arguments155 Type* ty = arg->get_type();156 if( ! ty->get_qualifiers().isMutex ) continue;157 158 //Append it to the list159 mutexArgs.push_back( arg );160 }161 162 return mutexArgs;163 }164 165 void MutexKeyword::validate( DeclarationWithType * arg ) {166 Type* ty = arg->get_type();167 168 //Makes sure it's not a copy169 PointerType* pty = dynamic_cast< PointerType * >( ty );170 if( ! pty ) throw SemanticError( "Mutex argument must be of pointer/reference type ", arg );171 172 //Make sure the we are pointing directly to a type173 Type* base = pty->get_base();174 if( dynamic_cast< PointerType * >( base ) ) throw SemanticError( "Mutex argument have exactly one level of indirection ", arg );175 176 //Make sure that typed isn't mutex177 if( ! base->get_qualifiers().isMutex ) throw SemanticError( "mutex keyword may only appear once per argument ", arg );178 }179 180 void MutexKeyword::addStatments( CompoundStmt * body, const std::list<DeclarationWithType * > & args ) {181 182 ObjectDecl * monitors = new ObjectDecl(183 "__monitors",184 noStorage,185 LinkageSpec::Cforall,186 nullptr,187 new ArrayType(188 noQualifiers,189 new PointerType(190 noQualifiers,191 new StructInstType(192 noQualifiers,193 monitor_decl194 )195 ),196 new ConstantExpr( Constant::from_ulong( args.size() ) ),197 false,198 false199 ),200 new ListInit(201 map_range < std::list<Initializer*> > ( args, [](DeclarationWithType * var ){202 return new SingleInit( new UntypedExpr(203 new NameExpr( "get_monitor" ),204 { new VariableExpr( var ) }205 ) );206 })207 )208 );209 210 //in reverse order :211 // monitor_guard_t __guard = { __monitors, # };212 body->push_front(213 new DeclStmt( noLabels, new ObjectDecl(214 "__guard",215 noStorage,216 LinkageSpec::Cforall,217 nullptr,218 new StructInstType(219 noQualifiers,220 "monitor_guard_t"221 ),222 new ListInit(223 {224 new SingleInit( new VariableExpr( monitors ) ),225 new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) )226 }227 )228 ))229 );230 231 //monitor_desc * __monitors[] = { a, b };232 body->push_front( new DeclStmt( noLabels, monitors) );233 }234 }; -
src/Concurrency/Keywords.h
r9b443c7f r5a3ac84 1 // -*- Mode: CPP -*-2 //3 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo4 //5 // The contents of this file are covered under the licence agreement in the6 // file "LICENCE" distributed with Cforall.7 //8 // Keywords.h --9 //10 // Author : Thierry Delisle11 // Created On : Fri Mar 10 15:16:42 201712 // Last Modified By :13 // Last Modified On :14 // Update Count : 015 //16 17 #ifndef KEYWORDS_H18 #define KEYWORDS_H19 20 #include <list>21 22 #include "SynTree/Declaration.h"23 24 namespace Concurrency {25 void applyKeywords( std::list< Declaration * > & translationUnit );26 };27 28 #endif //KEYWORDS_H -
src/GenPoly/Box.cc
r9b443c7f r5a3ac84 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 14 07:45:29 201713 // Update Count : 33 412 // Last Modified On : Mon Mar 6 23:45:59 2017 13 // Update Count : 330 14 14 // 15 15 … … 299 299 // because each unit generates copies of the default routines for each aggregate. 300 300 FunctionDecl *layoutDecl = new FunctionDecl( layoutofName( typeDecl ), 301 functionNesting > 0 ? DeclarationNode::StorageClasses() : DeclarationNode::StorageClasses( DeclarationNode::Static ),301 functionNesting > 0 ? DeclarationNode::StorageClasses() : DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), 302 302 LinkageSpec::AutoGen, layoutFnType, new CompoundStmt( noLabels ), 303 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::Inline ) );303 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) ); 304 304 layoutDecl->fixUniqueId(); 305 305 return layoutDecl; -
src/InitTweak/FixGlobalInit.cc
r9b443c7f r5a3ac84 10 10 // Created On : Mon May 04 15:14:56 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 13 23:58:27201713 // Update Count : 1 612 // Last Modified On : Mon Mar 6 23:14:19 2017 13 // Update Count : 14 14 14 // 15 15 … … 87 87 dtorParameters.push_back( new ConstantExpr( Constant::from_int( 102 ) ) ); 88 88 } 89 initFunction = new FunctionDecl( "_init_" + fixedName, DeclarationNode::StorageClasses( DeclarationNode::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );89 initFunction = new FunctionDecl( "_init_" + fixedName, DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) ); 90 90 initFunction->get_attributes().push_back( new Attribute( "constructor", ctorParameters ) ); 91 destroyFunction = new FunctionDecl( "_destroy_" + fixedName, DeclarationNode::StorageClasses( DeclarationNode::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );91 destroyFunction = new FunctionDecl( "_destroy_" + fixedName, DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) ); 92 92 destroyFunction->get_attributes().push_back( new Attribute( "destructor", dtorParameters ) ); 93 93 } … … 143 143 // compile-command: "make install" // 144 144 // End: // 145 -
src/InitTweak/FixInit.cc
r9b443c7f r5a3ac84 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 14 08:05:28201713 // Update Count : 6312 // Last Modified On : Tue Mar 7 07:51:40 2017 13 // Update Count : 59 14 14 // 15 15 … … 678 678 assert( ! ctorInit->get_ctor() || ! ctorInit->get_init() ); 679 679 if ( Statement * ctor = ctorInit->get_ctor() ) { 680 if ( objDecl->get_storageClasses() .is_static) {680 if ( objDecl->get_storageClasses()[ DeclarationNode::Static ] ) { 681 681 // originally wanted to take advantage of gcc nested functions, but 682 682 // we get memory errors with this approach. To remedy this, the static … … 704 704 BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool ); 705 705 SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant( boolType->clone(), "1" ) ), noDesignators ); 706 ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", DeclarationNode::StorageClasses( DeclarationNode::Static ), LinkageSpec::Cforall, 0, boolType, boolInitExpr );706 ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::Cforall, 0, boolType, boolInitExpr ); 707 707 isUninitializedVar->fixUniqueId(); 708 708 … … 731 731 732 732 // void __objName_dtor_atexitN(...) {...} 733 FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), DeclarationNode::StorageClasses( DeclarationNode::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );733 FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) ); 734 734 dtorCaller->fixUniqueId(); 735 735 dtorCaller->get_statements()->push_back( dtorStmt ); … … 764 764 // create a new object which is never used 765 765 static UniqueName dummyNamer( "_dummy" ); 766 ObjectDecl * dummy = new ObjectDecl( dummyNamer.newName(), DeclarationNode::StorageClasses( DeclarationNode::Static ), LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), 0, std::list< Attribute * >{ new Attribute("unused") } );766 ObjectDecl * dummy = new ObjectDecl( dummyNamer.newName(), DeclarationNode::StorageClasses( DeclarationNode::StaticClass ), LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), 0, std::list< Attribute * >{ new Attribute("unused") } ); 767 767 return dummy; 768 768 } … … 821 821 void InsertDtors::visit( ObjectDecl * objDecl ) { 822 822 // remember non-static destructed objects so that their destructors can be inserted later 823 if ( ! objDecl->get_storageClasses() .is_static) {823 if ( ! objDecl->get_storageClasses()[ DeclarationNode::Static ] ) { 824 824 if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) { 825 825 // a decision should have been made by the resolver, so ctor and init are not both non-NULL -
src/InitTweak/GenInit.cc
r9b443c7f r5a3ac84 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 13 23:59:09201713 // Update Count : 1 8012 // Last Modified On : Tue Mar 7 07:51:38 2017 13 // Update Count : 179 14 14 // 15 15 … … 186 186 // C doesn't allow variable sized arrays at global scope or for static variables, so don't hoist dimension. 187 187 if ( ! inFunction ) return; 188 if ( storageClasses .is_static) return;188 if ( storageClasses[ DeclarationNode::StaticClass] ) return; 189 189 190 190 if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) { -
src/InitTweak/InitTweak.cc
r9b443c7f r5a3ac84 260 260 (objDecl->get_init() == NULL || 261 261 ( objDecl->get_init() != NULL && objDecl->get_init()->get_maybeConstructed() )) 262 && ! objDecl->get_storageClasses() .is_extern;262 && ! objDecl->get_storageClasses()[ DeclarationNode::Extern ]; 263 263 } 264 264 -
src/Parser/DeclarationNode.cc
r9b443c7f r5a3ac84 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 14 14:45:52201713 // Update Count : 9 7312 // Last Modified On : Tue Mar 7 17:28:56 2017 13 // Update Count : 937 14 14 // 15 15 … … 90 90 newnode->type = maybeClone( type ); 91 91 newnode->storageClasses = storageClasses; 92 newnode->bitfieldWidth = maybeClone( bitfieldWidth ); 92 93 newnode->funcSpecs = funcSpecs; 93 newnode->bitfieldWidth = maybeClone( bitfieldWidth );94 94 newnode->enumeratorValue.reset( maybeClone( enumeratorValue.get() ) ); 95 95 newnode->hasEllipsis = hasEllipsis; … … 117 117 118 118 void DeclarationNode::print_StorageClass( std::ostream & output, StorageClasses storageClasses ) { 119 if ( storageClasses. val != 0 ) { // storage classes?119 if ( storageClasses.any() ) { // function specifiers? 120 120 for ( unsigned int i = 0; i < DeclarationNode::NoStorageClass; i += 1 ) { 121 121 if ( storageClasses[i] ) { … … 127 127 128 128 void DeclarationNode::print_FuncSpec( std::ostream & output, DeclarationNode::FuncSpecifiers funcSpec ) { 129 if ( funcSpec. val != 0 ) { // function specifiers?129 if ( funcSpec.any() ) { // function specifiers? 130 130 for ( unsigned int i = 0; i < DeclarationNode::NoFuncSpecifier; i += 1 ) { 131 131 if ( funcSpec[i] ) { … … 202 202 203 203 204 DeclarationNode * DeclarationNode::newStorageClass( StorageClasses sc ) {205 DeclarationNode * newnode = new DeclarationNode; 206 newnode->storageClasses = sc;204 DeclarationNode * DeclarationNode::newStorageClass( DeclarationNode::StorageClass sc ) { 205 DeclarationNode * newnode = new DeclarationNode; 206 newnode->storageClasses[ sc ] = true; 207 207 return newnode; 208 208 } // DeclarationNode::newStorageClass 209 209 210 DeclarationNode * DeclarationNode::newFuncSpecifier( FuncSpecifiersfs ) {211 DeclarationNode * newnode = new DeclarationNode; 212 newnode->funcSpecs = fs;210 DeclarationNode * DeclarationNode::newFuncSpecifier( DeclarationNode::FuncSpecifier fs ) { 211 DeclarationNode * newnode = new DeclarationNode; 212 newnode->funcSpecs[ fs ] = true; 213 213 return newnode; 214 214 } // DeclarationNode::newFuncSpecifier 215 215 216 DeclarationNode * DeclarationNode::newTypeQualifier( TypeQualifier stq ) {216 DeclarationNode * DeclarationNode::newTypeQualifier( TypeQualifier tq ) { 217 217 DeclarationNode * newnode = new DeclarationNode; 218 218 newnode->type = new TypeData(); 219 newnode->type->typeQualifiers = tq;219 newnode->type->typeQualifiers[ tq ] = true; 220 220 return newnode; 221 221 } // DeclarationNode::newQualifier … … 457 457 458 458 void DeclarationNode::checkQualifiers( const TypeData * src, const TypeData * dst ) { 459 const Type Qualifiers qsrc = src->typeQualifiers, qdst = dst->typeQualifiers; // optimization460 461 if ( (qsrc .val & qdst.val) != 0 ) { // duplicates?462 for ( unsigned int i = 0; i < NoTypeQualifier; i += 1 ) { // find duplicates459 const TypeData::TypeQualifiers qsrc = src->typeQualifiers, qdst = dst->typeQualifiers; // optimization 460 461 if ( (qsrc & qdst).any() ) { // common qualifier ? 462 for ( unsigned int i = 0; i < NoTypeQualifier; i += 1 ) { // find common qualifiers 463 463 if ( qsrc[i] && qdst[i] ) { 464 464 appendError( error, string( "duplicate " ) + DeclarationNode::typeQualifierNames[i] ); … … 469 469 470 470 void DeclarationNode::checkSpecifiers( DeclarationNode * src ) { 471 if ( (funcSpecs .val & src->funcSpecs.val) != 0 ) { // duplicates?472 for ( unsigned int i = 0; i < NoFuncSpecifier; i += 1 ) { // find duplicates471 if ( (funcSpecs & src->funcSpecs).any() ) { // common specifier ? 472 for ( unsigned int i = 0; i < NoFuncSpecifier; i += 1 ) { // find common specifier 473 473 if ( funcSpecs[i] && src->funcSpecs[i] ) { 474 474 appendError( error, string( "duplicate " ) + DeclarationNode::funcSpecifierNames[i] ); … … 477 477 } // if 478 478 479 if ( storageClasses .val != 0 && src->storageClasses.val!= 0 ) { // any reason to check ?480 if ( (storageClasses .val & src->storageClasses.val ) != 0) { // duplicates ?479 if ( storageClasses != 0 && src->storageClasses != 0 ) { // any reason to check ? 480 if ( (storageClasses & src->storageClasses).any() ) { // duplicates ? 481 481 for ( unsigned int i = 0; i < NoStorageClass; i += 1 ) { // find duplicates 482 482 if ( storageClasses[i] && src->storageClasses[i] ) { … … 485 485 } // for 486 486 // src is the new item being added and has a single bit 487 } else if ( ! src->storageClasses .is_threadlocal) { // conflict ?488 appendError( error, string( "conflicting " ) + storageClassNames[ffs( storageClasses. val) - 1] +489 " & " + storageClassNames[ffs( src->storageClasses. val) - 1] );490 src->storageClasses. val = 0; // FIX to preserve invariant of one basic storage specifier487 } else if ( ! src->storageClasses[ Threadlocal ] ) { // conflict ? 488 appendError( error, string( "conflicting " ) + storageClassNames[ffs( storageClasses.to_ulong() ) - 1] + 489 " & " + storageClassNames[ffs( src->storageClasses.to_ulong() ) - 1] ); 490 src->storageClasses.reset(); // FIX to preserve invariant of one basic storage specifier 491 491 } // if 492 492 } // if … … 496 496 497 497 DeclarationNode * DeclarationNode::copySpecifiers( DeclarationNode * q ) { 498 funcSpecs .val = funcSpecs.val | q->funcSpecs.val;499 storageClasses .val = storageClasses.val | q->storageClasses.val;498 funcSpecs = funcSpecs | q->funcSpecs; 499 storageClasses = storageClasses | q->storageClasses; 500 500 501 501 for ( Attribute *attr: reverseIterate( q->attributes ) ) { … … 520 520 src = nullptr; 521 521 } else { 522 dst->typeQualifiers .val |= src->typeQualifiers.val;522 dst->typeQualifiers |= src->typeQualifiers; 523 523 } // if 524 524 } // addQualifiersToType … … 578 578 switch ( dst->kind ) { 579 579 case TypeData::Unknown: 580 src->typeQualifiers .val |= dst->typeQualifiers.val;580 src->typeQualifiers |= dst->typeQualifiers; 581 581 dst = src; 582 582 src = nullptr; 583 583 break; 584 584 case TypeData::Basic: 585 dst->typeQualifiers .val |= src->typeQualifiers.val;585 dst->typeQualifiers |= src->typeQualifiers; 586 586 if ( src->kind != TypeData::Unknown ) { 587 587 assert( src->kind == TypeData::Basic ); … … 619 619 dst->base->aggInst.params = maybeClone( src->aggregate.actuals ); 620 620 } // if 621 dst->base->typeQualifiers .val |= src->typeQualifiers.val;621 dst->base->typeQualifiers |= src->typeQualifiers; 622 622 src = nullptr; 623 623 break; … … 651 651 type->aggInst.hoistType = o->type->enumeration.body; 652 652 } // if 653 type->typeQualifiers .val |= o->type->typeQualifiers.val;653 type->typeQualifiers |= o->type->typeQualifiers; 654 654 } else { 655 655 type = o->type; … … 807 807 p->type->base->aggInst.params = maybeClone( type->aggregate.actuals ); 808 808 } // if 809 p->type->base->typeQualifiers .val |= type->typeQualifiers.val;809 p->type->base->typeQualifiers |= type->typeQualifiers; 810 810 break; 811 811 … … 844 844 lastArray->base->aggInst.params = maybeClone( type->aggregate.actuals ); 845 845 } // if 846 lastArray->base->typeQualifiers .val |= type->typeQualifiers.val;846 lastArray->base->typeQualifiers |= type->typeQualifiers; 847 847 break; 848 848 default: … … 1058 1058 // inline _Noreturn int g( int i ); // allowed 1059 1059 // inline _Noreturn int i; // disallowed 1060 if ( type->kind != TypeData::Function && funcSpecs. val != 0) {1060 if ( type->kind != TypeData::Function && funcSpecs.any() ) { 1061 1061 throw SemanticError( "invalid function specifier for ", this ); 1062 1062 } // if … … 1068 1068 // inlne _Noreturn struct S { ... }; // disallowed 1069 1069 // inlne _Noreturn enum E { ... }; // disallowed 1070 if ( funcSpecs. val != 0) {1070 if ( funcSpecs.any() ) { 1071 1071 throw SemanticError( "invalid function specifier for ", this ); 1072 1072 } // if -
src/Parser/ParseNode.h
r9b443c7f r5a3ac84 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 14 16:53:19201713 // Update Count : 7 5712 // Last Modified On : Tue Mar 7 08:10:53 2017 13 // Update Count : 726 14 14 // 15 15 … … 19 19 #include <string> 20 20 #include <list> 21 #include <bitset> 21 22 #include <iterator> 22 23 #include <memory> … … 203 204 // These must remain in the same order as the corresponding DeclarationNode names. 204 205 205 enum { Extern = 1 << 0, Static = 1 << 1, Auto = 1 << 2, Register = 1 << 3, Threadlocal = 1 << 4, NoStorageClass = 5 }; 206 union StorageClasses { 207 unsigned int val; 208 struct { 209 bool is_extern : 1; 210 bool is_static : 1; 211 bool is_auto : 1; 212 bool is_register : 1; 213 bool is_threadlocal : 1; 214 }; 215 StorageClasses() : val( 0 ) {} 216 StorageClasses( unsigned int val ) : val( val ) {} 217 bool operator[]( unsigned int i ) const { return val & (1 << i); } 218 }; // StorageClasses 219 220 enum { Inline = 1 << 0, Noreturn = 1 << 1, Fortran = 1 << 2, NoFuncSpecifier = 3 }; 221 union FuncSpecifiers { 222 unsigned int val; 223 struct { 224 bool is_inline : 1; 225 bool is_noreturn : 1; 226 bool is_fortran : 1; 227 }; 228 FuncSpecifiers() : val( 0 ) {} 229 FuncSpecifiers( unsigned int val ) : val( val ) {} 230 bool operator[]( unsigned int i ) const { return val & (1 << i); } 231 }; // FuncSpecifiers 232 233 enum { Const = 1 << 0, Restrict = 1 << 1, Volatile = 1 << 2, Lvalue = 1 << 3, Mutex = 1 << 4, Atomic = 1 << 5, NoTypeQualifier = 6 }; 234 union TypeQualifiers { 235 unsigned int val; 236 struct { 237 bool is_const : 1; 238 bool is_restrict : 1; 239 bool is_volatile : 1; 240 bool is_lvalue : 1; 241 bool is_mutex : 1; 242 bool is_atomic : 1; 243 }; 244 TypeQualifiers() : val( 0 ) {} 245 TypeQualifiers( unsigned int val ) : val( val ) {} 246 bool operator[]( unsigned int i ) const { return val & (1 << i); } 247 }; // TypeQualifiers 248 206 enum StorageClass { Extern, Static, Auto, Register, Threadlocal, NoStorageClass, 207 ExternClass = 1 << Extern, StaticClass = 1 << Static, AutoClass = 1 << Auto, RegisterClass = 1 << Register, ThreadlocalClass = 1 << Threadlocal }; 208 enum FuncSpecifier { Inline, Noreturn, Fortran, NoFuncSpecifier, 209 InlineSpec = 1 << Inline, NoreturnSpec = 1 << Noreturn, FortranSpec = 1 << Fortran }; 210 enum TypeQualifier { Const, Restrict, Volatile, Lvalue, Mutex, Atomic, NoTypeQualifier }; 249 211 enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, NoBasicType }; 250 212 enum ComplexType { Complex, Imaginary, NoComplexType }; … … 266 228 static const char * builtinTypeNames[]; 267 229 268 static DeclarationNode * newStorageClass( StorageClass es);269 static DeclarationNode * newFuncSpecifier( FuncSpecifier s);270 static DeclarationNode * newTypeQualifier( TypeQualifier s);230 static DeclarationNode * newStorageClass( StorageClass ); 231 static DeclarationNode * newFuncSpecifier( FuncSpecifier ); 232 static DeclarationNode * newTypeQualifier( TypeQualifier ); 271 233 static DeclarationNode * newBasicType( BasicType ); 272 234 static DeclarationNode * newComplexType( ComplexType ); … … 364 326 TypeData * type; 365 327 328 typedef std::bitset< DeclarationNode::NoStorageClass > StorageClasses; 366 329 StorageClasses storageClasses; 367 330 static void print_StorageClass( std::ostream & output, StorageClasses storageClasses ); 368 331 332 typedef std::bitset< DeclarationNode::NoFuncSpecifier > FuncSpecifiers; 369 333 FuncSpecifiers funcSpecs; 370 334 static void print_FuncSpec( std::ostream & output, FuncSpecifiers funcSpecs ); -
src/Parser/TypeData.cc
r9b443c7f r5a3ac84 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 14 15:01:44201713 // Update Count : 5 4812 // Last Modified On : Tue Mar 7 08:08:21 2017 13 // Update Count : 538 14 14 // 15 15 … … 26 26 using namespace std; 27 27 28 TypeData::TypeData( Kind k ) : kind( k ), base( nullptr ), forall( nullptr ) /*, PTR1( (void*)(0xdeadbeefdeadbeef)), PTR2( (void*)(0xdeadbeefdeadbeef) ) */{28 TypeData::TypeData( Kind k ) : kind( k ), base( nullptr ), forall( nullptr ) { 29 29 switch ( kind ) { 30 30 case Unknown: … … 50 50 function.newStyle = false; 51 51 break; 52 // Enum is an Aggregate, so both structures are initialized together.53 case Enum:54 // enumeration = new Enumeration_t;55 enumeration.name = nullptr;56 enumeration.constants = nullptr;57 enumeration.body = false;58 52 case Aggregate: 59 53 // aggregate = new Aggregate_t; … … 69 63 aggInst.params = nullptr; 70 64 aggInst.hoistType = false;; 65 break; 66 case Enum: 67 // enumeration = new Enumeration_t; 68 enumeration.name = nullptr; 69 enumeration.constants = nullptr; 70 enumeration.body = false; 71 71 break; 72 72 case Symbolic: … … 494 494 Type::Qualifiers buildQualifiers( const TypeData * td ) { 495 495 Type::Qualifiers q; 496 q.isConst = td->typeQualifiers .is_const;497 q.isVolatile = td->typeQualifiers .is_volatile;498 q.isRestrict = td->typeQualifiers .is_restrict;499 q.isLvalue = td->typeQualifiers .is_lvalue;500 q.isAtomic = td->typeQualifiers .is_atomic;496 q.isConst = td->typeQualifiers[ DeclarationNode::Const ]; 497 q.isVolatile = td->typeQualifiers[ DeclarationNode::Volatile ]; 498 q.isRestrict = td->typeQualifiers[ DeclarationNode::Restrict ]; 499 q.isLvalue = td->typeQualifiers[ DeclarationNode::Lvalue ]; 500 q.isAtomic = td->typeQualifiers[ DeclarationNode::Atomic ];; 501 501 return q; 502 502 } // buildQualifiers -
src/Parser/TypeData.h
r9b443c7f r5a3ac84 10 10 // Created On : Sat May 16 15:18:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 14 16:51:26201713 // Update Count : 1 8112 // Last Modified On : Wed Mar 8 22:28:33 2017 13 // Update Count : 174 14 14 // 15 15 16 16 #ifndef TYPEDATA_H 17 17 #define TYPEDATA_H 18 19 #include <bitset> 18 20 19 21 #include "ParseNode.h" … … 75 77 DeclarationNode::BuiltinType builtintype = DeclarationNode::NoBuiltinType; 76 78 77 DeclarationNode::TypeQualifiers typeQualifiers; 79 typedef std::bitset< DeclarationNode::NoTypeQualifier > TypeQualifiers; 80 TypeQualifiers typeQualifiers; 78 81 DeclarationNode * forall; 79 82 -
src/SymTab/Autogen.cc
r9b443c7f r5a3ac84 10 10 // Created On : Thu Mar 03 15:45:56 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 14 07:45:00201713 // Update Count : 5 412 // Last Modified On : Tue Mar 7 07:42:44 2017 13 // Update Count : 51 14 14 // 15 15 … … 162 162 // because each unit generates copies of the default routines for each aggregate. 163 163 // DeclarationNode::StorageClass sc = functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static; 164 DeclarationNode::StorageClasses scs = functionNesting > 0 ? DeclarationNode::StorageClasses() : DeclarationNode::StorageClasses( DeclarationNode::Static );164 DeclarationNode::StorageClasses scs = functionNesting > 0 ? DeclarationNode::StorageClasses() : DeclarationNode::StorageClasses( DeclarationNode::StaticClass ); 165 165 LinkageSpec::Spec spec = isIntrinsic ? LinkageSpec::Intrinsic : LinkageSpec::AutoGen; 166 166 FunctionDecl * decl = new FunctionDecl( fname, scs, spec, ftype, new CompoundStmt( noLabels ), 167 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::Inline ) );167 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) ); 168 168 decl->fixUniqueId(); 169 169 return decl; … … 720 720 TypeInstType * inst = new TypeInstType( Type::Qualifiers(), newDecl->get_name(), newDecl ); 721 721 newDecl->get_assertions().push_back( new FunctionDecl( "?=?", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genAssignType( inst ), nullptr, 722 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::Inline ) ) );722 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) ) ); 723 723 newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr, 724 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::Inline ) ) );724 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) ) ); 725 725 newDecl->get_assertions().push_back( new FunctionDecl( "?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genCopyType( inst ), nullptr, 726 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::Inline ) ) );726 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) ) ); 727 727 newDecl->get_assertions().push_back( new FunctionDecl( "^?{}", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, genDefaultType( inst ), nullptr, 728 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::Inline ) ) );728 std::list< Attribute * >(), DeclarationNode::FuncSpecifiers( DeclarationNode::InlineSpec ) ) ); 729 729 typeParams.push_back( newDecl ); 730 730 done.insert( ty->get_baseType() ); -
src/SymTab/Autogen.h
r9b443c7f r5a3ac84 58 58 assert( type ); 59 59 Type * castType = type->clone(); 60 castType->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true , false);60 castType->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true); 61 61 castType->set_isLvalue( true ); // xxx - might not need this 62 62 dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) ); -
src/SymTab/Indexer.cc
r9b443c7f r5a3ac84 10 10 // Created On : Sun May 17 21:37:33 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Mar 14 08:07:34201713 // Update Count : 1 712 // Last Modified On : Tue Mar 7 07:45:32 2017 13 // Update Count : 16 14 14 // 15 15 … … 738 738 ObjectDecl *newobj = dynamic_cast< ObjectDecl* >( added ); 739 739 ObjectDecl *oldobj = dynamic_cast< ObjectDecl* >( existing ); 740 if ( ! newobj->get_storageClasses() .is_extern && ! oldobj->get_storageClasses().is_extern) {740 if ( ! newobj->get_storageClasses()[ DeclarationNode::Extern ] && ! oldobj->get_storageClasses()[ DeclarationNode::Extern ] ) { 741 741 throw SemanticError( "duplicate object definition for ", added ); 742 742 } // if -
src/SymTab/Validate.cc
r9b443c7f r5a3ac84 323 323 ObjectDecl * obj = dynamic_cast< ObjectDecl * >( *i ); 324 324 assert( obj ); 325 obj->set_type( new EnumInstType( Type::Qualifiers( true, false, false, false, false , false), enumDecl->get_name() ) );325 obj->set_type( new EnumInstType( Type::Qualifiers( true, false, false, false, false ), enumDecl->get_name() ) ); 326 326 } // for 327 327 Parent::visit( enumDecl ); -
src/SynTree/Type.h
r9b443c7f r5a3ac84 25 25 public: 26 26 struct Qualifiers { 27 Qualifiers(): isConst( false ), isVolatile( false ), isRestrict( false ), isLvalue( false ), isAtomic( false ) , isMutex( false ){}28 Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic , bool isMutex ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ), isMutex( isMutex) {}27 Qualifiers(): isConst( false ), isVolatile( false ), isRestrict( false ), isLvalue( false ), isAtomic( false ) {} 28 Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ) {} 29 29 30 30 Qualifiers &operator&=( const Qualifiers &other ); … … 45 45 bool isLvalue; 46 46 bool isAtomic; 47 bool isMutex;48 47 }; 49 48 … … 512 511 isLvalue &= other.isLvalue; 513 512 isAtomic &= other.isAtomic; 514 isMutex &= other.isMutex;515 513 return *this; 516 514 } … … 522 520 isLvalue |= other.isLvalue; 523 521 isAtomic |= other.isAtomic; 524 isMutex |= other.isMutex;525 522 return *this; 526 523 } … … 531 528 if ( other.isRestrict ) isRestrict = 0; 532 529 if ( other.isAtomic ) isAtomic = 0; 533 if ( other.isMutex ) isMutex = 0;534 530 return *this; 535 531 } -
src/Tuples/TupleAssignment.cc
r9b443c7f r5a3ac84 199 199 Type * type = InitTweak::getPointerBase( castType ); 200 200 assert( type ); 201 type->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true , false);201 type->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true); 202 202 type->set_isLvalue( true ); // xxx - might not need this 203 203 expr = new CastExpr( expr, castType ); -
src/Tuples/TupleExpansion.cc
r9b443c7f r5a3ac84 305 305 Type * makeTupleType( const std::list< Expression * > & exprs ) { 306 306 // produce the TupleType which aggregates the types of the exprs 307 TupleType *tupleType = new TupleType( Type::Qualifiers(true, true, true, true, true , true) );307 TupleType *tupleType = new TupleType( Type::Qualifiers(true, true, true, true, true) ); 308 308 Type::Qualifiers &qualifiers = tupleType->get_qualifiers(); 309 309 for ( Expression * expr : exprs ) { -
src/benchmark/CorCtxSwitch.c
r9b443c7f r5a3ac84 1 1 #include <fstream> 2 2 #include <stdlib> 3 #include <thread >3 #include <threads> 4 4 5 5 #include <unistd.h> // sysconf … … 24 24 25 25 struct GreatSuspender { 26 coroutine _descc;26 coroutine c; 27 27 }; 28 28 -
src/benchmark/ThrdCtxSwitch.c
r9b443c7f r5a3ac84 1 1 #include <fstream> 2 2 #include <stdlib> 3 #include <thread >3 #include <threads> 4 4 5 5 #include <unistd.h> // sysconf -
src/benchmark/bench.c
r9b443c7f r5a3ac84 2 2 #include <fstream> 3 3 #include <stdlib> 4 #include <thread >4 #include <threads> 5 5 6 6 #include <unistd.h> // sysconf … … 86 86 //======================================= 87 87 88 struct CoroutineDummy { coroutine _descc; };88 struct CoroutineDummy { coroutine c; }; 89 89 DECL_COROUTINE(CoroutineDummy); 90 90 void main(CoroutineDummy * this) {} … … 119 119 struct CoroutineResume { 120 120 int N; 121 coroutine _descc;121 coroutine c; 122 122 }; 123 123 … … 150 150 //======================================= 151 151 152 struct ThreadDummy { thread _desct; };152 struct ThreadDummy { thread t; }; 153 153 DECL_THREAD(ThreadDummy); 154 154 void main(ThreadDummy * this) {} … … 180 180 int N; 181 181 long long result; 182 thread _desct;182 thread t; 183 183 }; 184 184 -
src/benchmark/csv-data.c
r9b443c7f r5a3ac84 1 1 #include <fstream> 2 2 #include <stdlib> 3 #include <thread >3 #include <threads> 4 4 5 5 extern "C" { … … 26 26 27 27 struct GreatSuspender { 28 coroutine _descc;28 coroutine c; 29 29 }; 30 30 -
src/examples/multicore.c
r9b443c7f r5a3ac84 1 1 #include <kernel> 2 #include <thread >2 #include <threads> 3 3 4 struct MyThread { thread _desct; };4 struct MyThread { thread t; }; 5 5 6 6 DECL_THREAD(MyThread); -
src/libcfa/Makefile.am
r9b443c7f r5a3ac84 45 45 # not all platforms support concurrency, add option do disable it 46 46 if BUILD_CONCURRENCY 47 headers += containers/vector concurrency/coroutine concurrency/threadconcurrency/kernel concurrency/monitor47 headers += containers/vector concurrency/coroutines concurrency/threads concurrency/kernel concurrency/monitor 48 48 endif 49 49 -
src/libcfa/Makefile.in
r9b443c7f r5a3ac84 43 43 44 44 # not all platforms support concurrency, add option do disable it 45 @BUILD_CONCURRENCY_TRUE@am__append_3 = containers/vector concurrency/coroutine concurrency/threadconcurrency/kernel concurrency/monitor45 @BUILD_CONCURRENCY_TRUE@am__append_3 = containers/vector concurrency/coroutines concurrency/threads concurrency/kernel concurrency/monitor 46 46 47 47 # not all platforms support concurrency, add option do disable it … … 99 99 am__libcfa_d_a_SOURCES_DIST = libcfa-prelude.c limits.c stdlib.c \ 100 100 math.c iostream.c fstream.c iterator.c rational.c assert.c \ 101 containers/vector.c concurrency/coroutine .c \102 concurrency/thread .c concurrency/kernel.c \101 containers/vector.c concurrency/coroutines.c \ 102 concurrency/threads.c concurrency/kernel.c \ 103 103 concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \ 104 104 concurrency/invoke.c 105 105 am__dirstamp = $(am__leading_dot)dirstamp 106 106 @BUILD_CONCURRENCY_TRUE@am__objects_1 = containers/libcfa_d_a-vector.$(OBJEXT) \ 107 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-coroutine .$(OBJEXT) \108 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-thread .$(OBJEXT) \107 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-coroutines.$(OBJEXT) \ 108 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-threads.$(OBJEXT) \ 109 109 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-kernel.$(OBJEXT) \ 110 110 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-monitor.$(OBJEXT) … … 124 124 am__libcfa_a_SOURCES_DIST = libcfa-prelude.c limits.c stdlib.c math.c \ 125 125 iostream.c fstream.c iterator.c rational.c assert.c \ 126 containers/vector.c concurrency/coroutine .c \127 concurrency/thread .c concurrency/kernel.c \126 containers/vector.c concurrency/coroutines.c \ 127 concurrency/threads.c concurrency/kernel.c \ 128 128 concurrency/monitor.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \ 129 129 concurrency/invoke.c 130 130 @BUILD_CONCURRENCY_TRUE@am__objects_5 = \ 131 131 @BUILD_CONCURRENCY_TRUE@ containers/libcfa_a-vector.$(OBJEXT) \ 132 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-coroutine .$(OBJEXT) \133 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-thread .$(OBJEXT) \132 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-coroutines.$(OBJEXT) \ 133 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-threads.$(OBJEXT) \ 134 134 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-kernel.$(OBJEXT) \ 135 135 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-monitor.$(OBJEXT) … … 175 175 am__nobase_cfa_include_HEADERS_DIST = limits stdlib math iostream \ 176 176 fstream iterator rational assert containers/vector \ 177 concurrency/coroutine concurrency/threadconcurrency/kernel \177 concurrency/coroutines concurrency/threads concurrency/kernel \ 178 178 concurrency/monitor ${shell echo stdhdr/*} \ 179 179 concurrency/invoke.h … … 397 397 @$(MKDIR_P) concurrency/$(DEPDIR) 398 398 @: > concurrency/$(DEPDIR)/$(am__dirstamp) 399 concurrency/libcfa_d_a-coroutine .$(OBJEXT): \399 concurrency/libcfa_d_a-coroutines.$(OBJEXT): \ 400 400 concurrency/$(am__dirstamp) \ 401 401 concurrency/$(DEPDIR)/$(am__dirstamp) 402 concurrency/libcfa_d_a-thread .$(OBJEXT): concurrency/$(am__dirstamp) \402 concurrency/libcfa_d_a-threads.$(OBJEXT): concurrency/$(am__dirstamp) \ 403 403 concurrency/$(DEPDIR)/$(am__dirstamp) 404 404 concurrency/libcfa_d_a-kernel.$(OBJEXT): concurrency/$(am__dirstamp) \ … … 417 417 containers/libcfa_a-vector.$(OBJEXT): containers/$(am__dirstamp) \ 418 418 containers/$(DEPDIR)/$(am__dirstamp) 419 concurrency/libcfa_a-coroutine.$(OBJEXT): concurrency/$(am__dirstamp) \ 419 concurrency/libcfa_a-coroutines.$(OBJEXT): \ 420 concurrency/$(am__dirstamp) \ 420 421 concurrency/$(DEPDIR)/$(am__dirstamp) 421 concurrency/libcfa_a-thread .$(OBJEXT): concurrency/$(am__dirstamp) \422 concurrency/libcfa_a-threads.$(OBJEXT): concurrency/$(am__dirstamp) \ 422 423 concurrency/$(DEPDIR)/$(am__dirstamp) 423 424 concurrency/libcfa_a-kernel.$(OBJEXT): concurrency/$(am__dirstamp) \ … … 435 436 -rm -f *.$(OBJEXT) 436 437 -rm -f concurrency/CtxSwitch-@MACHINE_TYPE@.$(OBJEXT) 437 -rm -f concurrency/libcfa_a-coroutine .$(OBJEXT)438 -rm -f concurrency/libcfa_a-coroutines.$(OBJEXT) 438 439 -rm -f concurrency/libcfa_a-invoke.$(OBJEXT) 439 440 -rm -f concurrency/libcfa_a-kernel.$(OBJEXT) 440 441 -rm -f concurrency/libcfa_a-monitor.$(OBJEXT) 441 -rm -f concurrency/libcfa_a-thread .$(OBJEXT)442 -rm -f concurrency/libcfa_d_a-coroutine .$(OBJEXT)442 -rm -f concurrency/libcfa_a-threads.$(OBJEXT) 443 -rm -f concurrency/libcfa_d_a-coroutines.$(OBJEXT) 443 444 -rm -f concurrency/libcfa_d_a-invoke.$(OBJEXT) 444 445 -rm -f concurrency/libcfa_d_a-kernel.$(OBJEXT) 445 446 -rm -f concurrency/libcfa_d_a-monitor.$(OBJEXT) 446 -rm -f concurrency/libcfa_d_a-thread .$(OBJEXT)447 -rm -f concurrency/libcfa_d_a-threads.$(OBJEXT) 447 448 -rm -f containers/libcfa_a-vector.$(OBJEXT) 448 449 -rm -f containers/libcfa_d_a-vector.$(OBJEXT) … … 470 471 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-stdlib.Po@am__quote@ 471 472 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@MACHINE_TYPE@.Po@am__quote@ 472 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-coroutine .Po@am__quote@473 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-coroutines.Po@am__quote@ 473 474 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-invoke.Po@am__quote@ 474 475 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-kernel.Po@am__quote@ 475 476 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-monitor.Po@am__quote@ 476 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-thread .Po@am__quote@477 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-coroutine .Po@am__quote@477 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-threads.Po@am__quote@ 478 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Po@am__quote@ 478 479 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-invoke.Po@am__quote@ 479 480 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-kernel.Po@am__quote@ 480 481 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-monitor.Po@am__quote@ 481 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-thread .Po@am__quote@482 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_d_a-threads.Po@am__quote@ 482 483 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_a-vector.Po@am__quote@ 483 484 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-vector.Po@am__quote@ … … 648 649 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_d_a-vector.obj `if test -f 'containers/vector.c'; then $(CYGPATH_W) 'containers/vector.c'; else $(CYGPATH_W) '$(srcdir)/containers/vector.c'; fi` 649 650 650 concurrency/libcfa_d_a-coroutine .o: concurrency/coroutine.c651 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-coroutine .o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Tpo -c -o concurrency/libcfa_d_a-coroutine.o `test -f 'concurrency/coroutine.c' || echo '$(srcdir)/'`concurrency/coroutine.c652 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-coroutine .Tpo concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Po653 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/coroutine .c' object='concurrency/libcfa_d_a-coroutine.o' libtool=no @AMDEPBACKSLASH@654 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 655 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-coroutine .o `test -f 'concurrency/coroutine.c' || echo '$(srcdir)/'`concurrency/coroutine.c656 657 concurrency/libcfa_d_a-coroutine .obj: concurrency/coroutine.c658 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-coroutine .obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Tpo -c -o concurrency/libcfa_d_a-coroutine.obj `if test -f 'concurrency/coroutine.c'; then $(CYGPATH_W) 'concurrency/coroutine.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutine.c'; fi`659 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-coroutine .Tpo concurrency/$(DEPDIR)/libcfa_d_a-coroutine.Po660 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/coroutine .c' object='concurrency/libcfa_d_a-coroutine.obj' libtool=no @AMDEPBACKSLASH@661 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 662 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-coroutine .obj `if test -f 'concurrency/coroutine.c'; then $(CYGPATH_W) 'concurrency/coroutine.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutine.c'; fi`663 664 concurrency/libcfa_d_a-thread .o: concurrency/thread.c665 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-thread .o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-thread.Tpo -c -o concurrency/libcfa_d_a-thread.o `test -f 'concurrency/thread.c' || echo '$(srcdir)/'`concurrency/thread.c666 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-thread .Tpo concurrency/$(DEPDIR)/libcfa_d_a-thread.Po667 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/thread .c' object='concurrency/libcfa_d_a-thread.o' libtool=no @AMDEPBACKSLASH@668 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 669 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-thread .o `test -f 'concurrency/thread.c' || echo '$(srcdir)/'`concurrency/thread.c670 671 concurrency/libcfa_d_a-thread .obj: concurrency/thread.c672 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-thread .obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-thread.Tpo -c -o concurrency/libcfa_d_a-thread.obj `if test -f 'concurrency/thread.c'; then $(CYGPATH_W) 'concurrency/thread.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/thread.c'; fi`673 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-thread .Tpo concurrency/$(DEPDIR)/libcfa_d_a-thread.Po674 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/thread .c' object='concurrency/libcfa_d_a-thread.obj' libtool=no @AMDEPBACKSLASH@675 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 676 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-thread .obj `if test -f 'concurrency/thread.c'; then $(CYGPATH_W) 'concurrency/thread.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/thread.c'; fi`651 concurrency/libcfa_d_a-coroutines.o: concurrency/coroutines.c 652 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-coroutines.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Tpo -c -o concurrency/libcfa_d_a-coroutines.o `test -f 'concurrency/coroutines.c' || echo '$(srcdir)/'`concurrency/coroutines.c 653 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Tpo concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Po 654 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/coroutines.c' object='concurrency/libcfa_d_a-coroutines.o' libtool=no @AMDEPBACKSLASH@ 655 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 656 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-coroutines.o `test -f 'concurrency/coroutines.c' || echo '$(srcdir)/'`concurrency/coroutines.c 657 658 concurrency/libcfa_d_a-coroutines.obj: concurrency/coroutines.c 659 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-coroutines.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Tpo -c -o concurrency/libcfa_d_a-coroutines.obj `if test -f 'concurrency/coroutines.c'; then $(CYGPATH_W) 'concurrency/coroutines.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutines.c'; fi` 660 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Tpo concurrency/$(DEPDIR)/libcfa_d_a-coroutines.Po 661 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/coroutines.c' object='concurrency/libcfa_d_a-coroutines.obj' libtool=no @AMDEPBACKSLASH@ 662 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 663 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-coroutines.obj `if test -f 'concurrency/coroutines.c'; then $(CYGPATH_W) 'concurrency/coroutines.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutines.c'; fi` 664 665 concurrency/libcfa_d_a-threads.o: concurrency/threads.c 666 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-threads.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-threads.Tpo -c -o concurrency/libcfa_d_a-threads.o `test -f 'concurrency/threads.c' || echo '$(srcdir)/'`concurrency/threads.c 667 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-threads.Tpo concurrency/$(DEPDIR)/libcfa_d_a-threads.Po 668 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/threads.c' object='concurrency/libcfa_d_a-threads.o' libtool=no @AMDEPBACKSLASH@ 669 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 670 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-threads.o `test -f 'concurrency/threads.c' || echo '$(srcdir)/'`concurrency/threads.c 671 672 concurrency/libcfa_d_a-threads.obj: concurrency/threads.c 673 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_d_a-threads.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_d_a-threads.Tpo -c -o concurrency/libcfa_d_a-threads.obj `if test -f 'concurrency/threads.c'; then $(CYGPATH_W) 'concurrency/threads.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/threads.c'; fi` 674 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_d_a-threads.Tpo concurrency/$(DEPDIR)/libcfa_d_a-threads.Po 675 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/threads.c' object='concurrency/libcfa_d_a-threads.obj' libtool=no @AMDEPBACKSLASH@ 676 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 677 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_d_a-threads.obj `if test -f 'concurrency/threads.c'; then $(CYGPATH_W) 'concurrency/threads.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/threads.c'; fi` 677 678 678 679 concurrency/libcfa_d_a-kernel.o: concurrency/kernel.c … … 844 845 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o containers/libcfa_a-vector.obj `if test -f 'containers/vector.c'; then $(CYGPATH_W) 'containers/vector.c'; else $(CYGPATH_W) '$(srcdir)/containers/vector.c'; fi` 845 846 846 concurrency/libcfa_a-coroutine .o: concurrency/coroutine.c847 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-coroutine .o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-coroutine.Tpo -c -o concurrency/libcfa_a-coroutine.o `test -f 'concurrency/coroutine.c' || echo '$(srcdir)/'`concurrency/coroutine.c848 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-coroutine .Tpo concurrency/$(DEPDIR)/libcfa_a-coroutine.Po849 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/coroutine .c' object='concurrency/libcfa_a-coroutine.o' libtool=no @AMDEPBACKSLASH@850 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 851 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-coroutine .o `test -f 'concurrency/coroutine.c' || echo '$(srcdir)/'`concurrency/coroutine.c852 853 concurrency/libcfa_a-coroutine .obj: concurrency/coroutine.c854 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-coroutine .obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-coroutine.Tpo -c -o concurrency/libcfa_a-coroutine.obj `if test -f 'concurrency/coroutine.c'; then $(CYGPATH_W) 'concurrency/coroutine.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutine.c'; fi`855 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-coroutine .Tpo concurrency/$(DEPDIR)/libcfa_a-coroutine.Po856 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/coroutine .c' object='concurrency/libcfa_a-coroutine.obj' libtool=no @AMDEPBACKSLASH@857 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 858 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-coroutine .obj `if test -f 'concurrency/coroutine.c'; then $(CYGPATH_W) 'concurrency/coroutine.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutine.c'; fi`859 860 concurrency/libcfa_a-thread .o: concurrency/thread.c861 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-thread .o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-thread.Tpo -c -o concurrency/libcfa_a-thread.o `test -f 'concurrency/thread.c' || echo '$(srcdir)/'`concurrency/thread.c862 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-thread .Tpo concurrency/$(DEPDIR)/libcfa_a-thread.Po863 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/thread .c' object='concurrency/libcfa_a-thread.o' libtool=no @AMDEPBACKSLASH@864 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 865 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-thread .o `test -f 'concurrency/thread.c' || echo '$(srcdir)/'`concurrency/thread.c866 867 concurrency/libcfa_a-thread .obj: concurrency/thread.c868 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-thread .obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-thread.Tpo -c -o concurrency/libcfa_a-thread.obj `if test -f 'concurrency/thread.c'; then $(CYGPATH_W) 'concurrency/thread.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/thread.c'; fi`869 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-thread .Tpo concurrency/$(DEPDIR)/libcfa_a-thread.Po870 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/thread .c' object='concurrency/libcfa_a-thread.obj' libtool=no @AMDEPBACKSLASH@871 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 872 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-thread .obj `if test -f 'concurrency/thread.c'; then $(CYGPATH_W) 'concurrency/thread.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/thread.c'; fi`847 concurrency/libcfa_a-coroutines.o: concurrency/coroutines.c 848 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-coroutines.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-coroutines.Tpo -c -o concurrency/libcfa_a-coroutines.o `test -f 'concurrency/coroutines.c' || echo '$(srcdir)/'`concurrency/coroutines.c 849 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-coroutines.Tpo concurrency/$(DEPDIR)/libcfa_a-coroutines.Po 850 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/coroutines.c' object='concurrency/libcfa_a-coroutines.o' libtool=no @AMDEPBACKSLASH@ 851 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 852 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-coroutines.o `test -f 'concurrency/coroutines.c' || echo '$(srcdir)/'`concurrency/coroutines.c 853 854 concurrency/libcfa_a-coroutines.obj: concurrency/coroutines.c 855 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-coroutines.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-coroutines.Tpo -c -o concurrency/libcfa_a-coroutines.obj `if test -f 'concurrency/coroutines.c'; then $(CYGPATH_W) 'concurrency/coroutines.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutines.c'; fi` 856 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-coroutines.Tpo concurrency/$(DEPDIR)/libcfa_a-coroutines.Po 857 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/coroutines.c' object='concurrency/libcfa_a-coroutines.obj' libtool=no @AMDEPBACKSLASH@ 858 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 859 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-coroutines.obj `if test -f 'concurrency/coroutines.c'; then $(CYGPATH_W) 'concurrency/coroutines.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/coroutines.c'; fi` 860 861 concurrency/libcfa_a-threads.o: concurrency/threads.c 862 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-threads.o -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-threads.Tpo -c -o concurrency/libcfa_a-threads.o `test -f 'concurrency/threads.c' || echo '$(srcdir)/'`concurrency/threads.c 863 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-threads.Tpo concurrency/$(DEPDIR)/libcfa_a-threads.Po 864 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/threads.c' object='concurrency/libcfa_a-threads.o' libtool=no @AMDEPBACKSLASH@ 865 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 866 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-threads.o `test -f 'concurrency/threads.c' || echo '$(srcdir)/'`concurrency/threads.c 867 868 concurrency/libcfa_a-threads.obj: concurrency/threads.c 869 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT concurrency/libcfa_a-threads.obj -MD -MP -MF concurrency/$(DEPDIR)/libcfa_a-threads.Tpo -c -o concurrency/libcfa_a-threads.obj `if test -f 'concurrency/threads.c'; then $(CYGPATH_W) 'concurrency/threads.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/threads.c'; fi` 870 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) concurrency/$(DEPDIR)/libcfa_a-threads.Tpo concurrency/$(DEPDIR)/libcfa_a-threads.Po 871 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='concurrency/threads.c' object='concurrency/libcfa_a-threads.obj' libtool=no @AMDEPBACKSLASH@ 872 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 873 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o concurrency/libcfa_a-threads.obj `if test -f 'concurrency/threads.c'; then $(CYGPATH_W) 'concurrency/threads.c'; else $(CYGPATH_W) '$(srcdir)/concurrency/threads.c'; fi` 873 874 874 875 concurrency/libcfa_a-kernel.o: concurrency/kernel.c -
src/libcfa/concurrency/invoke.c
r9b443c7f r5a3ac84 29 29 30 30 extern void __suspend_internal(void); 31 extern void __thread_signal_termination(struct thread _desc*);31 extern void __thread_signal_termination(struct thread*); 32 32 33 33 void CtxInvokeCoroutine( 34 34 void (*main)(void *), 35 struct coroutine _desc*(*get_coroutine)(void *),35 struct coroutine *(*get_coroutine)(void *), 36 36 void *this 37 37 ) { 38 38 // LIB_DEBUG_PRINTF("Invoke Coroutine : Received %p (main %p, get_c %p)\n", this, main, get_coroutine); 39 39 40 struct coroutine _desc* cor = get_coroutine( this );40 struct coroutine* cor = get_coroutine( this ); 41 41 42 42 if(cor->state == Primed) { … … 57 57 void CtxInvokeThread( 58 58 void (*main)(void *), 59 struct thread _desc*(*get_thread)(void *),59 struct thread *(*get_thread)(void *), 60 60 void *this 61 61 ) { 62 62 __suspend_internal(); 63 63 64 struct thread _desc* thrd = get_thread( this );65 struct coroutine _desc* cor = &thrd->c;64 struct thread* thrd = get_thread( this ); 65 struct coroutine* cor = &thrd->c; 66 66 cor->state = Active; 67 67 … … 79 79 void CtxStart( 80 80 void (*main)(void *), 81 struct coroutine _desc*(*get_coroutine)(void *),81 struct coroutine *(*get_coroutine)(void *), 82 82 void *this, 83 83 void (*invoke)(void *) -
src/libcfa/concurrency/invoke.h
r9b443c7f r5a3ac84 35 35 36 36 struct simple_thread_list { 37 struct thread _desc* head;38 struct thread _desc** tail;37 struct thread * head; 38 struct thread ** tail; 39 39 }; 40 40 … … 48 48 extern "Cforall" { 49 49 void ?{}( struct simple_thread_list * ); 50 void append( struct simple_thread_list *, struct thread _desc* );51 struct thread _desc* pop_head( struct simple_thread_list * );50 void append( struct simple_thread_list *, struct thread * ); 51 struct thread * pop_head( struct simple_thread_list * ); 52 52 53 53 void ?{}(spinlock * this); … … 71 71 enum coroutine_state { Halted, Start, Inactive, Active, Primed }; 72 72 73 struct coroutine _desc{73 struct coroutine { 74 74 struct coStack_t stack; 75 75 const char *name; // textual name for coroutine/task, initialized by uC++ generated code 76 76 int errno_; // copy of global UNIX variable errno 77 77 enum coroutine_state state; // current execution status for coroutine 78 struct coroutine _desc*starter; // first coroutine to resume this one79 struct coroutine _desc*last; // last coroutine to resume this one78 struct coroutine *starter; // first coroutine to resume this one 79 struct coroutine *last; // last coroutine to resume this one 80 80 }; 81 81 82 struct thread _desc{83 struct coroutine _descc; // coroutine body used to store context82 struct thread { 83 struct coroutine c; // coroutine body used to store context 84 84 struct signal_once terminated; // indicate if execuation state is not halted 85 struct thread _desc* next; // instrusive link field for threads85 struct thread * next; // instrusive link field for threads 86 86 }; 87 87 -
src/libcfa/concurrency/kernel
r9b443c7f r5a3ac84 6 6 // file "LICENCE" distributed with Cforall. 7 7 // 8 // kernel--8 // threads -- 9 9 // 10 10 // Author : Thierry Delisle … … 49 49 struct FinishAction { 50 50 FinishOpCode action_code; 51 thread _desc* thrd;51 thread * thrd; 52 52 spinlock * lock; 53 53 }; … … 62 62 struct processorCtx_t * runner; 63 63 cluster * cltr; 64 coroutine _desc* current_coroutine;65 thread _desc* current_thread;64 coroutine * current_coroutine; 65 thread * current_thread; 66 66 pthread_t kernel_thread; 67 67 -
src/libcfa/concurrency/kernel.c
r9b443c7f r5a3ac84 43 43 KERNEL_STORAGE(cluster, systemCluster); 44 44 KERNEL_STORAGE(processor, systemProcessor); 45 KERNEL_STORAGE(thread _desc, mainThread);45 KERNEL_STORAGE(thread, mainThread); 46 46 KERNEL_STORAGE(machine_context_t, mainThread_context); 47 47 48 48 cluster * systemCluster; 49 49 processor * systemProcessor; 50 thread _desc* mainThread;50 thread * mainThread; 51 51 52 52 //----------------------------------------------------------------------------- … … 55 55 thread_local processor * this_processor; 56 56 57 coroutine_desc * this_coroutine(void) { 57 processor * get_this_processor() { 58 return this_processor; 59 } 60 61 coroutine * this_coroutine(void) { 58 62 return this_processor->current_coroutine; 59 63 } 60 64 61 thread _desc* this_thread(void) {65 thread * this_thread(void) { 62 66 return this_processor->current_thread; 63 67 } … … 99 103 } 100 104 101 void ?{}( coroutine _desc* this, current_stack_info_t * info) {105 void ?{}( coroutine * this, current_stack_info_t * info) { 102 106 (&this->stack){ info }; 103 107 this->name = "Main Thread"; … … 106 110 } 107 111 108 void ?{}( thread _desc* this, current_stack_info_t * info) {112 void ?{}( thread * this, current_stack_info_t * info) { 109 113 (&this->c){ info }; 110 114 } … … 175 179 LIB_DEBUG_PRINTF("Kernel : core %p starting\n", this); 176 180 177 thread _desc* readyThread = NULL;181 thread * readyThread = NULL; 178 182 for( unsigned int spin_count = 0; ! this->is_terminated; spin_count++ ) 179 183 { … … 202 206 // runThread runs a thread by context switching 203 207 // from the processor coroutine to the target thread 204 void runThread(processor * this, thread _desc* dst) {205 coroutine _desc* proc_cor = get_coroutine(this->runner);206 coroutine _desc* thrd_cor = get_coroutine(dst);208 void runThread(processor * this, thread * dst) { 209 coroutine * proc_cor = get_coroutine(this->runner); 210 coroutine * thrd_cor = get_coroutine(dst); 207 211 208 212 //Reset the terminating actions here … … 293 297 //----------------------------------------------------------------------------- 294 298 // Scheduler routines 295 void ScheduleThread( thread _desc* thrd ) {299 void ScheduleThread( thread * thrd ) { 296 300 assertf( thrd->next == NULL, "Expected null got %p", thrd->next ); 297 301 … … 301 305 } 302 306 303 thread _desc* nextThread(cluster * this) {307 thread * nextThread(cluster * this) { 304 308 lock( &this->lock ); 305 thread _desc* head = pop_head( &this->ready_queue );309 thread * head = pop_head( &this->ready_queue ); 306 310 unlock( &this->lock ); 307 311 return head; … … 313 317 314 318 void ScheduleInternal( spinlock * lock ) { 315 this_processor->finish.action_code = Release;316 this_processor->finish.lock = lock;319 get_this_processor()->finish.action_code = Release; 320 get_this_processor()->finish.lock = lock; 317 321 suspend(); 318 322 } 319 323 320 void ScheduleInternal( thread _desc* thrd ) {321 this_processor->finish.action_code = Schedule;322 this_processor->finish.thrd = thrd;324 void ScheduleInternal( thread * thrd ) { 325 get_this_processor()->finish.action_code = Schedule; 326 get_this_processor()->finish.thrd = thrd; 323 327 suspend(); 324 328 } 325 329 326 void ScheduleInternal( spinlock * lock, thread _desc* thrd ) {327 this_processor->finish.action_code = Release_Schedule;328 this_processor->finish.lock = lock;329 this_processor->finish.thrd = thrd;330 void ScheduleInternal( spinlock * lock, thread * thrd ) { 331 get_this_processor()->finish.action_code = Release_Schedule; 332 get_this_processor()->finish.lock = lock; 333 get_this_processor()->finish.thrd = thrd; 330 334 suspend(); 331 335 } … … 339 343 // SKULLDUGGERY: the mainThread steals the process main thread 340 344 // which will then be scheduled by the systemProcessor normally 341 mainThread = (thread _desc*)&mainThread_storage;345 mainThread = (thread *)&mainThread_storage; 342 346 current_stack_info_t info; 343 347 mainThread{ &info }; … … 436 440 this->condition = true; 437 441 438 thread _desc* it;442 thread * it; 439 443 while( it = pop_head( &this->blocked) ) { 440 444 ScheduleThread( it ); … … 451 455 } 452 456 453 void append( simple_thread_list * this, thread _desc* t ) {457 void append( simple_thread_list * this, thread * t ) { 454 458 assert(this->tail != NULL); 455 459 *this->tail = t; … … 457 461 } 458 462 459 thread _desc* pop_head( simple_thread_list * this ) {460 thread _desc* head = this->head;463 thread * pop_head( simple_thread_list * this ) { 464 thread * head = this->head; 461 465 if( head ) { 462 466 this->head = head->next; -
src/libcfa/concurrency/kernel_private.h
r9b443c7f r5a3ac84 6 6 // file "LICENCE" distributed with Cforall. 7 7 // 8 // kernel_private.h--8 // threads -- 9 9 // 10 10 // Author : Thierry Delisle … … 19 19 20 20 #include "kernel" 21 #include "thread "21 #include "threads" 22 22 23 23 //----------------------------------------------------------------------------- 24 24 // Scheduler 25 void ScheduleThread( thread _desc* );26 thread _desc* nextThread(cluster * this);25 void ScheduleThread( thread * ); 26 thread * nextThread(cluster * this); 27 27 28 28 void ScheduleInternal(); 29 29 void ScheduleInternal(spinlock * lock); 30 void ScheduleInternal(thread _desc* thrd);31 void ScheduleInternal(spinlock * lock, thread _desc* thrd);30 void ScheduleInternal(thread * thrd); 31 void ScheduleInternal(spinlock * lock, thread * thrd); 32 32 33 33 //----------------------------------------------------------------------------- … … 35 35 struct processorCtx_t { 36 36 processor * proc; 37 coroutine _descc;37 coroutine c; 38 38 }; 39 39 … … 42 42 void main(processorCtx_t *); 43 43 void start(processor * this); 44 void runThread(processor * this, thread _desc* dst);44 void runThread(processor * this, thread * dst); 45 45 void finishRunning(processor * this); 46 46 void spin(processor * this, unsigned int * spin_count); … … 53 53 } 54 54 55 extern void ThreadCtxSwitch(coroutine _desc * src, coroutine_desc* dst);55 extern void ThreadCtxSwitch(coroutine * src, coroutine * dst); 56 56 57 57 #endif //KERNEL_PRIVATE_H -
src/libcfa/concurrency/monitor
r9b443c7f r5a3ac84 22 22 #include "stdlib" 23 23 24 struct monitor_desc{24 struct __monitor_t { 25 25 spinlock lock; 26 thread _desc* owner;26 thread * owner; 27 27 simple_thread_list entry_queue; 28 28 unsigned int recursion; 29 29 }; 30 30 31 static inline void ?{}( monitor_desc* this) {31 static inline void ?{}(__monitor_t * this) { 32 32 this->owner = 0; 33 33 this->recursion = 0; … … 35 35 36 36 //Basic entering routine 37 void enter( monitor_desc*);38 void leave( monitor_desc*);37 void enter(__monitor_t *); 38 void leave(__monitor_t *); 39 39 40 40 //Array entering routine 41 void enter( monitor_desc**, int count);42 void leave( monitor_desc**, int count);41 void enter(__monitor_t **, int count); 42 void leave(__monitor_t **, int count); 43 43 44 44 struct monitor_guard_t { 45 monitor_desc** m;45 __monitor_t ** m; 46 46 int count; 47 47 }; 48 48 49 static inline int ?<?( monitor_desc* lhs, monitor_desc* rhs) {49 static inline int ?<?(__monitor_t* lhs, __monitor_t* rhs) { 50 50 return ((intptr_t)lhs) < ((intptr_t)rhs); 51 51 } 52 52 53 static inline void ?{}( monitor_guard_t * this, monitor_desc** m ) {53 static inline void ?{}( monitor_guard_t * this, __monitor_t ** m ) { 54 54 this->m = m; 55 55 this->count = 1; … … 57 57 } 58 58 59 static inline void ?{}( monitor_guard_t * this, monitor_desc** m, int count ) {59 static inline void ?{}( monitor_guard_t * this, __monitor_t ** m, int count ) { 60 60 this->m = m; 61 61 this->count = count; -
src/libcfa/concurrency/monitor.c
r9b443c7f r5a3ac84 6 6 // file "LICENCE" distributed with Cforall. 7 7 // 8 // monitor_desc.c --8 // __monitor_t.c -- 9 9 // 10 10 // Author : Thierry Delisle … … 19 19 #include "kernel_private.h" 20 20 21 void enter( monitor_desc* this) {21 void enter(__monitor_t * this) { 22 22 lock( &this->lock ); 23 thread _desc* thrd = this_thread();23 thread * thrd = this_thread(); 24 24 25 25 if( !this->owner ) { … … 45 45 } 46 46 47 void leave( monitor_desc* this) {47 void leave(__monitor_t * this) { 48 48 lock( &this->lock ); 49 49 50 thread _desc* thrd = this_thread();50 thread * thrd = this_thread(); 51 51 assert( thrd == this->owner ); 52 52 … … 55 55 56 56 //If we left the last level of recursion it means we are changing who owns the monitor 57 thread _desc* new_owner = 0;57 thread * new_owner = 0; 58 58 if( this->recursion == 0) { 59 59 //Get the next thread in the list … … 72 72 } 73 73 74 void enter( monitor_desc** monitors, int count) {74 void enter(__monitor_t ** monitors, int count) { 75 75 for(int i = 0; i < count; i++) { 76 76 // printf("%d\n", i); … … 79 79 } 80 80 81 void leave( monitor_desc** monitors, int count) {81 void leave(__monitor_t ** monitors, int count) { 82 82 for(int i = count - 1; i >= 0; i--) { 83 83 // printf("%d\n", i); -
src/main.cc
r9b443c7f r5a3ac84 32 32 #include "GenPoly/CopyParams.h" 33 33 #include "GenPoly/InstantiateGeneric.h" 34 #include "Concurrency/Keywords.h"35 34 #include "CodeGen/Generate.h" 36 35 #include "CodeGen/FixNames.h" … … 237 236 OPTPRINT( "mutate" ) 238 237 ControlStruct::mutate( translationUnit ); 239 OPTPRINT( "Concurrency" )240 Concurrency::applyKeywords( translationUnit );241 238 OPTPRINT( "fixNames" ) 242 239 CodeGen::fixNames( translationUnit ); -
src/tests/coroutine.c
r9b443c7f r5a3ac84 1 1 #include <fstream> 2 #include <coroutine >2 #include <coroutines> 3 3 4 4 struct Fibonacci { 5 5 int fn; // used for communication 6 coroutine _descc;6 coroutine c; 7 7 }; 8 8 … … 11 11 } 12 12 13 coroutine _desc* get_coroutine(Fibonacci* this) {13 coroutine* get_coroutine(Fibonacci* this) { 14 14 return &this->c; 15 15 } … … 47 47 #ifdef MORE_DEBUG 48 48 Fibonacci *pf1 = &f1, *pf2 = &f2; 49 coroutine _desc*cf1 = &f1.c, *cf2 = &f2.c;49 coroutine *cf1 = &f1.c, *cf2 = &f2.c; 50 50 covptr_t *vf1 = vtable(pf1), *vf2 = vtable(pf2); 51 coroutine _desc*cv1 = get_coroutine(vf1), *cv2 = get_coroutine(vf2);51 coroutine *cv1 = get_coroutine(vf1), *cv2 = get_coroutine(vf2); 52 52 Fibonacci *ov1 = (Fibonacci *)get_object(vf1), *ov2 = (Fibonacci *)get_object(vf2); 53 53 -
src/tests/monitor.c
r9b443c7f r5a3ac84 2 2 #include <kernel> 3 3 #include <monitor> 4 #include <thread >4 #include <threads> 5 5 6 6 struct global_t { 7 7 int value; 8 monitor_descm;8 __monitor_t m; 9 9 }; 10 10 … … 16 16 17 17 void increment( /*mutex*/ global_t * this ) { 18 monitor_desc* mon = &this->m;18 __monitor_t * mon = &this->m; 19 19 monitor_guard_t g1 = { &mon }; 20 20 { … … 27 27 } 28 28 29 struct MyThread { thread _desct; };29 struct MyThread { thread t; }; 30 30 31 31 DECL_THREAD(MyThread); -
src/tests/multi-monitor.c
r9b443c7f r5a3ac84 2 2 #include <kernel> 3 3 #include <monitor> 4 #include <thread >4 #include <threads> 5 5 6 6 static int global12, global23, global13; 7 7 8 static monitor_descm1, m2, m3;8 static __monitor_t m1, m2, m3; 9 9 10 void increment( /*mutex*/ monitor_desc * p1, /*mutex*/ monitor_desc* p2, int * value ) {11 monitor_desc* mons[] = { p1, p2 };10 void increment( /*mutex*/ __monitor_t * p1, /*mutex*/ __monitor_t * p2, int * value ) { 11 __monitor_t * mons[] = { p1, p2 }; 12 12 monitor_guard_t g = { mons, 2 }; 13 13 *value += 1; … … 15 15 16 16 struct MyThread { 17 thread _desct;17 thread t; 18 18 int target; 19 19 }; -
src/tests/test.py
r9b443c7f r5a3ac84 250 250 parser = argparse.ArgumentParser(description='Script which runs cforall tests') 251 251 parser.add_argument('--debug', help='Run all tests in debug or release', type=yes_no, default='no') 252 parser.add_argument('--concurrent', help='Run concurrent tests', type=yes_no, default=' yes')252 parser.add_argument('--concurrent', help='Run concurrent tests', type=yes_no, default='no') 253 253 parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true') 254 254 parser.add_argument('--list', help='List all test available', action='store_true') -
src/tests/thread.c
r9b443c7f r5a3ac84 2 2 #include <kernel> 3 3 #include <stdlib> 4 #include <thread >4 #include <threads> 5 5 6 struct First { thread _desct; signal_once* lock; };7 struct Second { thread _desct; signal_once* lock; };6 struct First { thread t; signal_once* lock; }; 7 struct Second { thread t; signal_once* lock; }; 8 8 9 9 DECL_THREAD(First);
Note:
See TracChangeset
for help on using the changeset viewer.