Changeset 67a1c67
- Timestamp:
- Aug 31, 2022, 2:03:03 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation
- Children:
- 9d67a6d
- Parents:
- 38a238d (diff), 594e1db (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 25 deleted
- 21 edited
- 21 moved
Legend:
- Unmodified
- Added
- Removed
-
benchmark/basic/tls_fetch_add.c
r38a238d r67a1c67 7 7 // thread_local Boolean. This means the entire protocol is just to "mov" instructions making it extremely cheap. 8 8 9 #define thread_local _Thread_local 10 11 thread_local volatile bool value; 9 __thread volatile bool value; 12 10 13 11 void __attribute__((noinline)) do_call() { -
doc/LaTeXmacros/lstlang.sty
r38a238d r67a1c67 118 118 inline, __inline, __inline__, __int128, int128, __label__, monitor, mutex, _Noreturn, one_t, or, 119 119 otype, restrict, __restrict, __restrict__, recover, report, __signed, __signed__, _Static_assert, suspend, 120 thread, _ Thread_local, throw, throwResume, timeout, trait, try, ttype, typeof, __typeof, __typeof__,120 thread, __thread, _Thread_local, throw, throwResume, timeout, trait, try, ttype, typeof, __typeof, __typeof__, 121 121 virtual, __volatile, __volatile__, waitfor, when, with, zero_t, 122 122 }, -
libcfa/src/concurrency/kernel/fwd.hfa
r38a238d r67a1c67 35 35 extern "C" { 36 36 extern "Cforall" { 37 extern __attribute__((aligned(64))) _ Thread_localstruct KernelThreadData {37 extern __attribute__((aligned(64))) __thread struct KernelThreadData { 38 38 struct thread$ * volatile this_thread; 39 39 struct processor * volatile this_processor; -
libcfa/src/concurrency/kernel/private.hfa
r38a238d r67a1c67 88 88 #elif defined(CFA_HAVE_LINUX_RSEQ_H) 89 89 extern "Cforall" { 90 extern __attribute__((aligned(64))) _ Thread_localvolatile struct rseq __cfaabi_rseq;90 extern __attribute__((aligned(64))) __thread volatile struct rseq __cfaabi_rseq; 91 91 } 92 92 #else -
libcfa/src/concurrency/kernel/startup.cfa
r38a238d r67a1c67 133 133 //----------------------------------------------------------------------------- 134 134 // Global state 135 _ Thread_localstruct KernelThreadData __cfaabi_tls __attribute__ ((tls_model ( "initial-exec" ))) @= {135 __thread struct KernelThreadData __cfaabi_tls __attribute__ ((tls_model ( "initial-exec" ))) @= { 136 136 NULL, // cannot use 0p 137 137 NULL, … … 153 153 #elif defined(CFA_HAVE_LINUX_RSEQ_H) 154 154 extern "Cforall" { 155 __attribute__((aligned(64))) _ Thread_localvolatile struct rseq __cfaabi_rseq @= {155 __attribute__((aligned(64))) __thread volatile struct rseq __cfaabi_rseq @= { 156 156 .cpu_id : RSEQ_CPU_ID_UNINITIALIZED, 157 157 }; -
libcfa/src/concurrency/preemption.cfa
r38a238d r67a1c67 666 666 // Kernel Signal Handlers 667 667 //============================================================================================= 668 __cfaabi_dbg_debug_do( static _ Thread_localvoid * last_interrupt = 0; )668 __cfaabi_dbg_debug_do( static __thread void * last_interrupt = 0; ) 669 669 670 670 // Context switch signal handler -
src/AST/Print.cpp
r38a238d r67a1c67 86 86 87 87 static constexpr auto StorageClasses = make_array<const char*>( 88 "extern", "static", "auto", "register", "_ Thread_local"88 "extern", "static", "auto", "register", "__thread", "_Thread_local" 89 89 ); 90 90 … … 215 215 ++indent; 216 216 ptrToEnum->base->accept( *this ); 217 --indent; 217 --indent; 218 218 } 219 219 … … 1623 1623 // if the wrong size is specified 1624 1624 constexpr array<const char*, 3> Printer::Names::FuncSpecifiers; 1625 constexpr array<const char*, 5> Printer::Names::StorageClasses;1625 constexpr array<const char*, 6> Printer::Names::StorageClasses; 1626 1626 constexpr array<const char*, 6> Printer::Names::Qualifiers; 1627 1627 } -
src/AST/StorageClasses.hpp
r38a238d r67a1c67 24 24 /// Bitflags for storage classes 25 25 enum { 26 Extern = 1 << 0, 27 Static = 1 << 1, 28 Auto = 1 << 2, 29 Register = 1 << 3, 30 ThreadLocal = 1 << 4, 31 NumClasses = 5 26 Extern = 1 << 0, 27 Static = 1 << 1, 28 Auto = 1 << 2, 29 Register = 1 << 3, 30 ThreadLocalGcc = 1 << 4, 31 ThreadLocalC11 = 1 << 5, 32 NumClasses = 6 32 33 }; 33 34 … … 37 38 unsigned int val; 38 39 struct { 39 bool is_extern : 1; 40 bool is_static : 1; 41 bool is_auto : 1; 42 bool is_register : 1; 43 bool is_threadlocal : 1; 40 bool is_extern : 1; 41 bool is_static : 1; 42 bool is_auto : 1; 43 bool is_register : 1; 44 bool is_threadlocalGcc : 1; 45 bool is_threadlocalC11 : 1; 44 46 }; 45 47 … … 48 50 49 51 constexpr class_flags( unsigned int val = 0 ) : val(val) {} 52 53 bool is_threadlocal_any() { return this->is_threadlocalC11 || this->is_threadlocalGcc; } 50 54 }; 51 55 -
src/InitTweak/InitTweak.cc
r38a238d r67a1c67 1241 1241 static const char * const tlsd_section = ".tdata" ASM_COMMENT; 1242 1242 void addDataSectionAttribute( ObjectDecl * objDecl ) { 1243 const bool is_tls = objDecl->get_storageClasses().is_threadlocal ;1243 const bool is_tls = objDecl->get_storageClasses().is_threadlocal_any(); 1244 1244 const char * section = is_tls ? tlsd_section : data_section; 1245 1245 objDecl->attributes.push_back(new Attribute("section", { … … 1249 1249 1250 1250 void addDataSectionAttribute( ast::ObjectDecl * objDecl ) { 1251 const bool is_tls = objDecl->storage.is_threadlocal ;1251 const bool is_tls = objDecl->storage.is_threadlocal_any(); 1252 1252 const char * section = is_tls ? tlsd_section : data_section; 1253 1253 objDecl->attributes.push_back(new ast::Attribute("section", { -
src/Parser/DeclarationNode.cc
r38a238d r67a1c67 262 262 newnode->type->enumeration.anon = name == nullptr; 263 263 if ( base && base->type) { 264 newnode->type->base = base->type; 264 newnode->type->base = base->type; 265 265 } // if 266 266 … … 505 505 } // for 506 506 // src is the new item being added and has a single bit 507 } else if ( ! src->storageClasses.is_threadlocal ) { // conflict ?507 } else if ( ! src->storageClasses.is_threadlocal_any() ) { // conflict ? 508 508 appendError( error, string( "conflicting " ) + Type::StorageClassesNames[storageClasses.ffs()] + 509 509 " & " + Type::StorageClassesNames[src->storageClasses.ffs()] ); -
src/Parser/lex.ll
r38a238d r67a1c67 314 314 switch { KEYWORD_RETURN(SWITCH); } 315 315 thread { KEYWORD_RETURN(THREAD); } // C11 316 __thread { KEYWORD_RETURN(THREADLOCAL ); } // GCC317 _Thread_local { KEYWORD_RETURN(THREADLOCAL ); } // C11316 __thread { KEYWORD_RETURN(THREADLOCALGCC); } // GCC 317 _Thread_local { KEYWORD_RETURN(THREADLOCALC11); } // C11 318 318 throw { KEYWORD_RETURN(THROW); } // CFA 319 319 throwResume { KEYWORD_RETURN(THROWRESUME); } // CFA -
src/Parser/parser.yy
r38a238d r67a1c67 293 293 %token TYPEDEF 294 294 %token EXTERN STATIC AUTO REGISTER 295 %token THREADLOCAL //C11295 %token THREADLOCALGCC THREADLOCALC11 // GCC, C11 296 296 %token INLINE FORTRAN // C99, extension ISO/IEC 9899:1999 Section J.5.9(1) 297 297 %token NORETURN // C11 … … 1345 1345 { 1346 1346 if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; } 1347 else { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1347 else { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1348 1348 } 1349 1349 | comma_expression updowneq comma_expression '~' comma_expression // CFA, anonymous loop-index … … 1357 1357 { 1358 1358 if ( $2 == OperKinds::LThan || $2 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; } 1359 else { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1359 else { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; } 1360 1360 } 1361 1361 | comma_expression updowneq comma_expression '~' '@' // CFA, error … … 2082 2082 | REGISTER 2083 2083 { $$ = DeclarationNode::newStorageClass( Type::Register ); } 2084 | THREADLOCAL // C11 2085 { $$ = DeclarationNode::newStorageClass( Type::Threadlocal ); } 2084 | THREADLOCALGCC // GCC 2085 { $$ = DeclarationNode::newStorageClass( Type::ThreadlocalGcc ); } 2086 | THREADLOCALC11 // C11 2087 { $$ = DeclarationNode::newStorageClass( Type::ThreadlocalC11 ); } 2086 2088 // Put function specifiers here to simplify parsing rules, but separate them semantically. 2087 2089 | INLINE // C99 -
src/SynTree/Type.cc
r38a238d r67a1c67 80 80 // These must remain in the same order as the corresponding bit fields. 81 81 const char * Type::FuncSpecifiersNames[] = { "inline", "_Noreturn", "fortran" }; 82 const char * Type::StorageClassesNames[] = { "extern", "static", "auto", "register", "_ Thread_local" };82 const char * Type::StorageClassesNames[] = { "extern", "static", "auto", "register", "__thread", "_Thread_local" }; 83 83 const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "mutex", "_Atomic" }; 84 84 -
src/SynTree/Type.h
r38a238d r67a1c67 84 84 }; // FuncSpecifiers 85 85 86 enum { Extern = 1 << 0, Static = 1 << 1, Auto = 1 << 2, Register = 1 << 3, Threadlocal = 1 << 4, NumStorageClass = 5};86 enum { Extern = 1 << 0, Static = 1 << 1, Auto = 1 << 2, Register = 1 << 3, ThreadlocalGcc = 1 << 4, ThreadlocalC11 = 1 << 5, NumStorageClass = 6 }; 87 87 static const char * StorageClassesNames[]; 88 88 union StorageClasses { … … 93 93 bool is_auto : 1; 94 94 bool is_register : 1; 95 bool is_threadlocal : 1; 95 bool is_threadlocalGcc : 1; 96 bool is_threadlocalC11 : 1; 96 97 }; 97 98 … … 100 101 // equality (==, !=) works implicitly on first field "val", relational operations are undefined. 101 102 BFCommon( StorageClasses, NumStorageClass ) 103 104 bool is_threadlocal_any() { return this->is_threadlocalC11 || this->is_threadlocalGcc; } 102 105 }; // StorageClasses 103 106 -
tests/.expect/declarationSpecifier.arm64.txt
r38a238d r67a1c67 735 735 } 736 736 static volatile const struct __anonymous15 _X3x36KVS13__anonymous15_1; 737 _Thread_local signed int _X3x37i_1; 738 __thread signed int _X3x38i_1; 737 739 static inline volatile const signed int _X3f11Fi___1(); 738 740 static inline volatile const signed int _X3f12Fi___1(); -
tests/.expect/declarationSpecifier.x64.txt
r38a238d r67a1c67 735 735 } 736 736 static volatile const struct __anonymous15 _X3x36KVS13__anonymous15_1; 737 _Thread_local signed int _X3x37i_1; 738 __thread signed int _X3x38i_1; 737 739 static inline volatile const signed int _X3f11Fi___1(); 738 740 static inline volatile const signed int _X3f12Fi___1(); -
tests/.expect/declarationSpecifier.x86.txt
r38a238d r67a1c67 735 735 } 736 736 static volatile const struct __anonymous15 _X3x36KVS13__anonymous15_1; 737 _Thread_local signed int _X3x37i_1; 738 __thread signed int _X3x38i_1; 737 739 static inline volatile const signed int _X3f11Fi___1(); 738 740 static inline volatile const signed int _X3f12Fi___1(); -
tests/concurrent/clib_tls.c
r38a238d r67a1c67 14 14 15 15 16 _ Thread_localint checkval = 0xBAADF00D;16 __thread int checkval = 0xBAADF00D; 17 17 18 18 void init(void * ) { -
tests/concurrent/park/contention.cfa
r38a238d r67a1c67 2 2 #include <thread.hfa> 3 3 4 _ Thread_localdrand48_data buffer = { 0 };4 __thread drand48_data buffer = { 0 }; 5 5 int myrand() { 6 6 long int result; -
tests/declarationSpecifier.cfa
r38a238d r67a1c67 1 // 1 // 2 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo 3 3 // 4 4 // The contents of this file are covered under the licence agreement in the 5 5 // file "LICENCE" distributed with Cforall. 6 // 7 // declarationSpecifier.cfa -- 8 // 6 // 7 // declarationSpecifier.cfa -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Wed Aug 17 08:21:04 2016 … … 12 12 // Last Modified On : Tue Apr 30 18:20:36 2019 13 13 // Update Count : 4 14 // 14 // 15 15 16 16 typedef short int Int; … … 51 51 struct { Int i; } const static volatile x35; 52 52 struct { Int i; } const volatile static x36; 53 54 _Thread_local int x37; 55 __thread int x38; 53 56 54 57 static inline const volatile int f11(); -
tests/quotedKeyword.cfa
r38a238d r67a1c67 31 31 ``__int128, ``__label__, ``long, ``lvalue, ``_Noreturn, ``__builtin_offsetof, ``otype, ``register, ``restrict, 32 32 ``__restrict, ``__restrict__, ``return, ``short, ``signed, ``__signed, ``__signed__, ``sizeof, ``static, 33 ``_Static_assert, ``struct, ``switch, ``_ Thread_local, ``throw, ``throwResume, ``trait, ``try, ``typedef,33 ``_Static_assert, ``struct, ``switch, ``_thread, ``_Thread_local, ``throw, ``throwResume, ``trait, ``try, ``typedef, 34 34 ``typeof, ``__typeof, ``__typeof__, ``union, ``unsigned, ``__builtin_va_list, ``void, ``volatile, ``__volatile, 35 35 ``__volatile__, ``while;
Note: See TracChangeset
for help on using the changeset viewer.