Changeset 67a1c67


Ignore:
Timestamp:
Aug 31, 2022, 2:03:03 PM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
25 deleted
21 edited
21 moved

Legend:

Unmodified
Added
Removed
  • benchmark/basic/tls_fetch_add.c

    r38a238d r67a1c67  
    77// thread_local Boolean. This means the entire protocol is just to "mov" instructions making it extremely cheap.
    88
    9 #define thread_local _Thread_local
    10 
    11 thread_local volatile bool value;
     9__thread volatile bool value;
    1210
    1311void __attribute__((noinline)) do_call() {
  • doc/LaTeXmacros/lstlang.sty

    r38a238d r67a1c67  
    118118                inline, __inline, __inline__, __int128, int128, __label__, monitor, mutex, _Noreturn, one_t, or,
    119119                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__,
    121121                virtual, __volatile, __volatile__, waitfor, when, with, zero_t,
    122122    },
  • libcfa/src/concurrency/kernel/fwd.hfa

    r38a238d r67a1c67  
    3535extern "C" {
    3636        extern "Cforall" {
    37                 extern __attribute__((aligned(64))) _Thread_local struct KernelThreadData {
     37                extern __attribute__((aligned(64))) __thread struct KernelThreadData {
    3838                        struct thread$          * volatile this_thread;
    3939                        struct processor        * volatile this_processor;
  • libcfa/src/concurrency/kernel/private.hfa

    r38a238d r67a1c67  
    8888#elif defined(CFA_HAVE_LINUX_RSEQ_H)
    8989        extern "Cforall" {
    90                 extern __attribute__((aligned(64))) _Thread_local volatile struct rseq __cfaabi_rseq;
     90                extern __attribute__((aligned(64))) __thread volatile struct rseq __cfaabi_rseq;
    9191        }
    9292#else
  • libcfa/src/concurrency/kernel/startup.cfa

    r38a238d r67a1c67  
    133133//-----------------------------------------------------------------------------
    134134// Global state
    135 _Thread_local struct KernelThreadData __cfaabi_tls __attribute__ ((tls_model ( "initial-exec" ))) @= {
     135__thread struct KernelThreadData __cfaabi_tls __attribute__ ((tls_model ( "initial-exec" ))) @= {
    136136        NULL,                                                                                           // cannot use 0p
    137137        NULL,
     
    153153#elif defined(CFA_HAVE_LINUX_RSEQ_H)
    154154        extern "Cforall" {
    155                 __attribute__((aligned(64))) _Thread_local volatile struct rseq __cfaabi_rseq @= {
     155                __attribute__((aligned(64))) __thread volatile struct rseq __cfaabi_rseq @= {
    156156                        .cpu_id : RSEQ_CPU_ID_UNINITIALIZED,
    157157                };
  • libcfa/src/concurrency/preemption.cfa

    r38a238d r67a1c67  
    666666// Kernel Signal Handlers
    667667//=============================================================================================
    668 __cfaabi_dbg_debug_do( static _Thread_local void * last_interrupt = 0; )
     668__cfaabi_dbg_debug_do( static __thread void * last_interrupt = 0; )
    669669
    670670// Context switch signal handler
  • src/AST/Print.cpp

    r38a238d r67a1c67  
    8686
    8787                static constexpr auto StorageClasses = make_array<const char*>(
    88                         "extern", "static", "auto", "register", "_Thread_local"
     88                        "extern", "static", "auto", "register", "__thread", "_Thread_local"
    8989                );
    9090
     
    215215                        ++indent;
    216216                        ptrToEnum->base->accept( *this );
    217                         --indent; 
     217                        --indent;
    218218                }
    219219
     
    16231623// if the wrong size is specified
    16241624constexpr array<const char*, 3> Printer::Names::FuncSpecifiers;
    1625 constexpr array<const char*, 5> Printer::Names::StorageClasses;
     1625constexpr array<const char*, 6> Printer::Names::StorageClasses;
    16261626constexpr array<const char*, 6> Printer::Names::Qualifiers;
    16271627}
  • src/AST/StorageClasses.hpp

    r38a238d r67a1c67  
    2424        /// Bitflags for storage classes
    2525        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
    3233        };
    3334
     
    3738                        unsigned int val;
    3839                        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;
    4446                        };
    4547
     
    4850
    4951                constexpr class_flags( unsigned int val = 0 ) : val(val) {}
     52
     53                bool is_threadlocal_any() { return this->is_threadlocalC11 || this->is_threadlocalGcc; }
    5054        };
    5155
  • src/InitTweak/InitTweak.cc

    r38a238d r67a1c67  
    12411241        static const char * const tlsd_section = ".tdata" ASM_COMMENT;
    12421242        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();
    12441244                const char * section = is_tls ? tlsd_section : data_section;
    12451245                objDecl->attributes.push_back(new Attribute("section", {
     
    12491249
    12501250        void addDataSectionAttribute( ast::ObjectDecl * objDecl ) {
    1251                 const bool is_tls = objDecl->storage.is_threadlocal;
     1251                const bool is_tls = objDecl->storage.is_threadlocal_any();
    12521252                const char * section = is_tls ? tlsd_section : data_section;
    12531253                objDecl->attributes.push_back(new ast::Attribute("section", {
  • src/Parser/DeclarationNode.cc

    r38a238d r67a1c67  
    262262        newnode->type->enumeration.anon = name == nullptr;
    263263        if ( base && base->type)  {
    264                 newnode->type->base = base->type;       
     264                newnode->type->base = base->type;
    265265        } // if
    266266
     
    505505                        } // for
    506506                        // 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 ?
    508508                        appendError( error, string( "conflicting " ) + Type::StorageClassesNames[storageClasses.ffs()] +
    509509                                                 " & " + Type::StorageClassesNames[src->storageClasses.ffs()] );
  • src/Parser/lex.ll

    r38a238d r67a1c67  
    314314switch                  { KEYWORD_RETURN(SWITCH); }
    315315thread                  { KEYWORD_RETURN(THREAD); }                             // C11
    316 __thread                { KEYWORD_RETURN(THREADLOCAL); }                // GCC
    317 _Thread_local   { KEYWORD_RETURN(THREADLOCAL); }                // C11
     316__thread                { KEYWORD_RETURN(THREADLOCALGCC); }             // GCC
     317_Thread_local   { KEYWORD_RETURN(THREADLOCALC11); }             // C11
    318318throw                   { KEYWORD_RETURN(THROW); }                              // CFA
    319319throwResume             { KEYWORD_RETURN(THROWRESUME); }                // CFA
  • src/Parser/parser.yy

    r38a238d r67a1c67  
    293293%token TYPEDEF
    294294%token EXTERN STATIC AUTO REGISTER
    295 %token THREADLOCAL                                                                              // C11
     295%token THREADLOCALGCC THREADLOCALC11                                            // GCC, C11
    296296%token INLINE FORTRAN                                                                   // C99, extension ISO/IEC 9899:1999 Section J.5.9(1)
    297297%token NORETURN                                                                                 // C11
     
    13451345                {
    13461346                        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; }
    13481348                }
    13491349        | comma_expression updowneq comma_expression '~' comma_expression // CFA, anonymous loop-index
     
    13571357                {
    13581358                        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; }
    13601360                }
    13611361        | comma_expression updowneq comma_expression '~' '@' // CFA, error
     
    20822082        | REGISTER
    20832083                { $$ = 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 ); }
    20862088                // Put function specifiers here to simplify parsing rules, but separate them semantically.
    20872089        | INLINE                                                                                        // C99
  • src/SynTree/Type.cc

    r38a238d r67a1c67  
    8080// These must remain in the same order as the corresponding bit fields.
    8181const char * Type::FuncSpecifiersNames[] = { "inline", "_Noreturn", "fortran" };
    82 const char * Type::StorageClassesNames[] = { "extern", "static", "auto", "register", "_Thread_local" };
     82const char * Type::StorageClassesNames[] = { "extern", "static", "auto", "register", "__thread", "_Thread_local" };
    8383const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "mutex", "_Atomic" };
    8484
  • src/SynTree/Type.h

    r38a238d r67a1c67  
    8484        }; // FuncSpecifiers
    8585
    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 };
    8787        static const char * StorageClassesNames[];
    8888        union StorageClasses {
     
    9393                        bool is_auto : 1;
    9494                        bool is_register : 1;
    95                         bool is_threadlocal : 1;
     95                        bool is_threadlocalGcc : 1;
     96                        bool is_threadlocalC11 : 1;
    9697                };
    9798
     
    100101                // equality (==, !=) works implicitly on first field "val", relational operations are undefined.
    101102                BFCommon( StorageClasses, NumStorageClass )
     103
     104                bool is_threadlocal_any() { return this->is_threadlocalC11 || this->is_threadlocalGcc; }
    102105        }; // StorageClasses
    103106
  • tests/.expect/declarationSpecifier.arm64.txt

    r38a238d r67a1c67  
    735735}
    736736static volatile const struct __anonymous15 _X3x36KVS13__anonymous15_1;
     737_Thread_local signed int _X3x37i_1;
     738__thread signed int _X3x38i_1;
    737739static inline volatile const signed int _X3f11Fi___1();
    738740static inline volatile const signed int _X3f12Fi___1();
  • tests/.expect/declarationSpecifier.x64.txt

    r38a238d r67a1c67  
    735735}
    736736static volatile const struct __anonymous15 _X3x36KVS13__anonymous15_1;
     737_Thread_local signed int _X3x37i_1;
     738__thread signed int _X3x38i_1;
    737739static inline volatile const signed int _X3f11Fi___1();
    738740static inline volatile const signed int _X3f12Fi___1();
  • tests/.expect/declarationSpecifier.x86.txt

    r38a238d r67a1c67  
    735735}
    736736static volatile const struct __anonymous15 _X3x36KVS13__anonymous15_1;
     737_Thread_local signed int _X3x37i_1;
     738__thread signed int _X3x38i_1;
    737739static inline volatile const signed int _X3f11Fi___1();
    738740static inline volatile const signed int _X3f12Fi___1();
  • tests/concurrent/clib_tls.c

    r38a238d r67a1c67  
    1414
    1515
    16 _Thread_local int checkval = 0xBAADF00D;
     16__thread int checkval = 0xBAADF00D;
    1717
    1818void init(void * ) {
  • tests/concurrent/park/contention.cfa

    r38a238d r67a1c67  
    22#include <thread.hfa>
    33
    4 _Thread_local drand48_data buffer = { 0 };
     4__thread drand48_data buffer = { 0 };
    55int myrand() {
    66        long int result;
  • tests/declarationSpecifier.cfa

    r38a238d r67a1c67  
    1 // 
     1//
    22// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
    33//
    44// The contents of this file are covered under the licence agreement in the
    55// file "LICENCE" distributed with Cforall.
    6 // 
    7 // declarationSpecifier.cfa -- 
    8 // 
     6//
     7// declarationSpecifier.cfa --
     8//
    99// Author           : Peter A. Buhr
    1010// Created On       : Wed Aug 17 08:21:04 2016
     
    1212// Last Modified On : Tue Apr 30 18:20:36 2019
    1313// Update Count     : 4
    14 // 
     14//
    1515
    1616typedef short int Int;
     
    5151struct { Int i; } const static volatile x35;
    5252struct { Int i; } const volatile static x36;
     53
     54_Thread_local int x37;
     55__thread int x38;
    5356
    5457static inline const volatile int f11();
  • tests/quotedKeyword.cfa

    r38a238d r67a1c67  
    3131        ``__int128, ``__label__, ``long, ``lvalue, ``_Noreturn, ``__builtin_offsetof, ``otype, ``register, ``restrict,
    3232        ``__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,
    3434        ``typeof, ``__typeof, ``__typeof__, ``union, ``unsigned, ``__builtin_va_list, ``void, ``volatile, ``__volatile,
    3535        ``__volatile__, ``while;
Note: See TracChangeset for help on using the changeset viewer.