Changes in / [bdfc032:eef8dfb]


Ignore:
Files:
547 added
191 deleted
392 edited

Legend:

Unmodified
Added
Removed
  • .gitignore

    rbdfc032 reef8dfb  
    44
    55# generated by configure
     6aclocal.m4
     7automake
    68autom4te.cache
    79config.h
     
    911config.log
    1012config.py
     13configure
     14libtool
    1115stamp-h1
    12 libtool
    1316/Makefile
     17/Makefile.in
    1418**/Makefile
     19**/Makefile.in
     20**/Makefile.dist.in
    1521/version
    1622
     
    4248libcfa/x64-debug/
    4349libcfa/x64-nodebug/
    44 libcfa/x64-nolib/
    4550libcfa/x86-debug/
    4651libcfa/x86-nodebug/
    47 libcfa/x86-nolib/
    48 libcfa/arm-debug/
    49 libcfa/arm-nodebug/
    50 libcfa/arm-nolib/
     52libcfa/arm64-debug/
     53libcfa/arm64-nodebug/
    5154
    5255# generated by bison and lex from parser.yy and lex.ll
     
    7376doc/user/pointer2.tex
    7477doc/user/EHMHierarchy.tex
     78
     79# generated by npm
     80package-lock.json
  • Jenkins/FullBuild

    rbdfc032 reef8dfb  
    88        def err = null
    99
     10        final scmVars = checkout scm
     11        final commitId = scmVars.GIT_COMMIT
     12
    1013        try {
    1114                //Wrap build to add timestamp to command line
     
    1417                        stage('Build') {
    1518
    16                                 results = [null, null]
     19                                parallel (
     20                                        gcc_8_x86_old: { trigger_build( 'gcc-8',   'x86', false ) },
     21                                        gcc_7_x86_old: { trigger_build( 'gcc-7',   'x86', false ) },
     22                                        gcc_6_x86_old: { trigger_build( 'gcc-6',   'x86', false ) },
     23                                        gcc_9_x64_old: { trigger_build( 'gcc-9',   'x64', false ) },
     24                                        gcc_8_x64_old: { trigger_build( 'gcc-8',   'x64', false ) },
     25                                        gcc_7_x64_old: { trigger_build( 'gcc-7',   'x64', false ) },
     26                                        gcc_6_x64_old: { trigger_build( 'gcc-6',   'x64', false ) },
     27                                        gcc_5_x64_old: { trigger_build( 'gcc-5',   'x64', false ) },
     28                                        clang_x64_old: { trigger_build( 'clang',   'x64', false ) },
     29                                        clang_x64_new: { trigger_build( 'clang',   'x64', true  ) },
     30                                )
     31                        }
    1732
    18                                 parallel (
    19                                         clang_x86: { trigger_build( 'gcc-8',   'x86' ) },
    20                                         gcc_5_x86: { trigger_build( 'gcc-7',   'x86' ) },
    21                                         gcc_6_x86: { trigger_build( 'gcc-6',   'x86' ) },
    22                                         gcc_9_x64: { trigger_build( 'gcc-9',   'x64' ) },
    23                                         gcc_8_x64: { trigger_build( 'gcc-8',   'x64' ) },
    24                                         gcc_7_x64: { trigger_build( 'gcc-7',   'x64' ) },
    25                                         gcc_6_x64: { trigger_build( 'gcc-6',   'x64' ) },
    26                                         gcc_5_x64: { trigger_build( 'gcc-5',   'x64' ) },
    27                                         clang_x64: { trigger_build( 'clang',   'x64' ) },
    28                                 )
     33                        stage('Package') {
     34                                trigger_dist( commitId, currentBuild.number.toString() )
    2935                        }
    3036                }
     
    5965//===========================================================================================================
    6066
    61 def trigger_build(String cc, String arch) {
     67def trigger_build(String cc, String arch, boolean new_ast) {
    6268        def result = build job: 'Cforall/master',               \
    6369                parameters: [                                           \
     
    6874                          name: 'Architecture',                         \
    6975                          value: arch],                                 \
     76                        [$class: 'BooleanParameterValue',               \
     77                          name: 'NewAST',                               \
     78                          value: new_ast],                              \
    7079                        [$class: 'BooleanParameterValue',               \
    7180                          name: 'RunAllTests',                          \
     
    7988                        [$class: 'BooleanParameterValue',               \
    8089                          name: 'Publish',                              \
    81                           value: true],                                 \
     90                          value: true],                                         \
    8291                        [$class: 'BooleanParameterValue',               \
    8392                          name: 'Silent',                               \
     
    94103}
    95104
    96 //Helper routine to collect information about the git history
    97 def collect_git_info() {
     105def trigger_dist(String commitId, String buildNum) {
     106        def result = build job: 'Cforall_Distribute_Ref',       \
     107                parameters: [                                           \
     108                        string(name: 'GitRef', value: commitId),        \
     109                        string(name: 'Build' , value: buildNum) \
     110                ],                                                              \
     111                propagate: false
    98112
    99         //create the temporary output directory in case it doesn't already exist
    100         def out_dir = pwd tmp: true
    101         sh "mkdir -p ${out_dir}"
     113        echo(result.result)
    102114
    103         //parse git logs to find what changed
    104         dir("../Cforall_Full_Build@script") {
    105                 sh "git reflog > ${out_dir}/GIT_COMMIT"
     115        if(result.result != 'SUCCESS') {
     116                sh("wget -q -O - https://cforall.uwaterloo.ca/jenkins/job/Cforall_Distribute_Ref/${result.number}/consoleText")
     117                error(result.result)
    106118        }
    107         git_reflog = readFile("${out_dir}/GIT_COMMIT")
    108         gitRefOldValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][1]
    109         gitRefNewValue = (git_reflog =~ /moving from (.+) to (.+)/)[0][2]
    110119}
    111120
  • Jenkinsfile

    rbdfc032 reef8dfb  
    22
    33import groovy.transform.Field
    4 
    5 // For skipping stages
    6 import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
    74
    85//===========================================================================================================
     
    1512        SrcDir    = pwd tmp: false
    1613        Settings  = null
    17         StageName = ''
     14        Tools     = null
    1815
    1916        // Local variables
     
    3330                                SrcDir    = pwd tmp: false
    3431
    35                                 clean()
    36 
    37                                 checkout()
     32                                Tools.Clean()
     33
     34                                Tools.Checkout()
    3835
    3936                                build()
     
    5754        //attach the build log to the email
    5855        catch (Exception caughtError) {
    59                 //rethrow error later
     56                // Store the result of the build log
     57                currentBuild.result = "FAILURE"
     58
     59                // An error has occured, the build log is relevent
     60                log_needed = true
     61
     62                // rethrow error later
    6063                err = caughtError
    6164
     65                // print the error so it shows in the log
    6266                echo err.toString()
    63 
    64                 //An error has occured, the build log is relevent
    65                 log_needed = true
    66 
    67                 //Store the result of the build log
    68                 currentBuild.result = "${StageName} FAILURE".trim()
    6967        }
    7068
     
    8482// Main compilation routines
    8583//===========================================================================================================
    86 def clean() {
    87         build_stage('Cleanup', true) {
    88                 // clean the build by wipping the build directory
    89                 dir(BuildDir) {
    90                         deleteDir()
    91                 }
    92         }
    93 }
    94 
    95 //Compilation script is done here but environnement set-up and error handling is done in main loop
    96 def checkout() {
    97         build_stage('Checkout', true) {
    98                 //checkout the source code and clean the repo
    99                 final scmVars = checkout scm
    100                 Settings.GitNewRef = scmVars.GIT_COMMIT
    101                 Settings.GitOldRef = scmVars.GIT_PREVIOUS_COMMIT
    102 
    103                 echo GitLogMessage()
    104 
    105                 // This is a complete hack but it solves problems with automake thinking it needs to regenerate makefiles
    106                 // We fudged automake/missing to handle that but automake stills bakes prints inside the makefiles
    107                 // and these cause more problems.
    108                 sh 'find . -name Makefile.in -exec touch {} +'
    109         }
    110 }
    111 
    11284def build() {
    11385        debug = true
    11486        release = Settings.RunAllTests || Settings.RunBenchmark
    115         build_stage('Build : configure', true) {
     87        Tools.BuildStage('Build : configure', true) {
     88                // Configure must be run inside the tree
     89                dir (SrcDir) {
     90                        // Generate the necessary build files
     91                        sh './autogen.sh'
     92                }
     93
    11694                // Build outside of the src tree to ease cleaning
    11795                dir (BuildDir) {
    118                         //Configure the conpilation (Output is not relevant)
     96                        //Configure the compilation (Output is not relevant)
    11997                        //Use the current directory as the installation target so nothing escapes the sandbox
    12098                        //Also specify the compiler by hand
     
    126104                        }
    127105
    128                         sh "${SrcDir}/configure CXX=${Settings.Compiler.CXX} CC=${Settings.Compiler.CC} ${Settings.Architecture.flags} ${targets} --quiet"
     106                        ast = Settings.NewAST ? "--enable-new-ast" : "--disable-new-ast"
     107
     108                        sh "${SrcDir}/configure CXX=${Settings.Compiler.CXX} CC=${Settings.Compiler.CC} ${Settings.Architecture.flags} AR=gcc-ar RANLIB=gcc-ranlib ${targets} ${ast} --quiet --prefix=${BuildDir}"
    129109
    130110                        // Configure libcfa
     
    133113        }
    134114
    135         build_stage('Build : cfa-cpp', true) {
     115        Tools.BuildStage('Build : cfa-cpp', true) {
    136116                // Build outside of the src tree to ease cleaning
    137117                dir (BuildDir) {
     
    144124        }
    145125
    146         build_stage('Build : libcfa(debug)', debug) {
     126        Tools.BuildStage('Build : libcfa(debug)', debug) {
    147127                // Build outside of the src tree to ease cleaning
    148128                dir (BuildDir) {
     
    151131        }
    152132
    153         build_stage('Build : libcfa(nodebug)', release) {
     133        Tools.BuildStage('Build : libcfa(nodebug)', release) {
    154134                // Build outside of the src tree to ease cleaning
    155135                dir (BuildDir) {
    156136                        sh "make -j 8 --no-print-directory -C libcfa/${Settings.Architecture.name}-nodebug"
     137                }
     138        }
     139
     140        Tools.BuildStage('Build : install', true) {
     141                // Build outside of the src tree to ease cleaning
     142                dir (BuildDir) {
     143                        sh "make -j 8 --no-print-directory install"
    157144                }
    158145        }
     
    161148def test() {
    162149        try {
    163                 build_stage('Test: short', !Settings.RunAllTests) {
     150                Tools.BuildStage('Test: short', !Settings.RunAllTests) {
    164151                        dir (BuildDir) {
    165152                                //Run the tests from the tests directory
     
    168155                }
    169156
    170                 build_stage('Test: full', Settings.RunAllTests) {
     157                Tools.BuildStage('Test: full', Settings.RunAllTests) {
    171158                        dir (BuildDir) {
    172159                                        //Run the tests from the tests directory
     
    179166                echo "Archiving core dumps"
    180167                dir (BuildDir) {
    181                         archiveArtifacts artifacts: "tests/crashes/**/*", fingerprint: true
     168                        archiveArtifacts artifacts: "tests/crashes/**/*,lib/**/lib*.so*", fingerprint: true
    182169                }
    183170                throw err
     
    186173
    187174def benchmark() {
    188         build_stage('Benchmark', Settings.RunBenchmark) {
     175        Tools.BuildStage('Benchmark', Settings.RunBenchmark) {
    189176                dir (BuildDir) {
    190177                        //Append bench results
     
    195182
    196183def build_doc() {
    197         build_stage('Documentation', Settings.BuildDocumentation) {
     184        Tools.BuildStage('Documentation', Settings.BuildDocumentation) {
    198185                dir ('doc/user') {
    199186                        make_doc()
     
    207194
    208195def publish() {
    209         build_stage('Publish', true) {
     196        Tools.BuildStage('Publish', true) {
    210197
    211198                if( Settings.Publish && !Settings.RunBenchmark ) { echo 'No results to publish!!!' }
     
    215202
    216203                //Then publish the results
    217                 do_plot(Settings.RunBenchmark && Settings.Publish, 'compile'       , groupCompile    , false, 'Compilation')
    218                 do_plot(Settings.RunBenchmark && Settings.Publish, 'compile.diff'  , groupCompile    , true , 'Compilation (relative)')
    219                 do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch'     , groupConcurrency, false, 'Context Switching')
    220                 do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch.diff', groupConcurrency, true , 'Context Switching (relative)')
    221                 do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex'         , groupConcurrency, false, 'Mutual Exclusion')
    222                 do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex.diff'    , groupConcurrency, true , 'Mutual Exclusion (relative)')
    223                 do_plot(Settings.RunBenchmark && Settings.Publish, 'signal'        , groupConcurrency, false, 'Internal and External Scheduling')
    224                 do_plot(Settings.RunBenchmark && Settings.Publish, 'signal.diff'   , groupConcurrency, true , 'Internal and External Scheduling (relative)')
     204                do_plot(Settings.RunBenchmark && Settings.Publish, 'compile'        , groupCompile    , false, 'Compilation')
     205                do_plot(Settings.RunBenchmark && Settings.Publish, 'compile.diff'   , groupCompile    , true , 'Compilation (relative)')
     206                do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch'      , groupConcurrency, false, 'Context Switching')
     207                do_plot(Settings.RunBenchmark && Settings.Publish, 'ctxswitch.diff' , groupConcurrency, true , 'Context Switching (relative)')
     208                do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex'          , groupConcurrency, false, 'Mutual Exclusion')
     209                do_plot(Settings.RunBenchmark && Settings.Publish, 'mutex.diff'     , groupConcurrency, true , 'Mutual Exclusion (relative)')
     210                do_plot(Settings.RunBenchmark && Settings.Publish, 'scheduling'     , groupConcurrency, false, 'Internal and External Scheduling')
     211                do_plot(Settings.RunBenchmark && Settings.Publish, 'scheduling.diff', groupConcurrency, true , 'Internal and External Scheduling (relative)')
    225212        }
    226213}
     
    229216//Routine responsible of sending the email notification once the build is completed
    230217//===========================================================================================================
    231 @NonCPS
    232 def SplitLines(String text) {
    233         def list = []
    234 
    235         text.eachLine {
    236                 list += it
    237         }
    238 
    239         return list
    240 }
    241 
    242 def GitLogMessage() {
    243         if (!Settings || !Settings.GitOldRef || !Settings.GitNewRef) return "\nERROR retrieveing git information!\n"
    244 
    245         def oldRef = Settings.GitOldRef
    246         def newRef = Settings.GitNewRef
    247 
    248         def revText = sh(returnStdout: true, script: "git rev-list ${oldRef}..${newRef}").trim()
    249         def revList = SplitLines( revText )
    250 
    251         def gitUpdate = ""
    252         revList.each { rev ->
    253                 def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim()
    254                 gitUpdate = gitUpdate + "       via  ${rev} (${type})"
    255         }
    256 
    257         def rev = oldRef
    258         def type = sh(returnStdout: true, script: "git cat-file -t ${rev}").trim()
    259         gitUpdate = gitUpdate + "      from  ${rev} (${type})"
    260 
    261         def gitLog    = sh(returnStdout: true, script: "git rev-list --format=short ${oldRef}...${newRef}").trim()
    262 
    263         def gitDiff   = sh(returnStdout: true, script: "git diff --stat --color ${newRef} ${oldRef}").trim()
    264         gitDiff = gitDiff.replace('[32m', '<span style="color: #00AA00;">')
    265         gitDiff = gitDiff.replace('[31m', '<span style="color: #AA0000;">')
    266         gitDiff = gitDiff.replace('[m', '</span>')
    267 
    268         return """
    269 <pre>
    270 The branch ${env.BRANCH_NAME} has been updated.
    271 ${gitUpdate}
    272 </pre>
    273 
    274 <p>Check console output at ${env.BUILD_URL} to view the results.</p>
    275 
    276 <p>- Status --------------------------------------------------------------</p>
    277 
    278 <p>BUILD# ${env.BUILD_NUMBER} - ${currentBuild.result}</p>
    279 
    280 <p>- Log -----------------------------------------------------------------</p>
    281 
    282 <pre>
    283 ${gitLog}
    284 </pre>
    285 
    286 <p>-----------------------------------------------------------------------</p>
    287 <pre>
    288 Summary of changes:
    289 ${gitDiff}
    290 </pre>
    291 """
    292 }
    293 
    294218//Standard build email notification
    295219def email(boolean log) {
     
    303227generated because of a git hooks/post-receive script following
    304228a ref change which was pushed to the C\u2200 repository.</p>
    305 """ + GitLogMessage()
     229""" + Tools.GitLogMessage()
    306230
    307231        def email_to = !Settings.IsSandbox ? "cforall@lists.uwaterloo.ca" : "tdelisle@uwaterloo.ca"
     
    325249        public String CXX
    326250        public String CC
    327 
    328         CC_Desc(String name, String CXX, String CC) {
     251        public String lto
     252
     253        CC_Desc(String name, String CXX, String CC, String lto) {
    329254                this.name = name
    330255                this.CXX = CXX
    331                 this.CC = CC
     256                this.CC  = CC
     257                this.lto = lto
    332258        }
    333259}
     
    349275        public final CC_Desc Compiler
    350276        public final Arch_Desc Architecture
     277        public final Boolean NewAST
    351278        public final Boolean RunAllTests
    352279        public final Boolean RunBenchmark
     
    364291                switch( param.Compiler ) {
    365292                        case 'gcc-9':
    366                                 this.Compiler = new CC_Desc('gcc-9', 'g++-9', 'gcc-9')
     293                                this.Compiler = new CC_Desc('gcc-9', 'g++-9', 'gcc-9', '-flto=auto')
    367294                        break
    368295                        case 'gcc-8':
    369                                 this.Compiler = new CC_Desc('gcc-8', 'g++-8', 'gcc-8')
     296                                this.Compiler = new CC_Desc('gcc-8', 'g++-8', 'gcc-8', '-flto=auto')
    370297                        break
    371298                        case 'gcc-7':
    372                                 this.Compiler = new CC_Desc('gcc-7', 'g++-7', 'gcc-7')
     299                                this.Compiler = new CC_Desc('gcc-7', 'g++-7', 'gcc-7', '-flto=auto')
    373300                        break
    374301                        case 'gcc-6':
    375                                 this.Compiler = new CC_Desc('gcc-6', 'g++-6', 'gcc-6')
     302                                this.Compiler = new CC_Desc('gcc-6', 'g++-6', 'gcc-6', '-flto=auto')
    376303                        break
    377304                        case 'gcc-5':
    378                                 this.Compiler = new CC_Desc('gcc-5', 'g++-5', 'gcc-5')
     305                                this.Compiler = new CC_Desc('gcc-5', 'g++-5', 'gcc-5', '-flto=auto')
    379306                        break
    380307                        case 'gcc-4.9':
    381                                 this.Compiler = new CC_Desc('gcc-4.9', 'g++-4.9', 'gcc-4.9')
     308                                this.Compiler = new CC_Desc('gcc-4.9', 'g++-4.9', 'gcc-4.9', '-flto=auto')
    382309                        break
    383310                        case 'clang':
    384                                 this.Compiler = new CC_Desc('clang', 'clang++-6.0', 'gcc-6')
     311                                this.Compiler = new CC_Desc('clang', 'clang++-10', 'gcc-9', '-flto=thin -flto-jobs=0')
    385312                        break
    386313                        default :
     
    400327
    401328                this.IsSandbox          = (branch == "jenkins-sandbox")
     329                this.NewAST             = param.NewAST
    402330                this.RunAllTests        = param.RunAllTests
    403331                this.RunBenchmark       = param.RunBenchmark
     
    409337                this.DescShort = "${ this.Compiler.name }:${ this.Architecture.name }${full}"
    410338
     339                final ast = this.NewAST ? "New AST" : "Old AST"
    411340                this.DescLong = """Compiler              : ${ this.Compiler.name } (${ this.Compiler.CXX }/${ this.Compiler.CC })
     341AST Version             : ${ ast.toString() }
    412342Architecture            : ${ this.Architecture.name }
    413343Arc Flags               : ${ this.Architecture.flags }
     
    439369        // prepare the properties
    440370        properties ([                                                                                                   \
     371                buildDiscarder(logRotator(                                                                              \
     372                        artifactDaysToKeepStr: '',                                                                      \
     373                        artifactNumToKeepStr: '',                                                                       \
     374                        daysToKeepStr: '730',                                                                           \
     375                        numToKeepStr: '1000'                                                                            \
     376                )),                                                                                                             \
    441377                [$class: 'ParametersDefinitionProperty',                                                                \
    442378                        parameterDefinitions: [                                                                         \
     
    444380                                        description: 'Which compiler to use',                                   \
    445381                                        name: 'Compiler',                                                                       \
    446                                         choices: 'gcc-9\ngcc-8\ngcc-7\ngcc-6\ngcc-5\ngcc-4.9\nclang',                                   \
     382                                        choices: 'gcc-9\ngcc-8\ngcc-7\ngcc-6\ngcc-5\ngcc-4.9\nclang',   \
    447383                                        defaultValue: 'gcc-8',                                                          \
    448384                                ],                                                                                              \
     
    454390                                ],                                                                                              \
    455391                                [$class: 'BooleanParameterDefinition',                                                  \
     392                                        description: 'If true, build compiler using new AST',           \
     393                                        name: 'NewAST',                                                                         \
     394                                        defaultValue: true,                                                             \
     395                                ],                                                                                              \
     396                                [$class: 'BooleanParameterDefinition',                                                  \
    456397                                        description: 'If false, only the quick test suite is ran',              \
    457398                                        name: 'RunAllTests',                                                            \
     
    481422                ]])
    482423
    483         // It's unfortunate but it looks like we need to checkout the entire repo just to get the pretty git printer
     424        // It's unfortunate but it looks like we need to checkout the entire repo just to get
     425        // - the pretty git printer
     426        // - Jenkins.tools
    484427        checkout scm
     428
     429        Tools = load "Jenkins/tools.groovy"
    485430
    486431        final settings = new BuildSettings(params, env.BRANCH_NAME)
     
    490435
    491436        return settings
    492 }
    493 
    494 def build_stage(String name, boolean run, Closure block ) {
    495         StageName = name
    496         echo " -------- ${StageName} -------- "
    497         if(run) {
    498                 stage(name, block)
    499         } else {
    500                 stage(name) { Utils.markStageSkippedForConditional(STAGE_NAME) }
    501         }
    502437}
    503438
  • Makefile.am

    rbdfc032 reef8dfb  
    1919
    2020MAINTAINERCLEANFILES = lib/* bin/* tests/.deps/* tests/.out/* # order important
     21DISTCLEANFILES = version
    2122
    2223SUBDIRS = driver src . @LIBCFA_TARGET_DIRS@
     24DIST_SUBDIRS = driver src . libcfa tests
    2325
    2426@LIBCFA_TARGET_MAKEFILES@ : Makefile $(srcdir)/libcfa/configure
     
    2628        @ls $(config_file) || (echo "Missing config.data, re-run configure script again" && false)
    2729        @$(eval config_data = $(shell cat $(config_file)))
    28         @echo "Configuring libcfa with '$(config_data)''"
     30        @echo "Configuring libcfa ($(abs_top_srcdir)/libcfa/configure) with '$(config_data)' from $(shell pwd) / $(dir $@)"
    2931        @cd $(dir $@) && $(abs_top_srcdir)/libcfa/configure $(config_data)
    3032
     
    3234
    3335man1_MANS = doc/man/cfa.1
     36
     37EXTRA_DIST = LICENSE doc/man/cfa.1 libcfa/configure libcfa/Makefile.dist.am libcfa/Makefile.dist.in tools/build/distcc_hash tools/build/push2dist.sh
    3438
    3539debug=yes
     
    4751        @./config.status --config | sed "s/ /\n\t/g; s/\t'/\t/g; s/'\n/\n/g; s/^'//g; s/'$$//g"
    4852        @find libcfa -name config.status -printf "\n%h\n\t" -exec {} --config \; | sed "s/ /\n\t/g; s/\t'/\t/g; s/'\n/\n/g; s/^'//g; s/'$$//g"
     53
     54mostlyclean-local: @LIBCFA_TARGET_MAKEFILES@
     55        for dir in @LIBCFA_TARGET_DIRS@; do \
     56                $(MAKE) -C $${dir} mostlyclean; \
     57        done
     58
     59clean-local: @LIBCFA_TARGET_MAKEFILES@
     60        for dir in @LIBCFA_TARGET_DIRS@; do \
     61                $(MAKE) -C $${dir} clean; \
     62        done
     63
     64distclean-local: @LIBCFA_TARGET_MAKEFILES@
     65        for dir in @LIBCFA_TARGET_DIRS@; do \
     66                $(MAKE) -C $${dir} distclean; \
     67                rm $${dir}/config.data; \
     68        done
  • benchmark/Makefile.am

    rbdfc032 reef8dfb  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Sat Jan 25 09:20:44 2020
    14 ## Update Count     : 255
     13## Last Modified On : Tue Mar 10 11:41:18 2020
     14## Update Count     : 258
    1515###############################################################################
    1616
     
    1919
    2020# applies to both programs
    21 include $(top_srcdir)/src/cfa.make
     21include $(top_srcdir)/tools/build/cfa.make
    2222
    2323AM_CFLAGS = -O2 -Wall -Wextra -I$(srcdir) -lrt -pthread # -Werror
     
    3030BENCH_V_UPP = $(__bench_v_UPP_$(__quiet))
    3131BENCH_V_GOC = $(__bench_v_GOC_$(__quiet))
     32BENCH_V_PY = $(__bench_v_PY_$(__quiet))
    3233BENCH_V_RUSTC = $(__bench_v_RUSTC_$(__quiet))
    3334BENCH_V_NODEJS = $(__bench_v_NODEJS_$(__quiet))
     
    4748__bench_v_UPP_verbose = $(AM_V_UPP)
    4849__bench_v_GOC_verbose = $(AM_V_GOC)
    49 __bench_v_RUSTC_verbose = $(AM_V_RUSTC)
     50__bench_v_PY_verbose = $(AM_V_PY)
     51__bench_v_RUSTC_verbose = $(AM_V_RUST)
    5052__bench_v_NODEJS_verbose = $(AM_V_NODEJS)
    5153__bench_v_JAVAC_verbose = $(AM_V_JAVAC)
     
    6466# Dummy hack tricks
    6567EXTRA_PROGRAMS = dummy # build but do not install
    66 dummy_SOURCES = dummyC.c dummyCXX.cpp
     68nodist_dummy_SOURCES = dummyC.c dummyCXX.cpp
    6769
    6870dummyC.c:
     
    7274        echo "int main() { return 0; }" > ${@}
    7375
    74 #.SILENT:               # do not print recipe
    75 .ONESHELL:              # use one shell to execute recipe
     76.SILENT:                # do not print recipe
    7677.NOTPARALLEL:
    77 .PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv schedint.csv
    78 
    79 ## =========================================================================================================
    80 
    81 all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) schedint$(EXEEXT) schedext$(EXEEXT) creation$(EXEEXT)
     78.PHONY: jenkins cleancsv
     79
     80## =========================================================================================================
     81
     82# all is used by make dist so ignore it
     83all:
     84
     85all-bench : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) schedint$(EXEEXT) schedext$(EXEEXT) creation$(EXEEXT)
    8286
    8387basic_loop_DURATION = 15000000000
     
    107111creation_cfa_coroutine_DURATION = 100000000
    108112creation_cfa_coroutine_eager_DURATION = 10000000
     113creation_cfa_generator_DURATION = 1000000000
    109114creation_upp_coroutine_DURATION = ${creation_cfa_coroutine_eager_DURATION}
    110 creation_cfa_thread_DURATION = 10000000
    111 creation_upp_thread_DURATION = ${creation_cfa_thread_DURATION}
    112115creation_DURATION = 10000000
    113116
     
    142145FIX_NEW_LINES = cat $@ | tr "\n" "\t" | sed -r 's/\t,/,/' | tr "\t" "\n" > $@
    143146
    144 jenkins$(EXEEXT):
     147cleancsv:
     148        rm -f compile.csv basic.csv ctxswitch.csv mutex.csv schedint.csv
     149
     150jenkins$(EXEEXT): cleancsv
    145151@DOifskipcompile@
    146152        +make compile.csv
    147153        -+make compile.diff.csv
    148154@DOendif@
    149         +make basic.csv
    150         -+make basic.diff.csv
    151155        +make ctxswitch.csv
    152156        -+make ctxswitch.diff.csv
     
    159163        -cat compile.diff.csv
    160164@DOendif@
    161         cat basic.csv
    162         -cat basic.diff.csv
    163165        cat ctxswitch.csv
    164166        -cat ctxswitch.diff.csv
     
    169171
    170172compile.csv:
     173        echo "building $@"
    171174        echo "array,attributes,empty,expression,io,monitor,operators,typeof" > $@
    172175        +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-array.make >> $@
     
    180183        $(srcdir)/fixcsv.sh $@
    181184
    182 basic.csv:
    183         echo "generator,coroutine,thread" > $@
    184         +make basic-cfa_generator.runquiet >> $@ && echo -n ',' >> $@
    185         +make basic-cfa_coroutine.runquiet >> $@ && echo -n ',' >> $@
    186         +make basic-cfa_thread.runquiet >> $@
    187         $(srcdir)/fixcsv.sh $@
    188 
    189185ctxswitch.csv:
     186        echo "building $@"
    190187        echo "generator,coroutine,thread" > $@
    191188        +make ctxswitch-cfa_generator.runquiet >> $@ && echo -n ',' >> $@
     
    195192
    196193mutex.csv:
     194        echo "building $@"
    197195        echo "1-monitor,2-monitor" > $@
    198196        +make mutex-cfa1.runquiet >> $@ && echo -n ',' >> $@
     
    201199
    202200schedint.csv:
     201        echo "building $@"
    203202        echo "schedint-1,schedint-2,schedext-1,schedext-2" > $@
    204203        +make schedint-cfa1.runquiet >> $@ && echo -n ',' >> $@
     
    289288
    290289ctxswitch-python_coroutine$(EXEEXT):
    291         echo "#!/bin/sh" > a.out
    292         echo "python3.7 $(srcdir)/ctxswitch/python_cor.py" >> a.out
     290        $(BENCH_V_PY)echo "#!/bin/sh" > a.out
     291        echo "python3 $(srcdir)/ctxswitch/python_cor.py \"$$""@\"" >> a.out
    293292        chmod a+x a.out
    294293
    295294ctxswitch-nodejs_coroutine$(EXEEXT):
    296         echo "#!/bin/sh" > a.out
    297         echo "nodejs $(srcdir)/ctxswitch/node_cor.js" >> a.out
     295        $(BENCH_V_NODEJS)echo "#!/bin/sh" > a.out
     296        echo "nodejs $(srcdir)/ctxswitch/node_cor.js \"$$""@\"" >> a.out
    298297        chmod a+x a.out
    299298
    300299ctxswitch-nodejs_await$(EXEEXT):
    301         echo "#!/bin/sh" > a.out
    302         echo "nodejs $(srcdir)/ctxswitch/node_await.js" >> a.out
     300        $(BENCH_V_NODEJS)echo "#!/bin/sh" > a.out
     301        echo "nodejs $(srcdir)/ctxswitch/node_await.js \"$$""@\"" >> a.out
    303302        chmod a+x a.out
    304303
     
    312311        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java
    313312        echo "#!/bin/sh" > a.out
    314         echo "java JavaThread" >> a.out
     313        echo "java JavaThread \"$$""@\"" >> a.out
    315314        chmod a+x a.out
    316315
     
    354353        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java
    355354        echo "#!/bin/sh" > a.out
    356         echo "java JavaThread" >> a.out
     355        echo "java JavaThread \"$$""@\"" >> a.out
    357356        chmod a+x a.out
    358357
     
    386385        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
    387386        echo "#!/bin/sh" > a.out
    388         echo "java JavaThread" >> a.out
     387        echo "java JavaThread \"$$""@\"" >> a.out
    389388        chmod a+x a.out
    390389
     
    452451
    453452creation-python_coroutine$(EXEEXT):
    454         echo "#!/bin/sh" > a.out
    455         echo "python3.7 $(srcdir)/creation/python_cor.py" >> a.out
     453        $(BENCH_V_PY)echo "#!/bin/sh" > a.out
     454        echo "python3 $(srcdir)/creation/python_cor.py \"$$""@\"" >> a.out
    456455        chmod a+x a.out
    457456
    458457creation-nodejs_coroutine$(EXEEXT):
    459         echo "#!/bin/sh" > a.out
    460         echo "nodejs $(srcdir)/creation/node_cor.js" >> a.out
     458        $(BENCH_V_NODEJS)echo "#!/bin/sh" > a.out
     459        echo "nodejs $(srcdir)/creation/node_cor.js \"$$""@\"" >> a.out
    461460        chmod a+x a.out
    462461
     
    470469        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
    471470        echo "#!/bin/sh" > a.out
    472         echo "java JavaThread" >> a.out
     471        echo "java JavaThread \"$$""@\"" >> a.out
    473472        chmod a+x a.out
    474473
     
    478477## =========================================================================================================
    479478
    480 compile$(EXEEXT) :              \
     479bcompile$(EXEEXT) :             \
    481480        compile-array.make      \
    482481        compile-attributes.make \
     
    491490
    492491compile-array$(EXEEXT):
    493         $(CFACOMPILE) -fsyntax-only -w $(testdir)/array.cfa
     492        $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/array.cfa
    494493
    495494compile-attributes$(EXEEXT):
    496         $(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa
     495        $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/attributes.cfa
    497496
    498497compile-empty$(EXEEXT):
    499         $(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.cfa
     498        $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(srcdir)/compile/empty.cfa
    500499
    501500compile-expression$(EXEEXT):
    502         $(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.cfa
     501        $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/expression.cfa
    503502
    504503compile-io$(EXEEXT):
    505         $(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.cfa
     504        $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/io1.cfa
    506505
    507506compile-monitor$(EXEEXT):
    508         $(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.cfa
     507        $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/concurrent/monitor.cfa
    509508
    510509compile-operators$(EXEEXT):
    511         $(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.cfa
     510        $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/operators.cfa
    512511
    513512compile-thread$(EXEEXT):
    514         $(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.cfa
     513        $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/concurrent/thread.cfa
    515514
    516515compile-typeof$(EXEEXT):
    517         $(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.cfa
     516        $(CFACOMPILE) -DNO_COMPILED_PRAGMA -fsyntax-only -w $(testdir)/typeof.cfa
     517
     518## =========================================================================================================
     519
     520size$(EXEEXT) : size-cfa.runquiet
     521
     522size-cfa$(EXEEXT):
     523        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/size/size.cfa
     524
     525## =========================================================================================================
     526
     527%-tokio$(EXEEXT): $(srcdir)/readyQ/%.rs $(srcdir)/bench.rs
     528        cd $(builddir) && cargo build --release
     529        cp $(builddir)/target/release/$(basename $@) $@
  • benchmark/creation/JavaThread.java

    rbdfc032 reef8dfb  
    11public class JavaThread {
    22        // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator.
    3         // Bijective   
     3        // Bijective
    44        // Cycle length for non-zero values is 4G-1.
    55        // 0 is absorbing and should be avoided -- fixed point.
    66        // The returned value is typically masked to produce a positive value.
    7         static volatile int Ticket = 0 ; 
     7        static volatile int Ticket = 0 ;
    88
    99        private static int nextRandom (int x) {
    10                 if (x == 0) { 
     10                if (x == 0) {
    1111                        // reseed the PRNG
    12                         // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 
    13                         // Note that we use a non-atomic racy increment -- the race is rare and benign. 
    14                         // If the race is a concern switch to an AtomicInteger. 
    15                         // In addition accesses to the RW volatile global "Ticket"  variable are not 
    16                         // (readily) predictable at compile-time so the JIT will not be able to elide 
    17                         // nextRandom() invocations. 
    18                         x = ++Ticket ; 
    19                         if (x == 0) x = 1 ; 
     12                        // Ticket is accessed infrequently and does not constitute a coherence hot-spot.
     13                        // Note that we use a non-atomic racy increment -- the race is rare and benign.
     14                        // If the race is a concern switch to an AtomicInteger.
     15                        // In addition accesses to the RW volatile global "Ticket"  variable are not
     16                        // (readily) predictable at compile-time so the JIT will not be able to elide
     17                        // nextRandom() invocations.
     18                        x = ++Ticket ;
     19                        if (x == 0) x = 1 ;
    2020                }
    2121                x ^= x << 6;
    2222                x ^= x >>> 21;
    2323                x ^= x << 7;
    24                 return x ;   
     24                return x ;
    2525        }
    2626        static int x = 2;
    2727
    28         static private int times = Integer.parseInt("10000") ;
     28        static private long times = Long.parseLong("10000") ;
    2929
    3030        public static class MyThread extends Thread {
     
    3333        }
    3434        public static void helper() throws InterruptedException {
    35                 for(int i = 1; i <= times; i += 1) {
     35                for(long i = 1; i <= times; i += 1) {
    3636                        MyThread m = new MyThread();
    3737                        x = nextRandom( x );
     
    4747        }
    4848        public static void main(String[] args) throws InterruptedException {
    49                 if ( args.length > 2 ) System.exit( 1 );
    50                 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }
     49                if ( args.length > 1 ) System.exit( 1 );
     50                if ( args.length == 1 ) { times = Long.parseLong(args[0]); }
    5151
    52                 for (int i = Integer.parseInt("5"); --i >= 0 ; ) { 
     52                for (int i = Integer.parseInt("5"); --i >= 0 ; ) {
    5353                        InnerMain();
    5454                        Thread.sleep(2000);             // 2 seconds
  • benchmark/creation/cfa_gen.cfa

    rbdfc032 reef8dfb  
    1 #include "bench.h"
     1#include "../bench.h"
    22
    3 struct C {
     3generator G {
    44        volatile int restart; // ensure compiler does not optimize away all the code
    55};
    6 void ?{}( C & c ) { c.restart = 0; }
    7 void main( C & ) {}
     6void ?{}( G & g ) { g.restart = 0; }
     7void main( G & ) {}
    88
    99int main( int argc, char * argv[] ) {
     
    1111        BENCH(
    1212                for ( times ) {
    13                          C c;
     13                         G g;
    1414                },
    1515                result
  • benchmark/creation/node_cor.js

    rbdfc032 reef8dfb  
    55
    66function * coroutine() { yield }
     7
     8for ( var i = 0; i < times; i += 1 ) { // warm jit
     9        cor = coroutine()
     10}
     11
    712var hrstart = process.hrtime()
    813for ( var i = 0; i < times; i += 1 ) {
  • benchmark/ctxswitch/JavaThread.java

    rbdfc032 reef8dfb  
    11public class JavaThread {
    22        // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator.
    3         // Bijective   
     3        // Bijective
    44        // Cycle length for non-zero values is 4G-1.
    55        // 0 is absorbing and should be avoided -- fixed point.
    66        // The returned value is typically masked to produce a positive value.
    7         static volatile int Ticket = 0 ; 
     7        static volatile int Ticket = 0 ;
    88
    99        private static int nextRandom (int x) {
    10                 if (x == 0) { 
     10                if (x == 0) {
    1111                        // reseed the PRNG
    12                         // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 
    13                         // Note that we use a non-atomic racy increment -- the race is rare and benign. 
    14                         // If the race is a concern switch to an AtomicInteger. 
    15                         // In addition accesses to the RW volatile global "Ticket"  variable are not 
    16                         // (readily) predictable at compile-time so the JIT will not be able to elide 
    17                         // nextRandom() invocations. 
    18                         x = ++Ticket ; 
    19                         if (x == 0) x = 1 ; 
     12                        // Ticket is accessed infrequently and does not constitute a coherence hot-spot.
     13                        // Note that we use a non-atomic racy increment -- the race is rare and benign.
     14                        // If the race is a concern switch to an AtomicInteger.
     15                        // In addition accesses to the RW volatile global "Ticket"  variable are not
     16                        // (readily) predictable at compile-time so the JIT will not be able to elide
     17                        // nextRandom() invocations.
     18                        x = ++Ticket ;
     19                        if (x == 0) x = 1 ;
    2020                }
    2121                x ^= x << 6;
    2222                x ^= x >>> 21;
    2323                x ^= x << 7;
    24                 return x ;   
     24                return x ;
    2525        }
    2626        static int x = 2;
    2727
    28         static private int times = Integer.parseInt("100000");
     28        static private long times = Long.parseLong("100000");
    2929
    3030        public static void helper() {
    31                 for(int i = 1; i <= times; i += 1) {
     31                for(long i = 1; i <= times; i += 1) {
    3232                        Thread.yield();
    3333                }
     
    4040        }
    4141        public static void main(String[] args) throws InterruptedException {
    42                 if ( args.length > 2 ) System.exit( 1 );
    43                 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }
     42                if ( args.length > 1 ) System.exit( 1 );
     43                if ( args.length == 1 ) { times = Long.parseLong(args[0]); }
    4444
    4545                for (int i = Integer.parseInt("5"); --i >= 0 ; ) {
  • benchmark/ctxswitch/cfa_cor.cfa

    rbdfc032 reef8dfb  
    22#include <thread.hfa>
    33
    4 #include "bench.h"
     4#include "../bench.h"
    55
    6 coroutine C {} c;
     6coroutine C {};
    77void main( __attribute__((unused)) C & ) {
    8         while () {
    9                 suspend();
     8        for () {
     9                suspend;
    1010        }
    1111}
    1212int main( int argc, char * argv[] ) {
     13        C c;
    1314        BENCH_START()
    1415        BENCH(
  • benchmark/ctxswitch/cfa_gen.cfa

    rbdfc032 reef8dfb  
    11#include "../bench.h"
    22
    3 typedef struct {
    4         void * next;
    5 } C;
    6 
    7 void comain( C * c ) {
    8         if ( __builtin_expect(c->next != 0, 1) ) goto *(c->next);
    9         c->next = &&s1;
     3generator G {};
     4void main( G & ) {
    105        for () {
    11                 return;
    12           s1: ;
     6                suspend;
    137        }
    148}
    159
    1610int main( int argc, char * argv[] ) {
     11        G g;
    1712        BENCH_START()
    18         C c = { 0 };
    1913        BENCH(
    2014                for ( times ) {
    21                         comain( &c );
     15                        resume( g );
    2216                },
    2317                result
  • benchmark/ctxswitch/node_cor.js

    rbdfc032 reef8dfb  
    1010}
    1111cor = coroutine()
     12
     13for ( var i = 0; i < times; i += 1 ) { // warm git
     14        cor.next();
     15}
    1216
    1317var hrstart = process.hrtime()
  • benchmark/exclude

    rbdfc032 reef8dfb  
    1010interrupt_linux.c
    1111exclude
     12io
    1213Monitor.c
  • benchmark/mutex/JavaThread.java

    rbdfc032 reef8dfb  
    11public class JavaThread {
    22        // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator.
    3         // Bijective   
     3        // Bijective
    44        // Cycle length for non-zero values is 4G-1.
    55        // 0 is absorbing and should be avoided -- fixed point.
    66        // The returned value is typically masked to produce a positive value.
    7         static volatile int Ticket = 0 ; 
     7        static volatile int Ticket = 0 ;
    88
    99        private static int nextRandom (int x) {
    10                 if (x == 0) { 
     10                if (x == 0) {
    1111                        // reseed the PRNG
    12                         // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 
    13                         // Note that we use a non-atomic racy increment -- the race is rare and benign. 
    14                         // If the race is a concern switch to an AtomicInteger. 
    15                         // In addition accesses to the RW volatile global "Ticket"  variable are not 
    16                         // (readily) predictable at compile-time so the JIT will not be able to elide 
    17                         // nextRandom() invocations. 
    18                         x = ++Ticket ; 
    19                         if (x == 0) x = 1 ; 
     12                        // Ticket is accessed infrequently and does not constitute a coherence hot-spot.
     13                        // Note that we use a non-atomic racy increment -- the race is rare and benign.
     14                        // If the race is a concern switch to an AtomicInteger.
     15                        // In addition accesses to the RW volatile global "Ticket"  variable are not
     16                        // (readily) predictable at compile-time so the JIT will not be able to elide
     17                        // nextRandom() invocations.
     18                        x = ++Ticket ;
     19                        if (x == 0) x = 1 ;
    2020                }
    2121                x ^= x << 6;
    2222                x ^= x >>> 21;
    2323                x ^= x << 7;
    24                 return x ;   
     24                return x ;
    2525        }
    2626        static int x = 2;
    2727
    28         static private int times = Integer.parseInt("100000000");
     28        static private long times = Long.parseLong("100000000");
    2929
    3030        public synchronized void noop() {
     
    3434                JavaThread j = new JavaThread();
    3535                // Inhibit biased locking ...
    36                 x = (j.hashCode() ^ System.identityHashCode(j)) | 1 ;     
    37                 for(int i = 1; i <= times; i += 1) {
     36                x = (j.hashCode() ^ System.identityHashCode(j)) | 1 ;
     37                for(long i = 1; i <= times; i += 1) {
    3838                        x = nextRandom(x);
    3939                        j.noop();
     
    4747        }
    4848        public static void main(String[] args) throws InterruptedException {
    49                 if ( args.length > 2 ) System.exit( 1 );
    50                 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }
     49                if ( args.length > 1 ) System.exit( 1 );
     50                if ( args.length == 1 ) { times = Long.parseLong(args[0]); }
    5151
    52                 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 
     52                for (int n = Integer.parseInt("5"); --n >= 0 ; ) {
    5353                        InnerMain();
    5454                        Thread.sleep(2000);     // 2 seconds
  • benchmark/mutexC/JavaThread.java

    rbdfc032 reef8dfb  
    11class Noop {
    22        // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator.
    3         // Bijective   
     3        // Bijective
    44        // Cycle length for non-zero values is 4G-1.
    55        // 0 is absorbing and should be avoided -- fixed point.
    66        // The returned value is typically masked to produce a positive value.
    7         static volatile int Ticket = 0 ; 
     7        static volatile int Ticket = 0 ;
    88
    99        public static int nextRandom( int x ) {
    10                 if (x == 0) { 
     10                if (x == 0) {
    1111                        // reseed the PRNG
    12                         // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 
    13                         // Note that we use a non-atomic racy increment -- the race is rare and benign. 
    14                         // If the race is a concern switch to an AtomicInteger. 
    15                         // In addition accesses to the RW volatile global "Ticket"  variable are not 
    16                         // (readily) predictable at compile-time so the JIT will not be able to elide 
    17                         // nextRandom() invocations. 
    18                         x = ++Ticket ; 
    19                         if (x == 0) x = 1 ; 
     12                        // Ticket is accessed infrequently and does not constitute a coherence hot-spot.
     13                        // Note that we use a non-atomic racy increment -- the race is rare and benign.
     14                        // If the race is a concern switch to an AtomicInteger.
     15                        // In addition accesses to the RW volatile global "Ticket"  variable are not
     16                        // (readily) predictable at compile-time so the JIT will not be able to elide
     17                        // nextRandom() invocations.
     18                        x = ++Ticket ;
     19                        if (x == 0) x = 1 ;
    2020                }
    2121                x ^= x << 6;
    2222                x ^= x >>> 21;
    2323                x ^= x << 7;
    24                 return x ;   
     24                return x ;
    2525        }
    2626}
     
    4747        static int x = 2;
    4848
    49         static private int times = Integer.parseInt("10000000");
     49        static private long times = Long.parseLong("10000000");
    5050
    5151        public static void call( Monitor m ) throws InterruptedException {
     
    5353                m.go = true;
    5454                //while ( ! m.go2 );
    55                 for ( int i = 0; i < times; i += 1 ) {
     55                for ( long i = 0; i < times; i += 1 ) {
    5656                        m.call();
    5757                        x = Noop.nextRandom( x );
     
    7171        public static void main( String[] args ) throws InterruptedException {
    7272                if ( args.length > 2 ) System.exit( 1 );
    73                 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }
     73                if ( args.length == 2 ) { times = Long.parseLong(args[1]); }
    7474
    75                 if ( args.length > 2 ) System.exit( 1 );
    76                 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }
    77 
    78                 for ( int i = Integer.parseInt("5"); --i >= 0 ; ) {
     75                for ( int i = Integer.parseInt("5"); --i >= 0 ; ) {
    7976                        InnerMain();
    8077                        // Thread.sleep(2000);  // 2 seconds
  • benchmark/schedint/JavaThread.java

    rbdfc032 reef8dfb  
    2424public class JavaThread {
    2525        // Simplistic low-quality Marsaglia Shift-XOR pseudo-random number generator.
    26         // Bijective   
     26        // Bijective
    2727        // Cycle length for non-zero values is 4G-1.
    2828        // 0 is absorbing and should be avoided -- fixed point.
    2929        // The returned value is typically masked to produce a positive value.
    30         static volatile int Ticket = 0 ; 
     30        static volatile int Ticket = 0 ;
    3131
    3232        private static int nextRandom (int x) {
    33                 if (x == 0) { 
     33                if (x == 0) {
    3434                        // reseed the PRNG
    35                         // Ticket is accessed infrequently and does not constitute a coherence hot-spot. 
    36                         // Note that we use a non-atomic racy increment -- the race is rare and benign. 
    37                         // If the race is a concern switch to an AtomicInteger. 
    38                         // In addition accesses to the RW volatile global "Ticket"  variable are not 
    39                         // (readily) predictable at compile-time so the JIT will not be able to elide 
    40                         // nextRandom() invocations. 
    41                         x = ++Ticket ; 
    42                         if (x == 0) x = 1 ; 
     35                        // Ticket is accessed infrequently and does not constitute a coherence hot-spot.
     36                        // Note that we use a non-atomic racy increment -- the race is rare and benign.
     37                        // If the race is a concern switch to an AtomicInteger.
     38                        // In addition accesses to the RW volatile global "Ticket"  variable are not
     39                        // (readily) predictable at compile-time so the JIT will not be able to elide
     40                        // nextRandom() invocations.
     41                        x = ++Ticket ;
     42                        if (x == 0) x = 1 ;
    4343                }
    4444                x ^= x << 6;
    4545                x ^= x >>> 21;
    4646                x ^= x << 7;
    47                 return x ;   
     47                return x ;
    4848        }
    4949        static int x = 2;
    5050
    51         static private int times = Integer.parseInt("1000000");
     51        static private long times = Long.parseLong("1000000");
    5252
    5353        public static void helper( Monitor m ) throws InterruptedException {
    54                 for(int i = 1; i <= times; i += 1) {
     54                for(long i = 1; i <= times; i += 1) {
    5555                        m.wait();               // relase monitor lock
    5656                        m.next = true;
     
    7575        }
    7676        public static void main(String[] args) throws InterruptedException {
    77                 if ( args.length > 2 ) System.exit( 1 );
    78                 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); }
     77                if ( args.length > 1 ) System.exit( 1 );
     78                if ( args.length == 1 ) { times = Long.parseLong(args[0]); }
    7979
    80                 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 
     80                for (int n = Integer.parseInt("5"); --n >= 0 ; ) {
    8181                        InnerMain();
    8282                        Thread.sleep(2000);     // 2 seconds
  • configure.ac

    rbdfc032 reef8dfb  
    33
    44AC_PREREQ([2.68])
    5 AC_INIT([cfa-cc],[1.0.0.0],[cforall@plg.uwaterloo.ca])
     5AC_INIT([cfa-cc],[1.0.0],[cforall@plg.uwaterloo.ca])
    66AC_CONFIG_AUX_DIR([automake])
    77AC_CONFIG_MACRO_DIRS([automake])
    8 #AC_CONFIG_SRCDIR([src/main.cc])
    98AC_CONFIG_HEADERS([config.h:src/config.h.in])
    109AM_SILENT_RULES([yes])
    1110
    12 m4_include([automake/cfa.m4])
     11m4_include([tools/build/cfa.m4])
    1312
    1413# don't use the default CFLAGS as they unconditonnaly add -O2
    1514: ${CFLAGS=""}
     15: ${CXXFLAGS=""}
    1616
    1717AM_INIT_AUTOMAKE([subdir-objects])
     
    2424#Trasforming cc1 will break compilation
    2525M4CFA_PROGRAM_NAME
     26
     27#==============================================================================
     28# New AST toggling support
     29AH_TEMPLATE([CFA_USE_NEW_AST],[Sets whether or not to use the new-ast, this is adefault value and can be overrided by --old-ast and --new-ast])
     30DEFAULT_NEW_AST="True"
     31AC_ARG_ENABLE(new-ast,
     32        [  --enable-new-ast     whether or not to use new ast as the default AST algorithm],
     33        [case "${enableval}" in
     34                yes) newast=true ; DEFAULT_NEW_AST="True"  ;;
     35                no)  newast=false; DEFAULT_NEW_AST="False" ;;
     36                *) AC_MSG_ERROR([bad value ${enableval} for --enable-new-ast]) ;;
     37        esac],[newast=true])
     38AC_DEFINE_UNQUOTED([CFA_USE_NEW_AST], $newast)
     39AC_SUBST(DEFAULT_NEW_AST)
    2640
    2741#==============================================================================
     
    6478        enable_distcc=$enableval, enable_distcc=no)
    6579
     80AC_ARG_WITH(bwlimit,
     81        [  --with-bwlimit=RATE     RATE the maximum rate at which rsync will be limited when using distributed builds],
     82        [], [])
     83
    6684AM_CONDITIONAL([ENABLE_DISTCC], [test x$enable_distcc = xyes])
    6785HAS_DISTCC="False"
     
    85103# Create variables for commonly used targets
    86104
    87 TOP_SRCDIR="$(readlink -m $ac_confdir/)/"
    88 TOP_BUILDDIR="$(readlink -m $ac_pwd/)/"
     105TOP_SRCDIR="$(readlink -e $ac_abs_confdir/)/"
     106TOP_BUILDDIR="$(readlink -e $ac_pwd/)/"
    89107
    90108AC_DEFINE_UNQUOTED(TOP_SRCDIR, "$TOP_SRCDIR", [Top src directory])
     
    121139                \'--enable-gprofiler=*) ;;
    122140                \'--disable-gprofiler) ;;
     141
     142                # skip the target hosts
     143                \'--enable-new-ast=*) ;;
     144                \'--disable-new-ast) ;;
     145
     146                # skip this, it only causes problems
     147                \'--srcdir=*) ;;
    123148
    124149                # append all other arguments to the sub configure arguments
     
    186211
    187212        LIBCFA_TARGET_DIRS="${LIBCFA_TARGET_DIRS} ${lib_dir}"
     213        LIBCFA_1TARGET_DIR="${lib_dir}"
    188214        LIBCFA_TARGET_MAKEFILES="${LIBCFA_TARGET_MAKEFILES} ${lib_dir}/Makefile"
    189215
     
    197223
    198224AC_SUBST(LIBCFA_TARGET_DIRS)
     225AC_SUBST(LIBCFA_1TARGET_DIR)
    199226AC_SUBST(LIBCFA_TARGET_MAKEFILES)
    200227
     
    262289        driver/Makefile
    263290        src/Makefile
    264         benchmark/Makefile
     291        libcfa/Makefile:libcfa/Makefile.dist.in
    265292        tests/Makefile
    266         longrun_tests/Makefile
    267         tools/Makefile
    268         tools/prettyprinter/Makefile
    269293        ])
     294
     295# Some of our makefile don't need to be distributed
     296AM_CONDITIONAL([CFORALL_DISTRIBUTE], [test -e $TOP_SRCDIR/autogen.sh])
     297AM_COND_IF([CFORALL_DISTRIBUTE], [
     298        AC_CONFIG_FILES([
     299                longrun_tests/Makefile
     300                benchmark/Makefile
     301                benchmark/io/http/Makefile
     302                tools/Makefile
     303                tools/prettyprinter/Makefile
     304        ])
     305
     306        AC_OUTPUT(benchmark/Cargo.toml)
     307])
    270308
    271309AC_CONFIG_LINKS([tests/test.py:tests/test.py])
  • doc/LaTeXmacros/common.tex

    rbdfc032 reef8dfb  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Fri May 24 07:59:54 2019
    14 %% Update Count     : 382
     13%% Last Modified On : Mon Oct  5 09:34:46 2020
     14%% Update Count     : 464
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    3636% Names used in the document.
    3737
     38\usepackage{xspace}
    3839\newcommand{\CFAIcon}{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}\xspace} % Cforall symbolic name
    3940\newcommand{\CFA}{\protect\CFAIcon}             % safe for section/caption
     
    5455\newlength{\parindentlnth}
    5556\setlength{\parindentlnth}{\parindent}
    56 
    57 \newcommand{\LstBasicStyle}[1]{{\lst@basicstyle{#1}}}
    58 \newcommand{\LstKeywordStyle}[1]{{\lst@basicstyle{\lst@keywordstyle{#1}}}}
    59 \newcommand{\LstCommentStyle}[1]{{\lst@basicstyle{\lst@commentstyle{#1}}}}
    60 
    61 \newlength{\gcolumnposn}                                % temporary hack because lstlisting does not handle tabs correctly
    62 \newlength{\columnposn}
    63 \setlength{\gcolumnposn}{2.75in}
    64 \setlength{\columnposn}{\gcolumnposn}
    65 \newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@basicstyle{\LstCommentStyle{#2}}}}
    66 \newcommand{\CRT}{\global\columnposn=\gcolumnposn}
    67 
    68 % allow escape sequence in lstinline
    69 %\usepackage{etoolbox}
    70 %\patchcmd{\lsthk@TextStyle}{\let\lst@DefEsc\@empty}{}{}{\errmessage{failed to patch}}
    7157
    7258\usepackage{pslatex}                                    % reduce size of san serif font
     
    241227}%
    242228
     229\usepackage{listings}                                                                   % format program code
    243230\usepackage{lstlang}
    244 
    245 \newcommand{\CFADefaults}{%
     231\makeatletter
     232
     233\newcommand{\LstBasicStyle}[1]{{\lst@basicstyle{#1}}}
     234\newcommand{\LstKeywordStyle}[1]{{\lst@basicstyle{\lst@keywordstyle{#1}}}}
     235\newcommand{\LstCommentStyle}[1]{{\lst@basicstyle{\lst@commentstyle{#1}}}}
     236
     237\newlength{\gcolumnposn}                                % temporary hack because lstlisting does not handle tabs correctly
     238\newlength{\columnposn}
     239\setlength{\gcolumnposn}{2.75in}
     240\setlength{\columnposn}{\gcolumnposn}
     241\newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@basicstyle{\LstCommentStyle{#2}}}}
     242\newcommand{\CRT}{\global\columnposn=\gcolumnposn}
     243
     244% allow escape sequence in lstinline
     245%\usepackage{etoolbox}
     246%\patchcmd{\lsthk@TextStyle}{\let\lst@DefEsc\@empty}{}{}{\errmessage{failed to patch}}
     247
     248% allow adding to lst literate
     249\def\addToLiterate#1{\protect\edef\lst@literate{\unexpanded\expandafter{\lst@literate}\unexpanded{#1}}}
     250\lst@Key{add to literate}{}{\addToLiterate{#1}}
     251\makeatother
     252
     253\newcommand{\CFAStyle}{%
    246254\lstset{
    247 language=CFA,
    248255columns=fullflexible,
    249256basicstyle=\linespread{0.9}\sf,                 % reduce line spacing and use sanserif font
     
    260267belowskip=3pt,
    261268% replace/adjust listing characters that look bad in sanserif
    262 literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
     269literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.75ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptscriptstyle\land\,$}}1
    263270        {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
    264271        {<-}{$\leftarrow$}2 {=>}{$\Rightarrow$}2 {->}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.075ex}}}\kern-0.2ex\textgreater}2,
     272}% lstset
     273}% CFAStyle
     274
     275\ifdefined\CFALatin% extra Latin-1 escape characters
     276\lstnewenvironment{cfa}[1][]{
     277\lstset{
     278language=CFA,
    265279moredelim=**[is][\color{red}]{®}{®},    % red highlighting ®...® (registered trademark symbol) emacs: C-q M-.
    266280moredelim=**[is][\color{blue}]{ß}{ß},   % blue highlighting ß...ß (sharp s symbol) emacs: C-q M-_
    267281moredelim=**[is][\color{OliveGreen}]{¢}{¢}, % green highlighting ¢...¢ (cent symbol) emacs: C-q M-"
    268282moredelim=[is][\lstset{keywords={}}]{¶}{¶}, % keyword escape ¶...¶ (pilcrow symbol) emacs: C-q M-^
     283% replace/adjust listing characters that look bad in sanserif
     284add to literate={`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
    269285}% lstset
    270 }% CFADefaults
    271 \newcommand{\CFAStyle}{%
    272 \CFADefaults
     286\lstset{#1}
     287}{}
    273288% inline code ©...© (copyright symbol) emacs: C-q M-)
    274289\lstMakeShortInline©                                    % single-character for \lstinline
    275 }% CFAStyle
    276 
    277 \lstnewenvironment{cfa}[1][]
    278 {\CFADefaults\lstset{#1}}
    279 {}
     290\else% regular ASCI characters
     291\lstnewenvironment{cfa}[1][]{
     292\lstset{
     293language=CFA,
     294escapechar=\$,                                                  % LaTeX escape in CFA code
     295moredelim=**[is][\color{red}]{@}{@},    % red highlighting @...@
     296}% lstset
     297\lstset{#1}
     298}{}
     299% inline code @...@ (at symbol)
     300\lstMakeShortInline@                                    % single-character for \lstinline
     301\fi%
    280302
    281303% Local Variables: %
  • doc/LaTeXmacros/lstlang.sty

    rbdfc032 reef8dfb  
    88%% Created On       : Sat May 13 16:34:42 2017
    99%% Last Modified By : Peter A. Buhr
    10 %% Last Modified On : Tue Jan  8 14:40:33 2019
    11 %% Update Count     : 21
     10%% Last Modified On : Wed Sep 23 22:40:04 2020
     11%% Update Count     : 24
    1212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1313
     
    115115                auto, _Bool, catch, catchResume, choose, _Complex, __complex, __complex__, __const, __const__,
    116116                coroutine, disable, dtype, enable, exception, __extension__, fallthrough, fallthru, finally,
    117                 __float80, float80, __float128, float128, forall, ftype, _Generic, _Imaginary, __imag, __imag__,
     117                __float80, float80, __float128, float128, forall, ftype, generator, _Generic, _Imaginary, __imag, __imag__,
    118118                inline, __inline, __inline__, __int128, int128, __label__, monitor, mutex, _Noreturn, one_t, or,
    119                 otype, restrict, __restrict, __restrict__, __signed, __signed__, _Static_assert, thread,
     119                otype, restrict, __restrict, __restrict__, __signed, __signed__, _Static_assert, suspend, thread,
    120120                _Thread_local, throw, throwResume, timeout, trait, try, ttype, typeof, __typeof, __typeof__,
    121121                virtual, __volatile, __volatile__, waitfor, when, with, zero_t,
     
    125125
    126126% C++ programming language
    127 \lstdefinelanguage{C++}[ANSI]{C++}{}
     127\lstdefinelanguage{C++}[ANSI]{C++}{
     128        morekeywords={nullptr,}
     129}
    128130
    129131% uC++ programming language, based on ANSI C++
  • doc/bibliography/pl.bib

    rbdfc032 reef8dfb  
    99%    Predefined journal names:
    1010%  acmcs: Computing Surveys             acta: Acta Infomatica
    11 @string{acta="Acta Infomatica"}
    1211%  cacm: Communications of the ACM
    1312%  ibmjrd: IBM J. Research & Development ibmsj: IBM Systems Journal
     
    2221%  tcs: Theoretical Computer Science
    2322
     23@string{acta="Acta Infomatica"}
    2424string{ieeepds="IEEE Transactions on Parallel and Distributed Systems"}
    2525@string{ieeepds="IEEE Trans. Parallel Distrib. Syst."}
     
    124124    series      = {ACM Distinguished Dissertations},
    125125    year        = 1983,
     126}
     127
     128@article{Zhang19,
     129    keywords    = {Algebraic effects, dynamic scoping, exceptions, parametricity, type systems},
     130    author      = {Zhang, Yizhou and Myers, Andrew C.},
     131    title       = {Abstraction-safe Effect Handlers via Tunneling},
     132    journal     = {Proc. ACM Program. Lang.},
     133    issue_date  = {January 2019},
     134    volume      = {3},
     135    number      = {POPL},
     136    month       = jan,
     137    year        = {2019},
     138    issn        = {2475-1421},
     139    pages       = {5:1--5:29},
     140    articleno   = {5},
     141    publisher   = {ACM},
     142    address     = {New York, NY, USA},
     143}
     144
     145@inproceedings{Zhang16,
     146    keywords    = {Exception tunneling, Genus, exception handling},
     147    author      = {Zhang, Yizhou and Salvaneschi, Guido and Beightol, Quinn and Liskov, Barbara and Myers, Andrew C.},
     148    title       = {Accepting Blame for Safe Tunneled Exceptions},
     149    booktitle   = {Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation},
     150    series      = {PLDI'16},
     151    year        = {2016},
     152    location    = {Santa Barbara, CA, USA},
     153    pages       = {281--295},
     154    publisher   = {ACM},
     155    address     = {New York, NY, USA},
    126156}
    127157
     
    398428    journal     = sigplan,
    399429    year        = 1981,
    400     month       = feb, volume = 16, number = 2, pages = {48-52},
     430    month       = feb,
     431    volume      = 16,
     432    number      = 2,
     433    pages       = {48-52},
    401434    comment     = {
    402435        A one-pass, top-down algorithm for overload resolution.  Input is a
     
    477510    title       = {An Alternative to Subclassing},
    478511    journal     = sigplan,
    479     volume      = {21},    number = {11},
     512    volume      = {21},
     513    number      = {11},
    480514    pages       = {424-428},
    481     month       = nov, year = 1986,
     515    month       = nov,
     516    year        = 1986,
    482517    comment     = {
    483518        The Smalltalk class hierarchy has three uses: factoring out code;
     
    533568    isbn        = {3-540-66538-2},
    534569    location    = {Toulouse, France},
    535     doi         = {http://doi.acm.org/10.1145/318773.319251},
    536570    publisher   = {Springer},
    537571    address     = {London, UK},
     
    631665    year        = 2010,
    632666    pages       = {39--50},
    633     numpages    = {12},
    634667    publisher   = {IEEE Computer Society},
    635668    address     = {Washington, DC, USA},
     
    922955}
    923956
     957@manual{C99,
     958    keywords    = {ISO/IEC C 9899},
     959    contributer = {pabuhr@plg},
     960    key         = {C99},
     961    title       = {C Programming Language {ISO/IEC} 9899:1999(E)},
     962    edition     = {2nd},
     963    organization= {International Standard Organization},
     964    address     = {Geneva, Switzerland},
     965    year        = 1999,
     966    note        = {\href{https://webstore.ansi.org/Standards/INCITS/INCITSISOIEC98991999R2005}{https://webstore.ansi.org/\-Standards/\-INCITS/\-INCITSISOIEC98991999R2005}},
     967}
     968
    924969@manual{C11,
    925970    keywords    = {ISO/IEC C 11},
     
    928973    title       = {C Programming Language {ISO/IEC} 9889:2011-12},
    929974    edition     = {3rd},
    930     publisher   = {International Standard Organization},
    931     address     = {\href{https://www.iso.org/standard/57853.html}{https://\-www.iso.org/\-standard/\-57853.html}},
     975    organization= {International Standard Organization},
     976    address     = {Geneva, Switzerland},
    932977    year        = 2012,
     978    note        = {\href{https://www.iso.org/standard/57853.html}{https://\-www.iso.org/\-standard/\-57853.html}},
    933979}
    934980
     
    938984    key         = {Concepts},
    939985    title       = {{C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} Programming language -- Extensions for concepts {ISO/IEC} {TS} 19217:2015},
    940     publisher   = {International Standard Organization},
    941     address     = {\href{https://www.iso.org/standard/64031.html}{https://\-www.iso.org/\-standard/\-64031.html}},
     986    organization= {International Standard Organization},
     987    address     = {Geneva, Switzerland},
    942988    year        = 2015,
     989    note        = {\href{https://www.iso.org/standard/64031.html}{https://\-www.iso.org/\-standard/\-64031.html}},
    943990}
    944991
     
    9571004}
    9581005
    959 @misc{CforallBenchMarks,
     1006@misc{CforallConcurrentBenchmarks,
    9601007    contributer = {pabuhr@plg},
    9611008    key         = {Cforall Benchmarks},
    9621009    author      = {{\textsf{C}{$\mathbf{\forall}$} Benchmarks}},
    963     howpublished= {\href{https://plg.uwaterloo.ca/~cforall/benchmark.tar}{https://\-plg.uwaterloo.ca/\-$\sim$cforall/\-benchmark.tar}},
     1010    howpublished= {\href{https://github.com/cforall/ConcurrentBenchmarks_SPE20}{https://\-github.com/\-cforall/\-ConcurrentBenchmarks\_SPE20}},
    9641011}
    9651012
     
    11051152    title       = {C\# Language Specification, Standard ECMA-334},
    11061153    organization= {ECMA International Standardizing Information and Communication Systems},
     1154    address     = {Geneva, Switzerland},
    11071155    month       = jun,
    11081156    year        = 2006,
     
    12541302    title       = {Programming Languages -- {Cobol} ISO/IEC 1989:2014},
    12551303    edition     = {2nd},
    1256     institution = {International Standard Organization},
    1257     address     = {\href{https://www.iso.org/standard/51416.html}{https://\-www.iso.org/\-standard/\-51416.html}},
     1304    organization= {International Standard Organization},
     1305    address     = {Geneva, Switzerland},
    12581306    year        = 2014,
     1307    note        = {\href{https://www.iso.org/standard/51416.html}{https://\-www.iso.org/\-standard/\-51416.html}},
    12591308}
    12601309
     
    13051354    location    = {London, United Kingdom},
    13061355    pages       = {41--53},
    1307     numpages    = {13},
    1308     url         = {http://doi.acm.org/10.1145/360204.360207},
    1309     doi         = {10.1145/360204.360207},
    1310     acmid       = {360207},
    13111356    publisher   = {ACM},
    13121357    address     = {New York, NY, USA},
     
    16141659    title       = {$\mu${C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} Annotated Reference Manual, Version 7.0.0},
    16151660    organization= {University of Waterloo},
     1661    address     = {Waterloo Ontario, Canada},
    16161662    month       = sep,
    16171663    year        = 2018,
     
    19331979    title       = {Cooperating Sequential Processes},
    19341980    institution = {Technological University},
    1935     address     = {Eindhoven, Netherlands},
     1981    address     = {Eindhoven, Neth.},
    19361982    year        = 1965,
    19371983    note        = {Reprinted in \cite{Genuys68} pp. 43--112.}
     
    19421988    author      = {Adya, Atul and Howell, Jon and Theimer, Marvin and Bolosky, William J. and Douceur, John R.},
    19431989    title       = {Cooperative Task Management Without Manual Stack Management},
    1944     booktitle   = {Proceedings of the General Track of the Annual Conference on USENIX Annual Technical Conference},
     1990    booktitle   = {Proc. of the General Track USENIX Tech. Conf.},
    19451991    series      = {ATEC '02},
    19461992    year        = {2002},
     
    20462092    author      = {Walter Bright and Andrei Alexandrescu},
    20472093    organization= {Digital Mars},
     2094    address     = {Vienna Virginia, U.S.A.},
    20482095    year        = 2016,
    20492096    note        = {\href{http://dlang.org/spec/spec.html}{http://\-dlang.org/\-spec/\-spec.html}},
     
    24082455    year        = 1993,
    24092456    pages       = {201--208},
    2410     url         = {http://doi.acm.org/10.1145/155360.155580},
    24112457    publisher   = {ACM},
    24122458    address     = {New York, NY, USA},
     
    26062652    location    = {Boulder, Colorado, USA},
    26072653    pages       = {91--97},
    2608     numpages    = {7},
    26092654    publisher   = {ACM},
    26102655    address     = {New York, NY, USA},
     
    26372682    issn        = {0004-5411},
    26382683    pages       = {215--225},
    2639     numpages    = {11},
    2640     url         = {http://doi.acm.org/10.1145/321879.321884},
    2641     doi         = {10.1145/321879.321884},
    2642     acmid       = {321884},
    26432684    publisher   = {ACM},
    26442685    address     = {New York, NY, USA},
     
    27082749}
    27092750
     2751@misc{Drepper13,
     2752    keywords    = {thread-local storage},
     2753    contributer = {pabuhr@plg},
     2754    author      = {Ulrich Drepper},
     2755    title       = {{ELF} Handling For Thread-Local Storage},
     2756    year        = 2013,
     2757    month       = aug,
     2758    note        = {WikipediA},
     2759    howpublished= {\href{http://www.akkadia.org/drepper/tls.pdf}
     2760                  {http://\-www.akkadia.org/\-drepper/\-tls.pdf}},
     2761}
     2762
    27102763@misc{Turley99,
    27112764    keywords    = {embedded system, micrprocessor},
     
    27182771    howpublished= {\href{https://www.eetimes.com/author.asp?sectionid=36&doc_id=1287712}
    27192772                  {https://\-www.eetimes.com/\-author.asp?sectionid=\-36&doc_id=1287712}},
     2773}
     2774
     2775@article{Xiao19,
     2776    keywords    = {bug classification, fault trigger, Linux operating system, regression bug},
     2777    contributer = {pabuhr@plg},
     2778    author      = {Guanping Xiao and Zheng Zheng and Beibei Yin and Kishor S. Trivedi and Xiaoting Du and Kai-Yuan Cai},
     2779    title       = {An Empirical Study of Fault Triggers in the Linux Operating System: An Evolutionary Perspective},
     2780    journal     = {IEEE Transactions on Reliability},
     2781    month       = dec,
     2782    year        = 2019,
     2783    volume      = 68,
     2784    number      = 4,
     2785    pages       = {1356-1383},
    27202786}
    27212787
     
    31373203}
    31383204
     3205@inproceedings{Palix11,
     3206    keywords    = {Linux, fault-finding tools},
     3207    contributer = {pabuhr@plg},
     3208    author      = {Nicolas Palix and Ga\"el Thomas and Suman Saha and Christophe Calv\`es and Julia Lawall and Gilles Muller},
     3209    title       = {Faults in Linux: Ten Years Later},
     3210    booktitle   = {Proc. of the 16 International Conf. on Arch. Support for Prog. Lang. and Oper. Sys.},
     3211    series      = {ASPLOS'11},
     3212    month       = mar,
     3213    year        = 2011,
     3214    location    = {Newport Beach, California, USA},
     3215    pages       = {305-318},
     3216    publisher   = {ACM},
     3217    address     = {New York, NY, USA},
     3218}
     3219
    31393220@article{Lamport87,
    31403221    keywords    = {software solutions, mutual exclusion, fast},
     
    32583339    issn        = {0001-0782},
    32593340    pages       = {107--115},
    3260     numpages    = {9},
    3261     url         = {http://doi.acm.org/10.1145/1538788.1538814},
    3262     doi         = {10.1145/1538788.1538814},
    3263     acmid       = {1538814},
    32643341    publisher   = {ACM},
    32653342    address     = {New York, NY, USA},
     
    32833360    title       = {Programming Languages -- {Fortran} Part 1:Base Language ISO/IEC 1539-1:2010},
    32843361    edition     = {3rd},
    3285     publisher   = {International Standard Organization},
    3286     address     = {\href{https://www.iso.org/standard/50459.html}{https://\-www.iso.org/\-standard/\-50459.html}},
     3362    organization= {International Standard Organization},
     3363    address     = {Geneva, Switzerland},
    32873364    year        = 2010,
     3365    note        = {\href{https://www.iso.org/standard/50459.html}{https://\-www.iso.org/\-standard/\-50459.html}},
    32883366}
    32893367
     
    32943372    title       = {Programming Languages -- {Fortran} Part 1:Base Language ISO/IEC 1539-1:2018},
    32953373    edition     = {4rd},
    3296     publisher   = {International Standard Organization},
    3297     address     = {\href{https://www.iso.org/standard/72320.html}{https://\-www.iso.org/\-standard/\-72320.html}},
     3374    organization= {International Standard Organization},
     3375    address     = {Geneva, Switzerland},
    32983376    year        = 2018,
     3377    note        = {\href{https://www.iso.org/standard/72320.html}{https://\-www.iso.org/\-standard/\-72320.html}},
    32993378}
    33003379
     
    36643743}
    36653744
     3745@mastersthesis{Radhakrishnan19,
     3746    author      = {Srihari Radhakrishnan},
     3747    title       = {High Performance Web Servers: A Study In Concurrent Programming Models},
     3748    school      = {School of Computer Sc., University of Waterloo},
     3749    year        = 2019,
     3750    optaddress  = {Waterloo, Ontario, Canada, N2L 3G1},
     3751    note        = {\href{https://uwspace.uwaterloo.ca/handle/10012/14706}{https://\-uwspace.uwaterloo.ca/\-handle/\-10012/\-14706}},
     3752}
     3753
    36663754@article{katzenelson83b,
    36673755    contributer = {gjditchfield@plg},
     
    36973785    pages       = {115-138},
    36983786    year        = 1971,
     3787}
     3788
     3789@inproceedings{Hagersten03,
     3790    keywords    = {cache storage, parallel architectures, performance evaluation, shared memory systems},
     3791    author      = {Zoran Radovi\'{c} and Erik Hagersten},
     3792    title       = {Hierarchical backoff locks for nonuniform communication architectures},
     3793    booktitle   = {Proceedings of the Ninth International Symposium on High-Performance Computer Architecture},
     3794    year        = {2003},
     3795    location    = {Anaheim, CA, USA},
     3796    pages       = {241-252},
     3797    publisher   = {IEEE},
    36993798}
    37003799
     
    43654464}
    43664465
     4466@misc{gccValueLabels,
     4467    keywords    = {gcc extension, value labels},
     4468    contributer = {pabuhr@plg},
     4469    key         = {Labels as Values},
     4470    author      = {{gcc Extension}},
     4471    title       = {Labels as Values},
     4472    year        = {since gcc-3},
     4473    howpublished= {\href{https://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html}
     4474                  {https:\-//gcc.gnu.org/\-onlinedocs/\-gcc/\-Labels-as-Values.html}},
     4475}
     4476
    43674477@mastersthesis{Clarke90,
    43684478    keywords    = {concurrency, postponing requests},
     
    44234533}
    44244534
     4535@misc{libfibre,
     4536    key         = {libfibre},
     4537    author      = {Martin Karsten},
     4538    title       = {{libfibre:~User-Level Threading Runtime}},
     4539    howpublished= {\href{https://git.uwaterloo.ca/mkarsten/libfibre}
     4540                  {https://\-git.uwaterloo.ca/\-mkarsten/\-libfibre}},
     4541    note        = {[Online; accessed 2020-04-15]},
     4542}
     4543
    44254544@article{Linda,
    44264545    keywords    = {Linda, concurrency},
     
    44564575}
    44574576
     4577@inproceedings{Fang06,
     4578    author      = {Fang, Yi and McMillan, Kenneth L. and Pnueli, Amir and Zuck, Lenore D.},
     4579    editor      = {Najm, Elie and Pradat-Peyre, Jean-Fran{\c{c}}ois and Donzeau-Gouge, V{\'e}ronique Vigui{\'e}},
     4580    title       = {Liveness by Invisible Invariants},
     4581    booktitle   = {Formal Techniques for Networked and Distributed Systems - FORTE 2006},
     4582    year        = 2006,
     4583    publisher   = {Springer Berlin Heidelberg},
     4584    address     = {Berlin, Heidelberg},
     4585    pages       = {356--371},
     4586}
     4587
    44584588@article{Pierce00,
    4459     keywords    = {Scala},
     4589    keywords    = {Scala, polymorphism, subtyping, type inference},
    44604590    contributer = {a3moss@uwaterloo.ca},
    44614591    author      = {Pierce, Benjamin C. and Turner, David N.},
     
    44694599    issn        = {0164-0925},
    44704600    pages       = {1--44},
    4471     numpages    = {44},
    4472     url         = {http://doi.acm.org/10.1145/345099.345100},
    4473     doi         = {10.1145/345099.345100},
    4474     acmid       = {345100},
    44754601    publisher   = {ACM},
    44764602    address     = {New York, NY, USA},
    4477     keywords    = {polymorphism, subtyping, type inference},
    44784603}
     4604
     4605@article{Dice15,
     4606    keywords    = {Concurrency, NUMA, hierarchical locks, locks, multicore, mutex, mutual exclusion, spin locks},
     4607    author      = {Dice, David and Marathe, Virendra J. and Shavit, Nir},
     4608    title       = {Lock Cohorting: A General Technique for Designing NUMA Locks},
     4609    journal     = {ACM Trans. Parallel Comput.},
     4610    issue_date  = {January 2015},
     4611    volume      = 1,
     4612    number      = 2,
     4613    month       = feb,
     4614    year        = 2015,
     4615    pages       = {13:1--13:42},
     4616    publisher   = {ACM},
     4617    address     = {New York, NY, USA},
     4618}
    44794619
    44804620@article{Sundell08,
     
    45544694    journal     = sigplan,
    45554695    year        = 1989,
    4556     month       = jun, volume = 24, number = 6, pages = {37-48},
     4696    month       = jun,
     4697    volume      = 24,
     4698    number      = 6,
     4699    pages       = {37-48},
    45574700    abstract    = {
    45584701        This paper describes a scheme we have used to manage a large
     
    46104753    address     = {New York, NY, USA},
    46114754}
     4755
    46124756@techreport{Mesa,
    46134757    keywords    = {monitors, packages},
     
    46164760    title       = {Mesa Language Manual},
    46174761    institution = {Xerox Palo Alto Research Center},
     4762    address     = {Palo Alto, California, U.S.A.},
    46184763    number      = {CSL--79--3},
    46194764    month       = apr,
     
    46254770    contributer = {pabuhr@plg},
    46264771    author      = {Gregory R. Andrews},
    4627     title       = {A Method for Solving Synronization Problems},
     4772    title       = {A Method for Solving Synchronization Problems},
    46284773    journal     = scp,
    46294774    volume      = 13,
     
    49505095    title       = {Multiple Inheritance for {C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}}},
    49515096    booktitle   = {Proceedings of the Spring '87 EUUG Conference},
    4952     month       = may, year = 1987
     5097    month       = may,
     5098    year        = 1987,
    49535099}
    49545100
     
    49955141    year        = 1986,
    49965142    pages       = {313--326},
    4997     numpages    = {14},
    49985143    publisher   = {ACM},
    49995144    address     = {New York, NY, USA},
     
    50115156    year        = 1986,
    50125157    pages       = {327--348},
    5013     numpages    = {22},
    50145158    publisher   = {ACM},
    50155159    address     = {New York, NY, USA},
     
    52085352    year        = 2005,
    52095353    pages       = {146-196},
    5210     numpages    = {51},
    52115354    publisher   = {ACM},
    52125355    address     = {New York, NY, USA},
     
    53545497    year        = 2000,
    53555498    pages       = {29-46},
    5356     note        = {OOPSLA'00, Oct. 15--19, 2000, Minneapolis, Minnesota, U.S.A.},
     5499    note        = {OOPSLA'00, Oct. 15--19, 2000, Minneapolis, Minn., U.S.A.},
    53575500}
    53585501
     
    54685611    location    = {San Diego, California, USA},
    54695612    pages       = {101--112},
    5470     numpages    = {12},
    5471     url         = {http://doi.acm.org/10.1145/2535838.2535878},
    5472     doi         = {10.1145/2535838.2535878},
    5473     acmid       = {2535878},
    54745613    publisher   = {ACM},
    54755614    address     = {New York, NY, USA},
     
    55755714    issn        = {0362-1340},
    55765715    pages       = {30--42},
    5577     numpages    = {13},
    5578     url         = {http://doi.acm.org/10.1145/947586.947589},
    5579     doi         = {10.1145/947586.947589},
    55805716    publisher   = {ACM},
    55815717    address     = {New York, NY, USA}
     
    61146250}
    61156251
     6252@article{Bauer15,
     6253    keywords    = {resumption exceptions, theory},
     6254    contributer = {pabuhr@plg},
     6255    author      = {Andrej Bauer and Matija Pretnar},
     6256    title       = {Programming with Algebraic Effects and Handlers},
     6257    journal     = {Journal of Logical and Algebraic Methods in Programming},
     6258    publisher   = {Elsevier BV},
     6259    volume      = 84,
     6260    number      = 1,
     6261    month       = jan,
     6262    year        = 2015,
     6263    pages       = {108-123},
     6264}
     6265
    61166266@book{Butenhof97,
    61176267    keywords    = {PThreads, concurrency},
     
    61626312    title       = {{C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} Programming Language ISO/IEC 14882:1998},
    61636313    edition     = {1st},
    6164     publisher   = {International Standard Organization},
    6165     address     = {\href{https://www.iso.org/standard/25845.html}{https://\-www.iso.org/\-standard/\-25845.html}},
     6314    organization  = {International Standard Organization},
     6315    address     = {Geneva, Switzerland},
    61666316    year        = 1998,
     6317    note        = {\href{https://www.iso.org/standard/25845.html}{https://\-www.iso.org/\-standard/\-25845.html}},
    61676318}
    61686319
     
    61736324    title       = {{C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} Programming Language ISO/IEC 14882:2014},
    61746325    edition     = {4th},
    6175     publisher   = {International Standard Organization},
    6176     address     = {\href{https://www.iso.org/standard/64029.html}{https://\-www.iso.org/\-standard/\-64029.html}},
     6326    organization= {International Standard Organization},
     6327    address     = {Geneva, Switzerland},
    61776328    year        = 2014,
     6329    note        = {\href{https://www.iso.org/standard/64029.html}{https://\-www.iso.org/\-standard/\-64029.html}},
    61786330}
    61796331
     
    61846336    title       = {{C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} Programming Language ISO/IEC 14882:2017},
    61856337    edition     = {5th},
    6186     publisher   = {International Standard Organization},
    6187     address     = {\href{https://www.iso.org/standard/68564.html}{https://\-www.iso.org/\-standard/\-68564.html}},
     6338    organization= {International Standard Organization},
     6339    address     = {Geneva, Switzerland},
    61886340    year        = 2017,
     6341    note        = {\href{https://www.iso.org/standard/68564.html}{https://\-www.iso.org/\-standard/\-68564.html}},
    61896342}
    61906343
     
    63186471    title       = {The Programming Language Concurrent Pascal},
    63196472    journal     = ieeese,
    6320     volume      = 2,
     6473    volume      = {SE-1},
     6474    number      = 2,
    63216475    month       = jun,
    63226476    year        = 1975,
    6323     pages       = {199-206}
     6477    pages       = {199-207}
    63246478}
    63256479
     
    64996653    issn        = {0164-0925},
    65006654    pages       = {429-475},
    6501     url         = {http://doi.acm.org/10.1145/1133651.1133653},
    6502     doi         = {10.1145/1133651.1133653},
    6503     acmid       = {1133653},
    65046655    publisher   = {ACM},
    65056656    address     = {New York, NY, USA},
     
    65316682}
    65326683
     6684@article{Aravind09,
     6685    author      = {Alex A. Aravind and Wim H. Hesselink},
     6686    title       = {A Queue Based Mutual Exclusion Algorithm},
     6687    journal     = acta,
     6688    volume      = 46,
     6689    pages       = {73--86},
     6690    year        = 2009,
     6691}
     6692
    65336693% R
    65346694
     
    65746734    title       = {Programming languages -- {Ada} ISO/IEC 8652:2012},
    65756735    edition     = {3rd},
    6576     publisher   = {International Standard Organization},
    6577     address     = {\href{https://www.iso.org/standard/61507.html}{https://\-www.iso.org/\-standard/\-61507.html}},
     6736    organization= {International Standard Organization},
     6737    address     = {Geneva, Switzerland},
    65786738    year        = 2012,
     6739    note        = {\href{https://www.iso.org/standard/61507.html}{https://\-www.iso.org/\-standard/\-61507.html}},
    65796740}
    65806741
     
    68797040    issn        = {0001-0782},
    68807041    pages       = {565--569},
    6881     numpages    = {5},
    6882     url         = {http://doi.acm.org/10.1145/359545.359566},
    6883     doi         = {10.1145/359545.359566},
    6884     acmid       = {359566},
    68857042    publisher   = {ACM},
    68867043    address     = {New York, NY, USA}
     
    69007057    issn        = {0362-1340},
    69017058    pages       = {145--147},
    6902     numpages    = {3},
    6903     url         = {http://doi.acm.org/10.1145/122598.122614},
    6904     doi         = {10.1145/122598.122614},
    6905     acmid       = {122614},
    69067059    publisher   = {ACM},
    69077060    address     = {New York, NY, USA},
     
    70067159    issn        = {0362-1340},
    70077160    pages       = {82--87},
    7008     numpages    = {6},
    7009     url         = {http://doi.acm.org/10.1145/947680.947688},
    7010     doi         = {10.1145/947680.947688},
    70117161    publisher   = {ACM},
    70127162    address     = {New York, NY, USA},
     
    71537303}
    71547304
     7305@article{Cascaval08,
     7306    author      = {Cascaval, Calin and Blundell, Colin and Michael, Maged and Cain, Harold W. and Wu, Peng and Chiras, Stefanie and Chatterjee, Siddhartha},
     7307    title       = {Software Transactional Memory: Why Is It Only a Research Toy?},
     7308    journal     = {Queue},
     7309    volume      = {6},
     7310    number      = {5},
     7311    month       = sep,
     7312    year        = {2008},
     7313    pages       = {40:46--40:58},
     7314    publisher   = {ACM},
     7315    address     = {New York, NY, USA},
     7316}
     7317
    71557318@article{Dijkstra65a,
    71567319    keywords    = {N-thread software-solution mutual exclusion},
     
    73637526    year        = 1974,
    73647527    pages       = {261-301},
    7365     issn        = {0360-0300},
    7366     doi         = {http://doi.acm.org/10.1145/356635.356640},
    73677528    publisher   = {ACM},
    73687529    address     = {New York, NY, USA},
     
    74547615    publisher   = {ACM Press},
    74557616    address     = {New York, NY, USA},
    7456     doi         = {http://doi.acm.org/10.1145/356586.356588},
    74577617}
    74587618
     
    75827742    title       = {The Thoth System: Multi-Process Structuring and Portability},
    75837743    publisher   = {American Elsevier},
     7744    address     = {New York, New York, U.S.A.},
    75847745    year        = 1982
    75857746}
     
    77557916    howpublished= {\href{https://projects.eclipse.org/proposals/trace-compass}{https://\-projects.eclipse.org/\-proposals/\-trace-compass}},
    77567917}
    7757  
     7918
     7919@inproceedings{Boehm09,
     7920    author      = {Boehm, Hans-J.},
     7921    title       = {Transactional Memory Should Be an Implementation Technique, Not a Programming Interface},
     7922    booktitle   = {Proceedings of the First USENIX Conference on Hot Topics in Parallelism},
     7923    series      = {HotPar'09},
     7924    year        = {2009},
     7925    location    = {Berkeley, California},
     7926    publisher   = {USENIX Association},
     7927    address     = {Berkeley, CA, USA},
     7928}
     7929
    77587930@article{Leroy00,
    77597931    keywords    = {type-systems, exceptions},
     
    78057977    number      = {2},
    78067978    pages       = {204-214},
    7807     month       = apr, year = 1988,
     7979    month       = apr,
     7980    year        = 1988,
    78087981    comment     = {
    78097982        Extended record types add fields to their base record.  Assignment
     
    79048077}
    79058078
     8079@article{Karsten20,
     8080    author      = {Karsten, Martin and Barghi, Saman},
     8081    title       = {{User-level Threading: Have Your Cake and Eat It Too}},
     8082    year        = {2020},
     8083    issue_date  = {March 2020},
     8084    publisher   = {Association for Computing Machinery},
     8085    address     = {New York, NY, USA},
     8086    volume      = {4},
     8087    number      = {1},
     8088    url         = {https://doi.org/10.1145/3379483},
     8089    doi         = {10.1145/3379483},
     8090    journal     = {Proc. ACM Meas. Anal. Comput. Syst.},
     8091    month       = mar,
     8092    numpages    = {30},
     8093}
     8094
    79068095@techreport{Harmony,
    79078096    keywords    = {messages, concurrency},
     
    79198108    contributer = {gjditchfield@plg},
    79208109    author      = {Henry Lieverman},
    7921     title       = {Using Prototypical Objects to Implement Shared Behavior in
    7922                   Object Oriented Systems},
     8110    title       = {Using Prototypical Objects to Implement Shared Behavior in Object Oriented Systems},
    79238111    journal     = sigplan,
    7924     month       = nov, year = 1986,
    7925     volume      = 21, number = 11, pages = {214-223}
     8112    month       = nov,
     8113    year        = 1986,
     8114    volume      = 21,
     8115    number      = 11,
     8116    pages       = {214-223}
    79268117}
    79278118
     
    81108301    issn        = {0004-5411},
    81118302    pages       = {245--281},
    8112     numpages    = {37},
    8113     url         = {http://doi.acm.org/10.1145/62.2160},
    8114     doi         = {10.1145/62.2160},
    8115     acmid       = {2160},
    81168303    publisher   = {ACM},
    81178304    address     = {New York, NY, USA},
     
    81268313    contributer = {pabuhr@plg},
    81278314    author      = {Boehm, Hans-J. and Adve, Sarita V.},
    8128     title       = {You Don'T Know Jack About Shared Variables or Memory Models},
     8315    title       = {You Don't Know Jack About Shared Variables or Memory Models},
    81298316    journal     = cacm,
    81308317    volume      = 55,
  • doc/man/cfa.1

    rbdfc032 reef8dfb  
    1111.\" Created On       : Wed Jul 26 22:34:47 2017
    1212.\" Last Modified By : Peter A. Buhr
    13 .\" Last Modified On : Thu Jul 27 10:29:29 2017
    14 .\" Update Count     : 44
     13.\" Last Modified On : Wed Sep  2 17:59:53 2020
     14.\" Update Count     : 78
    1515.\"
    1616.\" nroff -man cfa.1
     
    2323.ds Cf "Cforall
    2424.\"
    25 .TH cfa 1 2017-07-27 cfa-\*(Mg
     25.TH CFA 1 "2020-09-2" cfa-\*(Mg "\*(Cf Project"
    2626.SH NAME
    27 cfa \- \*(Cf Translator and Runtime Library
     27cfa \- \*(Cf project translator and runtime library to enhance C
    2828.SH SYNOPSIS
    29 cfa [gcc-options] [C/\*(Cf source-files] [assembler/loader files]
     29cfa [cfa/gcc-options]
     30    [cfa/c source-files]
     31    [assembler/loader files]
    3032.SH DESCRIPTION
     33\*(Cf (C-for-all) is an open-source project extending ISO C with modern safety and productivity features, while still ensuring backwards compatibility with C and its programmers.
     34
    3135The cfa command compiles C and \*(Cf source files and links C/\*(Cf object
    3236files named on the command line.
     
    3438The cfa command introduces a translator pass over the specified source files
    3539after the C preprocessor but before the C compilation.  The translator converts
    36 new \*(Cf constructs into C statements.  The cfa command also provides the
    37 runtime library, which is linked with each \*(Cf application.
     40new \*(Cf constructs into C statements.  The cfa command also provides a fully
     41concurrent (user-level threads) runtime library, which is linked with the
     42\*(Cf application.
    3843
    3944The command line options depend on the particular C compiler used (gcc/clang
    4045supported).  As with most C compilers, the output is sent to the file a.out(5)
    4146unless the -o option is present on the command line.  See the reference pages
    42 for gcc(1) for more information.
     47for gcc(1) for more information on command line options.
    4348.SH OPTIONS
    4449When multiple conflicting options appear on the command line, e.g.,
     
    5055All of the options available to the gcc compiler are available to the cfa
    5156translator.  The following gcc flags are implicitly turned on:
    52 .IP -std=gnu99 3
    53 The 1999 C standard plus GNU extensions.
    54 .IP -fgnu89-inline
    55 Use the traditional GNU semantics for inline routines in C99 mode, which allows inline routines in header files.
     57.IP "-std=gnu11" 3
     58The 2011 C standard plus GNU extensions.
     59.IP "-fgnu89-inline"
     60Use the traditional GNU semantics for inline routines in C11 mode, which allows inline routines in header files.
     61.IP "-imacros stdbool.h"
     62Include stdbool.h to get defines for bool/true/false.
     63.IP "-latomic -lm"
     64Provide access to double-wide CAS instruction and math library.
    5665.LP
    5766The following additional options are available:
    58 .IP -CFA 3
     67.IP "-CFA" 3
    5968Only the C preprocessor and the \*(Cf translator steps are performed and the transformed program is written to standard output, which makes it possible to examine the code generated by the \*(Cf translator.
    6069The generated code starts with the standard \*(Cf prelude.
    61 .IP -debug
     70.IP "-debug"
    6271The program is linked with the debugging version of the runtime system.
    6372The debug version performs runtime checks to help during the debugging phase of a \*(Cf program, but can substantially slow program execution.
    6473The runtime checks should only be removed after the program is completely debugged.
    6574.B This option is the default.
    66 .IP -nodebug
     75.IP "-nodebug"
    6776The program is linked with the non-debugging version of the runtime system, so the execution of the program is faster.
    6877.I However, no runtime checks or asserts are performed so errors usually result in abnormal program behaviour or termination.
    69 .IP -help
     78.IP "-help"
    7079Information about the set of \*(Cf compilation flags is printed.
    71 .IP -nohelp
     80.IP "-nohelp"
    7281Information about the set of \*(Cf compilation flags is not printed.
    7382.B This option is the default.
    74 .IP -quiet
     83.IP "-quiet"
    7584The \*(Cf compilation message is not printed at the beginning of a compilation.
    76 .IP -noquiet
     85.IP "-noquiet"
    7786The \*(Cf compilation message is printed at the beginning of a compilation.
    7887.B This option is the default.
     
    8190available.  These variables allow conditional compilation of programs that must
    8291work differently in these situations.
    83 .IP __CFA_MAJOR__ 3
     92.IP "__CFA_MAJOR__" 3
    8493is available during preprocessing and its value is the major version number of \*(Cf.
    85 .IP __CFA_MINOR__
     94.IP "__CFA_MINOR__"
    8695is available during preprocessing and its value is the minor version number of \*(Cf.
    87 .IP __CFA_PATCH__
     96.IP "__CFA_PATCH__"
    8897is available during preprocessing and its value is the patch level number of \*(Cf.
    8998.IP "__CFA__, __CFORALL__, and __cforall"
    9099are always available during preprocessing and have no value.
    91 .IP __CFA_DEBUG__
     100.IP "__CFA_DEBUG__"
    92101is available during preprocessing if the -debug compilation option is
    93102specified.
     
    116125.SH REFERENCES
    117126.HP 3
    118 \*(Cf Reference and Rational Manual
     127.I \*(Cf Home Page
    119128.br
    120 http://plg.uwaterloo.ca/~cforall/refrat.pdf
     129https://cforall.uwaterloo.ca
    121130.HP
    122131.I \*(Cf User Manual
    123132.br
    124 http://plg.uwaterloo.ca/~cforall/user.pdf
     133https://cforall.uwaterloo.ca/doc/user.pdf
     134.SH BUILDS
     135Nightly builds are available here https://cforall.uwaterloo.ca/jenkins
    125136.SH BUGS
    126 Bugs should be reported to trac@plg.cs.uwaterloo.ca.
     137Bugs reportss are available here https://cforall.uwaterloo.ca/trac
    127138.SH COPYRIGHT
    128139\*(Cf is covered under the licence agreement in the distribution.
    129140.SH AUTHORS
    130141Andrew Beach, Richard Bilson, Peter A. Buhr, Thierry Delisle, Glen Ditchfield,
    131 Rodolfo G. Esteves, Aaron Moss, Rob Schluntz
     142Rodolfo G. Esteves, Aaron Moss, Rob Schluntz, Mubeen Zulfiqar
  • doc/papers/AMA/AMA-stix/ama/WileyNJD-v2.cls

    rbdfc032 reef8dfb  
    24442444     \@afterheading}
    24452445
    2446 \renewcommand\section{\@startsection{section}{1}{\z@}{-25pt \@plus -2pt \@minus -2pt}{12\p@}{\sectionfont}}%
    2447 \renewcommand\subsection{\@startsection{subsection}{2}{\z@}{-22pt \@plus -2pt \@minus -2pt}{5\p@}{\subsectionfont}}%
    2448 \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}{-20pt \@plus -2pt \@minus -2pt}{2\p@}{\subsubsectionfont}}%
     2446\renewcommand\section{\@startsection{section}{1}{\z@}{-20pt \@plus -2pt \@minus -2pt}{7\p@}{\sectionfont}}%
     2447\renewcommand\subsection{\@startsection{subsection}{2}{\z@}{-18pt \@plus -2pt \@minus -2pt}{5\p@}{\subsectionfont}}%
     2448\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}{-16pt \@plus -2pt \@minus -2pt}{2\p@}{\subsubsectionfont}}%
    24492449%
    24502450\newskip\secruleskip\secruleskip8.5\p@%
  • doc/papers/concurrency/Paper.tex

    rbdfc032 reef8dfb  
    6161\newcommand{\CCseventeen}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}17\xspace} % C++17 symbolic name
    6262\newcommand{\CCtwenty}{\textrm{C}\kern-.1em\hbox{+\kern-.25em+}20\xspace} % C++20 symbolic name
    63 \newcommand{\Csharp}{C\raisebox{-0.7ex}{\Large$^\sharp$}\xspace} % C# symbolic name
     63\newcommand{\Csharp}{C\raisebox{-0.7ex}{\large$^\sharp$}\xspace} % C# symbolic name
    6464
    6565%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    9999\newcommand{\CRT}{\global\columnposn=\gcolumnposn}
    100100
    101 % Denote newterms in particular font and index them without particular font and in lowercase, e.g., \newterm{abc}.
    102 % The option parameter provides an index term different from the new term, e.g., \newterm[\texttt{abc}]{abc}
     101% Denote newterms in particular font and index them without particular font and in lowercase, \eg \newterm{abc}.
     102% The option parameter provides an index term different from the new term, \eg \newterm[\texttt{abc}]{abc}
    103103% The star version does not lowercase the index information, e.g., \newterm*{IBM}.
    104104\newcommand{\newtermFontInline}{\emph}
     
    110110\newcommand{\abbrevFont}{\textit}                       % set empty for no italics
    111111\@ifundefined{eg}{
    112 \newcommand{\EG}{\abbrevFont{e}\abbrevFont{g}}
     112%\newcommand{\EG}{\abbrevFont{e}\abbrevFont{g}}
     113\newcommand{\EG}{for example}
    113114\newcommand*{\eg}{%
    114115        \@ifnextchar{,}{\EG}%
     
    117118}}{}%
    118119\@ifundefined{ie}{
    119 \newcommand{\IE}{\abbrevFont{i}\abbrevFont{e}}
     120%\newcommand{\IE}{\abbrevFont{i}\abbrevFont{e}}
     121\newcommand{\IE}{that is}
    120122\newcommand*{\ie}{%
    121123        \@ifnextchar{,}{\IE}%
     
    127129\newcommand*{\etc}{%
    128130        \@ifnextchar{.}{\ETC}%
    129         {\ETC.\xspace}%
     131                {\ETC.\xspace}%
    130132}}{}%
    131133\@ifundefined{etal}{
    132134\newcommand{\ETAL}{\abbrevFont{et}~\abbrevFont{al}}
    133135\newcommand*{\etal}{%
    134         \@ifnextchar{.}{\protect\ETAL}%
    135                 {\protect\ETAL.\xspace}%
     136        \@ifnextchar{.}{\ETAL}%
     137                {\ETAL.\xspace}%
    136138}}{}%
    137139\@ifundefined{viz}{
     
    163165                __float80, float80, __float128, float128, forall, ftype, generator, _Generic, _Imaginary, __imag, __imag__,
    164166                inline, __inline, __inline__, __int128, int128, __label__, monitor, mutex, _Noreturn, one_t, or,
    165                 otype, restrict, __restrict, __restrict__, __signed, __signed__, _Static_assert, thread,
     167                otype, restrict, resume, __restrict, __restrict__, __signed, __signed__, _Static_assert, suspend, thread,
    166168                _Thread_local, throw, throwResume, timeout, trait, try, ttype, typeof, __typeof, __typeof__,
    167169                virtual, __volatile, __volatile__, waitfor, when, with, zero_t},
    168170        moredirectives={defined,include_next},
    169171        % replace/adjust listing characters that look bad in sanserif
    170         literate={-}{\makebox[1ex][c]{\raisebox{0.4ex}{\rule{0.8ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1
     172        literate={-}{\makebox[1ex][c]{\raisebox{0.5ex}{\rule{0.8ex}{0.1ex}}}}1 {^}{\raisebox{0.6ex}{$\scriptstyle\land\,$}}1
    171173                {~}{\raisebox{0.3ex}{$\scriptstyle\sim\,$}}1 % {`}{\ttfamily\upshape\hspace*{-0.1ex}`}1
    172174                {<}{\textrm{\textless}}1 {>}{\textrm{\textgreater}}1
     
    197199                _Else, _Enable, _Event, _Finally, _Monitor, _Mutex, _Nomutex, _PeriodicTask, _RealTimeTask,
    198200                _Resume, _Select, _SporadicTask, _Task, _Timeout, _When, _With, _Throw},
    199 }
    200 \lstdefinelanguage{Golang}{
    201         morekeywords=[1]{package,import,func,type,struct,return,defer,panic,recover,select,var,const,iota,},
    202         morekeywords=[2]{string,uint,uint8,uint16,uint32,uint64,int,int8,int16,int32,int64,
    203                 bool,float32,float64,complex64,complex128,byte,rune,uintptr, error,interface},
    204         morekeywords=[3]{map,slice,make,new,nil,len,cap,copy,close,true,false,delete,append,real,imag,complex,chan,},
    205         morekeywords=[4]{for,break,continue,range,goto,switch,case,fallthrough,if,else,default,},
    206         morekeywords=[5]{Println,Printf,Error,},
    207         sensitive=true,
    208         morecomment=[l]{//},
    209         morecomment=[s]{/*}{*/},
    210         morestring=[b]',
    211         morestring=[b]",
    212         morestring=[s]{`}{`},
    213201}
    214202
     
    238226{}
    239227\lstnewenvironment{C++}[1][]                            % use C++ style
    240 {\lstset{language=C++,moredelim=**[is][\protect\color{red}]{`}{`},#1}\lstset{#1}}
     228{\lstset{language=C++,moredelim=**[is][\protect\color{red}]{`}{`}}\lstset{#1}}
    241229{}
    242230\lstnewenvironment{uC++}[1][]
    243 {\lstset{#1}}
     231{\lstset{language=uC++,moredelim=**[is][\protect\color{red}]{`}{`}}\lstset{#1}}
    244232{}
    245233\lstnewenvironment{Go}[1][]
    246 {\lstset{language=Golang,moredelim=**[is][\protect\color{red}]{`}{`},#1}\lstset{#1}}
     234{\lstset{language=Golang,moredelim=**[is][\protect\color{red}]{`}{`}}\lstset{#1}}
    247235{}
    248236\lstnewenvironment{python}[1][]
    249 {\lstset{language=python,moredelim=**[is][\protect\color{red}]{`}{`},#1}\lstset{#1}}
     237{\lstset{language=python,moredelim=**[is][\protect\color{red}]{`}{`}}\lstset{#1}}
     238{}
     239\lstnewenvironment{java}[1][]
     240{\lstset{language=java,moredelim=**[is][\protect\color{red}]{`}{`}}\lstset{#1}}
    250241{}
    251242
     
    262253}
    263254
    264 \newbox\myboxA
    265 \newbox\myboxB
    266 \newbox\myboxC
    267 \newbox\myboxD
     255\newsavebox{\myboxA}
     256\newsavebox{\myboxB}
     257\newsavebox{\myboxC}
     258\newsavebox{\myboxD}
    268259
    269260\title{\texorpdfstring{Advanced Control-flow and Concurrency in \protect\CFA}{Advanced Control-flow in Cforall}}
     
    275266\address[1]{\orgdiv{Cheriton School of Computer Science}, \orgname{University of Waterloo}, \orgaddress{\state{Waterloo, ON}, \country{Canada}}}
    276267
    277 \corres{*Peter A. Buhr, Cheriton School of Computer Science, University of Waterloo, 200 University Avenue West, Waterloo, ON, N2L 3G1, Canada. \email{pabuhr{\char`\@}uwaterloo.ca}}
     268\corres{*Peter A. Buhr, Cheriton School of Computer Science, University of Waterloo, 200 University Avenue West, Waterloo, ON N2L 3G1, Canada. \email{pabuhr{\char`\@}uwaterloo.ca}}
    278269
    279270% \fundingInfo{Natural Sciences and Engineering Research Council of Canada}
    280271
    281272\abstract[Summary]{
    282 \CFA is a polymorphic, non-object-oriented, concurrent, backwards-compatible extension of the C programming language.
     273\CFA is a polymorphic, nonobject-oriented, concurrent, backwards compatible extension of the C programming language.
    283274This paper discusses the design philosophy and implementation of its advanced control-flow and concurrent/parallel features, along with the supporting runtime written in \CFA.
    284 These features are created from scratch as ISO C has only low-level and/or unimplemented concurrency, so C programmers continue to rely on library features like pthreads.
     275These features are created from scratch as ISO C has only low-level and/or unimplemented concurrency, so C programmers continue to rely on library approaches like pthreads.
    285276\CFA introduces modern language-level control-flow mechanisms, like generators, coroutines, user-level threading, and monitors for mutual exclusion and synchronization.
    286277% Library extension for executors, futures, and actors are built on these basic mechanisms.
    287278The runtime provides significant programmer simplification and safety by eliminating spurious wakeup and monitor barging.
    288 The runtime also ensures multiple monitors can be safely acquired \emph{simultaneously} (deadlock free), and this feature is fully integrated with all monitor synchronization mechanisms.
     279The runtime also ensures multiple monitors can be safely acquired in a deadlock-free way, and this feature is fully integrated with all monitor synchronization mechanisms.
    289280All control-flow features integrate with the \CFA polymorphic type-system and exception handling, while respecting the expectations and style of C programmers.
    290281Experimental results show comparable performance of the new features with similar mechanisms in other concurrent programming languages.
    291282}%
    292283
    293 \keywords{generator, coroutine, concurrency, parallelism, thread, monitor, runtime, C, \CFA (Cforall)}
     284\keywords{C \CFA (Cforall) coroutine concurrency generator monitor parallelism runtime thread}
    294285
    295286
    296287\begin{document}
    297 \linenumbers                                            % comment out to turn off line numbering
     288%\linenumbers                           % comment out to turn off line numbering
    298289
    299290\maketitle
     
    302293\section{Introduction}
    303294
    304 This paper discusses the design philosophy and implementation of advanced language-level control-flow and concurrent/parallel features in \CFA~\cite{Moss18,Cforall} and its runtime, which is written entirely in \CFA.
    305 \CFA is a modern, polymorphic, non-object-oriented\footnote{
    306 \CFA has features often associated with object-oriented programming languages, such as constructors, destructors, virtuals and simple inheritance.
    307 However, functions \emph{cannot} be nested in structures, so there is no lexical binding between a structure and set of functions (member/method) implemented by an implicit \lstinline@this@ (receiver) parameter.},
    308 backwards-compatible extension of the C programming language.
    309 In many ways, \CFA is to C as Scala~\cite{Scala} is to Java, providing a \emph{research vehicle} for new typing and control-flow capabilities on top of a highly popular programming language allowing immediate dissemination.
    310 Within the \CFA framework, new control-flow features are created from scratch because ISO \Celeven defines only a subset of the \CFA extensions, where the overlapping features are concurrency~\cite[\S~7.26]{C11}.
    311 However, \Celeven concurrency is largely wrappers for a subset of the pthreads library~\cite{Butenhof97,Pthreads}, and \Celeven and pthreads concurrency is simple, based on thread fork/join in a function and mutex/condition locks, which is low-level and error-prone;
    312 no high-level language concurrency features are defined.
    313 Interestingly, almost a decade after publication of the \Celeven standard, neither gcc-8, clang-9 nor msvc-19 (most recent versions) support the \Celeven include @threads.h@, indicating little interest in the C11 concurrency approach (possibly because the effort to add concurrency to \CC).
    314 Finally, while the \Celeven standard does not state a threading model, the historical association with pthreads suggests implementations would adopt kernel-level threading (1:1)~\cite{ThreadModel}.
    315 
     295\CFA~\cite{Moss18,Cforall} is a modern, polymorphic, nonobject-oriented\footnote{
     296\CFA has object-oriented features, such as constructors, destructors, and simple trait/interface inheritance.
     297% Go interfaces, Rust traits, Swift Protocols, Haskell Type Classes and Java Interfaces.
     298% "Trait inheritance" works for me. "Interface inheritance" might also be a good choice, and distinguish clearly from implementation inheritance.
     299% You'll want to be a little bit careful with terms like "structural" and "nominal" inheritance as well. CFA has structural inheritance (I think Go as well) -- it's inferred based on the structure of the code.
     300% Java, Rust, and Haskell (not sure about Swift) have nominal inheritance, where there needs to be a specific statement that "this type inherits from this type".
     301However, functions \emph{cannot} be nested in structures and there is no mechanism to designate a function parameter as a receiver, \lstinline@this@, parameter.},
     302, backward-compatible extension of the C programming language.
     303In many ways, \CFA is to C as Scala~\cite{Scala} is to Java, providing a vehicle for new typing and control-flow capabilities on top of a highly popular programming language\footnote{
     304The TIOBE index~\cite{TIOBE} for May 2020 ranks the top five \emph{popular} programming languages as C 17\%, Java 16\%, Python 9\%, \CC 6\%, and \Csharp 4\% = 52\%, and over the past 30 years, C has always ranked either first or second in popularity.}
     305allowing immediate dissemination.
     306This paper discusses the design philosophy and implementation of \CFA's advanced control-flow and concurrent/parallel features, along with the supporting runtime written in \CFA.
     307
     308% The call/return extensions retain state between callee and caller versus losing the callee's state on return;
     309% the concurrency extensions allow high-level management of threads.
     310
     311The \CFA control-flow framework extends ISO \Celeven~\cite{C11} with new call/return and concurrent/parallel control-flow.
     312Call/return control-flow with argument and parameter passing appeared in the first programming languages.
     313Over the past 50 years, call/return has been augmented with features like static and dynamic call, exceptions (multilevel return) and generators/coroutines (see Section~\ref{s:StatefulFunction}).
     314While \CFA has mechanisms for dynamic call (algebraic effects~\cite{Zhang19}) and exceptions\footnote{
     315\CFA exception handling will be presented in a separate paper.
     316The key feature that dovetails with this paper is nonlocal exceptions allowing exceptions to be raised across stacks, with synchronous exceptions raised among coroutines and asynchronous exceptions raised among threads, similar to that in \uC~\cite[\S~5]{uC++}}
     317, this work only discusses retaining state between calls via generators and coroutines.
     318\newterm{Coroutining} was introduced by Conway~\cite{Conway63}, discussed by Knuth~\cite[\S~1.4.2]{Knuth73V1}, implemented in Simula67~\cite{Simula67}, formalized by Marlin~\cite{Marlin80}, and is now popular and appears in old and new programming languages: CLU~\cite{CLU}, \Csharp~\cite{Csharp}, Ruby~\cite{Ruby}, Python~\cite{Python}, JavaScript~\cite{JavaScript}, Lua~\cite{Lua}, \CCtwenty~\cite{C++20Coroutine19}.
     319Coroutining is sequential execution requiring direct handoff among coroutines, \ie only the programmer is controlling execution order.
     320If coroutines transfer to an internal event-engine for scheduling the next coroutines (as in async-await), the program transitions into the realm of concurrency~\cite[\S~3]{Buhr05a}.
     321Coroutines are only a stepping stone toward concurrency where the commonality is that coroutines and threads retain state between calls.
     322
     323\Celeven and \CCeleven define concurrency~\cite[\S~7.26]{C11}, but it is largely wrappers for a subset of the pthreads library~\cite{Pthreads}.\footnote{Pthreads concurrency is based on simple thread fork and join in a function and mutex or condition locks, which is low-level and error-prone}
     324Interestingly, almost a decade after the \Celeven standard, the most recent versions of gcc, clang, and msvc do not support the \Celeven include @threads.h@, indicating no interest in the C11 concurrency approach (possibly because of the recent effort to add concurrency to \CC).
     325While the \Celeven standard does not state a threading model, the historical association with pthreads suggests implementations would adopt kernel-level threading (1:1)~\cite{ThreadModel}, as for \CC.
    316326In contrast, there has been a renewed interest during the past decade in user-level (M:N, green) threading in old and new programming languages.
    317 As multi-core hardware became available in the 1980/90s, both user and kernel threading were examined.
     327As multicore hardware became available in the 1980/1990s, both user and kernel threading were examined.
    318328Kernel threading was chosen, largely because of its simplicity and fit with the simpler operating systems and hardware architectures at the time, which gave it a performance advantage~\cite{Drepper03}.
    319329Libraries like pthreads were developed for C, and the Solaris operating-system switched from user (JDK 1.1~\cite{JDK1.1}) to kernel threads.
    320 As a result, languages like Java, Scala, Objective-C~\cite{obj-c-book}, \CCeleven~\cite{C11}, and C\#~\cite{Csharp} adopt the 1:1 kernel-threading model, with a variety of presentation mechanisms.
    321 From 2000 onwards, languages like Go~\cite{Go}, Erlang~\cite{Erlang}, Haskell~\cite{Haskell}, D~\cite{D}, and \uC~\cite{uC++,uC++book} have championed the M:N user-threading model, and many user-threading libraries have appeared~\cite{Qthreads,MPC,Marcel}, including putting green threads back into Java~\cite{Quasar}.
    322 The main argument for user-level threading is that it is lighter weight than kernel threading (locking and context switching do not cross the kernel boundary), so there is less restriction on programming styles that encourage large numbers of threads performing medium work units to facilitate load balancing by the runtime~\cite{Verch12}.
     330As a result, many languages adopt the 1:1 kernel-threading model, like Java (Scala), Objective-C~\cite{obj-c-book}, \CCeleven~\cite{C11}, C\#~\cite{Csharp} and Rust~\cite{Rust}, with a variety of presentation mechanisms.
     331From 2000 onward, several language implementations have championed the M:N user-threading model, like Go~\cite{Go}, Erlang~\cite{Erlang}, Haskell~\cite{Haskell}, D~\cite{D}, and \uC~\cite{uC++,uC++book}, including putting green threads back into Java~\cite{Quasar}, and many user-threading libraries have appeared~\cite{Qthreads,MPC,Marcel}.
     332The main argument for user-level threading is that it is lighter weight than kernel threading because locking and context switching do not cross the kernel boundary, so there is less restriction on programming styles that encourages large numbers of threads performing medium-sized work to facilitate load balancing by the runtime~\cite{Verch12}.
    323333As well, user-threading facilitates a simpler concurrency approach using thread objects that leverage sequential patterns versus events with call-backs~\cite{Adya02,vonBehren03}.
    324 Finally, performant user-threading implementations (both time and space) meet or exceed direct kernel-threading implementations, while achieving the programming advantages of high concurrency levels and safety.
    325 
    326 A further effort over the past two decades is the development of language memory models to deal with the conflict between language features and compiler/hardware optimizations, \ie some language features are unsafe in the presence of aggressive sequential optimizations~\cite{Buhr95a,Boehm05}.
    327 The consequence is that a language must provide sufficient tools to program around safety issues, as inline and library code is all sequential to the compiler.
    328 One solution is low-level qualifiers and functions (\eg @volatile@ and atomics) allowing \emph{programmers} to explicitly write safe (race-free~\cite{Boehm12}) programs.
    329 A safer solution is high-level language constructs so the \emph{compiler} knows the optimization boundaries, and hence, provides implicit safety.
    330 This problem is best known with respect to concurrency, but applies to other complex control-flow, like exceptions\footnote{
    331 \CFA exception handling will be presented in a separate paper.
    332 The key feature that dovetails with this paper is nonlocal exceptions allowing exceptions to be raised across stacks, with synchronous exceptions raised among coroutines and asynchronous exceptions raised among threads, similar to that in \uC~\cite[\S~5]{uC++}
    333 } and coroutines.
    334 Finally, language solutions allow matching constructs with language paradigm, \ie imperative and functional languages often have different presentations of the same concept to fit their programming model.
     334Finally, performant user-threading implementations, both in time and space, meet or exceed direct kernel-threading implementations, while achieving the programming advantages of high concurrency levels and safety.
     335
     336A further effort over the past two decades is the development of language memory models to deal with the conflict between language features and compiler/hardware optimizations, \eg some language features are unsafe in the presence of aggressive sequential optimizations~\cite{Buhr95a,Boehm05}.
     337The consequence is that a language must provide sufficient tools to program around safety issues, as inline and library code is compiled as sequential without any explicit concurrent directive.
     338One solution is low-level qualifiers and functions, \eg @volatile@ and atomics, allowing \emph{programmers} to explicitly write safe, race-free~\cite{Boehm12} programs.
     339A safer solution is high-level language constructs so the \emph{compiler} knows the concurrency boundaries, \ie where mutual exclusion and synchronization are acquired and released, and provide implicit safety at and across these boundaries.
     340While the optimization problem is best known with respect to concurrency, it applies to other complex control-flows like exceptions and coroutines.
     341As well, language solutions allow matching the language paradigm with the approach, \eg matching the functional paradigm with data-flow programming or the imperative paradigm with thread programming.
    335342
    336343Finally, it is important for a language to provide safety over performance \emph{as the default}, allowing careful reduction of safety for performance when necessary.
    337 Two concurrency violations of this philosophy are \emph{spurious wakeup} (random wakeup~\cite[\S~8]{Buhr05a}) and \emph{barging}\footnote{
    338 The notion of competitive succession instead of direct handoff, \ie a lock owner releases the lock and an arriving thread acquires it ahead of preexisting waiter threads.
    339 } (signals-as-hints~\cite[\S~8]{Buhr05a}), where one is a consequence of the other, \ie once there is spurious wakeup, signals-as-hints follow.
    340 However, spurious wakeup is \emph{not} a foundational concurrency property~\cite[\S~8]{Buhr05a}, it is a performance design choice.
    341 Similarly, signals-as-hints are often a performance decision.
    342 We argue removing spurious wakeup and signals-as-hints make concurrent programming significantly safer because it removes local non-determinism and matches with programmer expectation.
    343 (Author experience teaching concurrency is that students are highly confused by these semantics.)
    344 Clawing back performance, when local non-determinism is unimportant, should be an option not the default.
    345 
    346 \begin{comment}
    347 Most augmented traditional (Fortran 18~\cite{Fortran18}, Cobol 14~\cite{Cobol14}, Ada 12~\cite{Ada12}, Java 11~\cite{Java11}) and new languages (Go~\cite{Go}, Rust~\cite{Rust}, and D~\cite{D}), except \CC, diverge from C with different syntax and semantics, only interoperate indirectly with C, and are not systems languages, for those with managed memory.
    348 As a result, there is a significant learning curve to move to these languages, and C legacy-code must be rewritten.
    349 While \CC, like \CFA, takes an evolutionary approach to extend C, \CC's constantly growing complex and interdependent features-set (\eg objects, inheritance, templates, etc.) mean idiomatic \CC code is difficult to use from C, and C programmers must expend significant effort learning \CC.
    350 Hence, rewriting and retraining costs for these languages, even \CC, are prohibitive for companies with a large C software-base.
    351 \CFA with its orthogonal feature-set, its high-performance runtime, and direct access to all existing C libraries circumvents these problems.
    352 \end{comment}
    353 
    354 \CFA embraces user-level threading, language extensions for advanced control-flow, and safety as the default.
    355 We present comparative examples so the reader can judge if the \CFA control-flow extensions are better and safer than those in other concurrent, imperative programming languages, and perform experiments to show the \CFA runtime is competitive with other similar mechanisms.
     344Two concurrency violations of this philosophy are \emph{spurious} or \emph{random wakeup}~\cite[\S~9]{Buhr05a}, and \emph{barging}\footnote{
     345Barging is competitive succession instead of direct handoff, \ie after a lock is released both arriving and preexisting waiter threads compete to acquire the lock.
     346Hence, an arriving thread can temporally \emph{barge} ahead of threads already waiting for an event, which can repeat indefinitely leading to starvation of waiter threads.
     347} or signals-as-hints~\cite[\S~8]{Buhr05a}, where one is a consequence of the other, \ie once there is spurious wakeup, barging follows.
     348(Author experience teaching concurrency is that students are confused by these semantics.)
     349However, spurious wakeup is \emph{not} a foundational concurrency property~\cite[\S~9]{Buhr05a};
     350it is a performance design choice.
     351We argue removing spurious wakeup and signals-as-hints make concurrent programming simpler and safer as there is less local nondeterminism to manage.
     352If barging acquisition is allowed, its specialized performance advantage should be available as an option not the default.
     353
     354\CFA embraces language extensions for advanced control-flow, user-level threading, and safety as the default.
     355We present comparative examples to support our argument that the \CFA control-flow extensions are as expressive and safe as those in other concurrent imperative programming languages, and perform experiments to show the \CFA runtime is competitive with other similar mechanisms.
    356356The main contributions of this work are:
    357 \begin{itemize}[topsep=3pt,itemsep=1pt]
     357\begin{itemize}[topsep=3pt,itemsep=0pt]
    358358\item
    359 language-level generators, coroutines and user-level threading, which respect the expectations of C programmers.
     359a set of fundamental execution properties that dictate which language-level control-flow features need to be supported,
     360
    360361\item
    361 monitor synchronization without barging, and the ability to safely acquiring multiple monitors \emph{simultaneously} (deadlock free), while seamlessly integrating these capabilities with all monitor synchronization mechanisms.
     362integration of these language-level control-flow features, while respecting the style and expectations of C programmers,
     363
    362364\item
    363 providing statically type-safe interfaces that integrate with the \CFA polymorphic type-system and other language features.
     365monitor synchronization without barging, and the ability to safely acquiring multiple monitors in a deadlock-free way, while seamlessly integrating these capabilities with all monitor synchronization mechanisms,
     366
     367\item
     368providing statically type-safe interfaces that integrate with the \CFA polymorphic type-system and other language features,
     369
    364370% \item
    365371% library extensions for executors, futures, and actors built on the basic mechanisms.
     372
    366373\item
    367 a runtime system with no spurious wakeup.
     374a runtime system without spurious wake-up and no performance loss,
     375
    368376\item
    369 a dynamic partitioning mechanism to segregate the execution environment for specialized requirements.
     377a dynamic partitioning mechanism to segregate groups of executing user and kernel threads performing specialized work, \eg web-server or compute engine, or requiring different scheduling, \eg NUMA or real-time.
     378
    370379% \item
    371 % a non-blocking I/O library
     380% a nonblocking I/O library
     381
    372382\item
    373 experimental results showing comparable performance of the new features with similar mechanisms in other programming languages.
     383experimental results showing comparable performance of the \CFA features with similar mechanisms in other languages.
    374384\end{itemize}
    375385
    376 Section~\ref{s:StatefulFunction} begins advanced control by introducing sequential functions that retain data and execution state between calls, which produces constructs @generator@ and @coroutine@.
    377 Section~\ref{s:Concurrency} begins concurrency, or how to create (fork) and destroy (join) a thread, which produces the @thread@ construct.
    378 Section~\ref{s:MutualExclusionSynchronization} discusses the two mechanisms to restricted nondeterminism when controlling shared access to resources (mutual exclusion) and timing relationships among threads (synchronization).
     386Section~\ref{s:FundamentalExecutionProperties} presents the compositional hierarchy of execution properties directing the design of control-flow features in \CFA.
     387Section~\ref{s:StatefulFunction} begins advanced control by introducing sequential functions that retain data and execution state between calls producing constructs @generator@ and @coroutine@.
     388Section~\ref{s:Concurrency} begins concurrency, or how to create (fork) and destroy (join) a thread producing the @thread@ construct.
     389Section~\ref{s:MutualExclusionSynchronization} discusses the two mechanisms to restricted nondeterminism when controlling shared access to resources, called mutual exclusion, and timing relationships among threads, called synchronization.
    379390Section~\ref{s:Monitor} shows how both mutual exclusion and synchronization are safely embedded in the @monitor@ and @thread@ constructs.
    380 Section~\ref{s:CFARuntimeStructure} describes the large-scale mechanism to structure (cluster) threads and virtual processors (kernel threads).
    381 Section~\ref{s:Performance} uses a series of microbenchmarks to compare \CFA threading with pthreads, Java OpenJDK-9, Go 1.12.6 and \uC 7.0.0.
     391Section~\ref{s:CFARuntimeStructure} describes the large-scale mechanism to structure threads and virtual processors (kernel threads).
     392Section~\ref{s:Performance} uses microbenchmarks to compare \CFA threading with pthreads, Java 11.0.6, Go 1.12.6, Rust 1.37.0, Python 3.7.6, Node.js v12.18.0, and \uC 7.0.0.
     393
     394
     395\section{Fundamental Execution Properties}
     396\label{s:FundamentalExecutionProperties}
     397
     398The features in a programming language should be composed of a set of fundamental properties rather than an ad hoc collection chosen by the designers.
     399To this end, the control-flow features created for \CFA are based on the fundamental properties of any language with function-stack control-flow (see also \uC~\cite[pp.~140-142]{uC++}).
     400The fundamental properties are execution state, thread, and mutual-exclusion/synchronization.
     401These independent properties can be used to compose different language features, forming a compositional hierarchy, where the combination of all three is the most advanced feature, called a thread.
     402While it is possible for a language to only provide threads for composing programs~\cite{Hermes90}, this unnecessarily complicates and makes inefficient solutions to certain classes of problems.
     403As is shown, each of the non-rejected composed language features solves a particular set of problems, and hence, has a defensible position in a programming language.
     404If a compositional feature is missing, a programmer has too few fundamental properties resulting in a complex and/or inefficient solution.
     405
     406In detail, the fundamental properties are:
     407\begin{description}[leftmargin=\parindent,topsep=3pt,parsep=0pt]
     408\item[\newterm{execution state}:]
     409It is the state information needed by a control-flow feature to initialize and manage both compute data and execution location(s), and de-initialize.
     410For example, calling a function initializes a stack frame including contained objects with constructors, manages local data in blocks and return locations during calls, and de-initializes the frame by running any object destructors and management operations.
     411State is retained in fixed-sized aggregate structures (objects) and dynamic-sized stack(s), often allocated in the heap(s) managed by the runtime system.
     412The lifetime of state varies with the control-flow feature, where longer life-time and dynamic size provide greater power but also increase usage complexity and cost.
     413Control-flow transfers among execution states in multiple ways, such as function call, context switch, asynchronous await, etc.
     414Because the programming language determines what constitutes an execution state, implicitly manages this state, and defines movement mechanisms among states, execution state is an elementary property of the semantics of a programming language.
     415% An execution-state is related to the notion of a process continuation \cite{Hieb90}.
     416
     417\item[\newterm{threading}:]
     418It is execution of code that occurs independently of other execution, where an individual thread's execution is sequential.
     419Multiple threads provide \emph{concurrent execution};
     420concurrent execution becomes parallel when run on multiple processing units, \eg hyper-threading, cores, or sockets.
     421A programmer needs mechanisms to create, block and unblock, and join with a thread, even if these basic mechanisms are supplied indirectly through high-level features.
     422
     423\item[\newterm{mutual-exclusion / synchronization (MES)}:]
     424It is the concurrency mechanism to perform an action without interruption and establish timing relationships among multiple threads.
     425We contented these two properties are independent, \ie mutual exclusion cannot provide synchronization and vice versa without introducing additional threads~\cite[\S~4]{Buhr05a}.
     426Limiting MES functionality results in contrived solutions and inefficiency on multicore von Neumann computers where shared memory is a foundational aspect of its design.
     427\end{description}
     428These properties are fundamental as they cannot be built from existing language features, \eg a basic programming language like C99~\cite{C99} cannot create new control-flow features, concurrency, or provide MES without (atomic) hardware mechanisms.
     429
     430
     431\subsection{Structuring execution properties}
     432
     433Programming languages seldom present the fundamental execution properties directly to programmers.
     434Instead, the properties are packaged into higher-level constructs that encapsulate details and provide safety to these low-level mechanisms.
     435Interestingly, language designers often pick and choose among these execution properties proving a varying subset of constructs.
     436
     437Table~\ref{t:ExecutionPropertyComposition} shows all combinations of the three fundamental execution properties available to language designers.
     438(When doing combination case-analysis, not all combinations are meaningful.)
     439The combinations of state, thread, and MES compose a hierarchy of control-flow features all of which have appeared in prior programming languages, where each of these languages have found the feature useful.
     440To understand the table, it is important to review the basic von Neumann execution requirement of at least one thread and execution state providing some form of call stack.
     441For table entries missing these minimal components, the property is borrowed from the invoker (caller).
     442Each entry in the table, numbered \textbf{1}--\textbf{12}, is discussed with respect to how the execution properties combine to generate a high-level language construct.
     443
     444\begin{table}
     445\caption{Execution property composition}
     446\centering
     447\label{t:ExecutionPropertyComposition}
     448\renewcommand{\arraystretch}{1.25}
     449%\setlength{\tabcolsep}{5pt}
     450\vspace*{-5pt}
     451\begin{tabular}{c|c||l|l}
     452\multicolumn{2}{c||}{Execution properties} & \multicolumn{2}{c}{Mutual exclusion / synchronization} \\
     453\hline
     454stateful                        & thread        & \multicolumn{1}{c|}{No} & \multicolumn{1}{c}{Yes} \\
     455\hline
     456\hline
     457No                                      & No            & \textbf{1}\ \ \ @struct@                              & \textbf{2}\ \ \ @mutex@ @struct@              \\
     458\hline
     459Yes (stackless)         & No            & \textbf{3}\ \ \ @generator@                   & \textbf{4}\ \ \ @mutex@ @generator@   \\
     460\hline
     461Yes (stackful)          & No            & \textbf{5}\ \ \ @coroutine@                   & \textbf{6}\ \ \ @mutex@ @coroutine@   \\
     462\hline
     463No                                      & Yes           & \textbf{7}\ \ \ {\color{red}rejected} & \textbf{8}\ \ \ {\color{red}rejected} \\
     464\hline
     465Yes (stackless)         & Yes           & \textbf{9}\ \ \ {\color{red}rejected} & \textbf{10}\ \ \ {\color{red}rejected} \\
     466\hline
     467Yes (stackful)          & Yes           & \textbf{11}\ \ \ @thread@                             & \textbf{12}\ \ @mutex@ @thread@               \\
     468\end{tabular}
     469\vspace*{-8pt}
     470\end{table}
     471
     472Case 1 is a structure where access functions borrow local state (stack frame/activation) and thread from the invoker and retain this state across \emph{callees}, \ie function local-variables are retained on the borrowed stack during calls.
     473Structures are a foundational mechanism for data organization, and access functions provide interface abstraction and code sharing in all programming languages.
     474Case 2 is case 1 with thread safety to a structure's state where access functions provide serialization (mutual exclusion) and scheduling among calling threads (synchronization).
     475A @mutex@ structure, often called a \newterm{monitor}, provides a high-level interface for race-free access of shared data in concurrent programming languages.
     476Case 3 is case 1 where the structure can implicitly retain execution state and access functions use this execution state to resume/suspend across \emph{callers}, but resume/suspend does not retain a function's local state.
     477A stackless structure, often called a \newterm{generator} or \emph{iterator}, is \newterm{stackless} because it still borrows the caller's stack and thread, but the stack is used only to preserve state across its callees not callers.
     478Generators provide the first step toward directly solving problems like finite-state machines (FSMs) that retain data and execution state between calls, whereas normal functions restart on each call.
     479Case 4 is cases 2 and 3 with thread safety during execution of the generator's access functions.
     480A @mutex@ generator extends generators into the concurrent domain.
     481Cases 5 and 6 are like cases 3 and 4 where the structure is extended with an implicit separate stack, so only the thread is borrowed by access functions.
     482A stackful generator, often called a \newterm{coroutine}, is \newterm{stackful} because resume/suspend now context switch to/from the caller's and coroutine's stack.
     483A coroutine extends the state retained between calls beyond the generator's structure to arbitrary call depth in the access functions.
     484Cases 7, 8, 9 and 10 are rejected because a new thread must have its own stack, where the thread begins and stack frames are stored for calls, \ie it is unrealistic for a thread to borrow a stack.
     485For cases 9 and 10, the stackless frame is not growable, precluding accepting nested calls, making calls, blocking as it requires calls, or preemption as it requires pushing an interrupt frame, all of which compound to require an unknown amount of execution state.
     486Hence, if this kind of uninterruptable thread exists, it must execute to completion, \ie computation only, which severely restricts runtime management.
     487Cases 11 and 12 are a stackful thread with and without safe access to shared state.
     488A thread is the language mechanism to start another thread of control in a program with growable execution state for call/return execution.
     489In general, language constructs with more execution properties increase the cost of creation and execution along with complexity of usage.
     490
     491Given the execution-properties taxonomy, programmers now ask three basic questions: is state necessary across callers and how much, is a separate thread necessary, is thread safety necessary.
     492Table~\ref{t:ExecutionPropertyComposition} then suggests the optimal language feature needed for implementing a programming problem.
     493The following sections describe how \CFA fills in \emph{all} the nonrejected table entries with language features, while other programming languages may only provide a subset of the table.
     494
     495
     496\subsection{Design requirements}
     497
     498The following design requirements largely stem from building \CFA on top of C.
     499\begin{itemize}[topsep=3pt,parsep=0pt]
     500\item
     501All communication must be statically type checkable for early detection of errors and efficient code generation.
     502This requirement is consistent with the fact that C is a statically typed programming language.
     503
     504\item
     505Direct interaction among language features must be possible allowing any feature to be selected without restricting comm\-unication.
     506For example, many concurrent languages do not provide direct communication calls among threads, \ie threads only communicate indirectly through monitors, channels, messages, and/or futures.
     507Indirect communication increases the number of objects, consuming more resources, and requires additional synchronization and possibly data transfer.
     508
     509\item
     510All communication is performed using function calls, \ie data are transmitted from argument to parameter and results are returned from function calls.
     511Alternative forms of communication, such as call-backs, message passing, channels, or communication ports, step outside of C's normal form of communication.
     512
     513\item
     514All stateful features must follow the same declaration scopes and lifetimes as other language data.
     515For C that means at program startup, during block and function activation, and on demand using dynamic allocation.
     516
     517\item
     518MES must be available implicitly in language constructs, \eg Java built-in monitors, as well as explicitly for specialized requirements, \eg @java.util.concurrent@, because requiring programmers to build MES using low-level locks often leads to incorrect programs.
     519Furthermore, reducing synchronization scope by encapsulating it within language constructs further reduces errors in concurrent programs.
     520
     521\item
     522Both synchronous and asynchronous communication are needed.
     523However, we believe the best way to provide asynchrony, such as call-buffering/chaining and/or returning futures~\cite{multilisp}, is building it from expressive synchronous features.
     524
     525\item
     526Synchronization must be able to control the service order of requests including prioritizing selection from different kinds of outstanding requests, and postponing a request for an unspecified time while continuing to accept new requests.
     527Otherwise, certain concurrency problems are difficult, \eg web server, disk scheduling, and the amount of concurrency is inhibited~\cite{Gentleman81}.
     528\end{itemize}
     529We have satisfied these requirements in \CFA while maintaining backwards compatibility with the huge body of legacy C programs.
     530% In contrast, other new programming languages must still access C programs (\eg operating-system service routines), but do so through fragile C interfaces.
     531
     532
     533\subsection{Asynchronous await / call}
     534
     535Asynchronous await/call is a caller mechanism for structuring programs and/or increasing concurrency, where the caller (client) postpones an action into the future, which is subsequently executed by a callee (server).
     536The caller detects the action's completion through a \newterm{future} or \newterm{promise}.
     537The benefit is asynchronous caller execution with respect to the callee until future resolution.
     538For single-threaded languages like JavaScript, an asynchronous call passes a callee action, which is queued in the event-engine, and continues execution with a promise.
     539When the caller needs the promise to be fulfilled, it executes @await@.
     540A promise-completion call-back can be part of the callee action or the caller is rescheduled;
     541in either case, the call back is executed after the promise is fulfilled.
     542While asynchronous calls generate new callee (server) events, we contend this mechanism is insufficient for advanced control-flow mechanisms like generators or coroutines, which are discussed next.
     543Specifically, control between caller and callee occurs indirectly through the event-engine precluding direct handoff and cycling among events, and requires complex resolution of a control promise and data.
     544Note, @async-await@ is just syntactic-sugar over the event engine so it does not solve these deficiencies.
     545For multithreaded languages like Java, the asynchronous call queues a callee action with an executor (server), which subsequently executes the work by a thread in the executor thread-pool.
     546The problem is when concurrent work-units need to interact and/or block as this effects the executor by stopping threads.
     547While it is possible to extend this approach to support the necessary mechanisms, \eg message passing in Actors, we show monitors and threads provide an equally competitive approach that does not deviate from normal call communication and can be used to build asynchronous call, as is done in Java.
    382548
    383549
     
    385551\label{s:StatefulFunction}
    386552
    387 The stateful function is an old idea~\cite{Conway63,Marlin80} that is new again~\cite{C++20Coroutine19}, where execution is temporarily suspended and later resumed, \eg plugin, device driver, finite-state machine.
    388 Hence, a stateful function may not end when it returns to its caller, allowing it to be restarted with the data and execution location present at the point of suspension.
    389 This capability is accomplished by retaining a data/execution \emph{closure} between invocations.
    390 If the closure is fixed size, we call it a \emph{generator} (or \emph{stackless}), and its control flow is restricted, \eg suspending outside the generator is prohibited.
    391 If the closure is variable size, we call it a \emph{coroutine} (or \emph{stackful}), and as the names implies, often implemented with a separate stack with no programming restrictions.
    392 Hence, refactoring a stackless coroutine may require changing it to stackful.
    393 A foundational property of all \emph{stateful functions} is that resume/suspend \emph{do not} cause incremental stack growth, \ie resume/suspend operations are remembered through the closure not the stack.
    394 As well, activating a stateful function is \emph{asymmetric} or \emph{symmetric}, identified by resume/suspend (no cycles) and resume/resume (cycles).
    395 A fixed closure activated by modified call/return is faster than a variable closure activated by context switching.
    396 Additionally, any storage management for the closure (especially in unmanaged languages, \ie no garbage collection) must also be factored into design and performance.
    397 Therefore, selecting between stackless and stackful semantics is a tradeoff between programming requirements and performance, where stackless is faster and stackful is more general.
    398 Note, creation cost is amortized across usage, so activation cost is usually the dominant factor.
     553A \emph{stateful function} has the ability to remember state between calls, where state can be either data or execution, \eg plugin, device driver, FSM.
     554A simple technique to retain data state between calls is @static@ declarations within a function, which is often implemented by hoisting the declarations to the global scope but hiding the names within the function using name mangling.
     555However, each call starts the function at the top making it difficult to determine the last point of execution in an algorithm, and requiring multiple flag variables and testing to reestablish the continuation point.
     556Hence, the next step of generalizing function state is implicitly remembering the return point between calls and reentering the function at this point rather than the top, called \emph{generators}\,/\,\emph{iterators} or \emph{stackless coroutines}.
     557For example, a Fibonacci generator retains data and execution state allowing it to remember prior values needed to generate the next value and the location in the algorithm to compute that value.
     558The next step of generalization is instantiating the function to allow multiple named instances, \eg multiple Fibonacci generators, where each instance has its own state, and hence, can generate an independent sequence of values.
     559Note, a subset of generator state is a function \emph{closure}, \ie the technique of capturing lexical references when returning a nested function.
     560A further generalization is adding a stack to a generator's state, called a \emph{coroutine}, so it can suspend outside of itself, \eg call helper functions to arbitrary depth before suspending back to its resumer without unwinding these calls.
     561For example, a coroutine iterator for a binary tree can stop the traversal at the visit point (pre, infix, post traversal), return the node value to the caller, and then continue the recursive traversal from the current node on the next call.
     562
     563There are two styles of activating a stateful function, \emph{asymmetric} or \emph{symmetric}, identified by resume/suspend (no cycles) and resume/resume (cycles).
     564These styles \emph{do not} cause incremental stack growth, \eg a million resume/suspend or resume/resume cycles do not remember each cycle just the last resumer for each cycle.
     565Selecting between stackless/stackful semantics and asymmetric/symmetric style is a tradeoff between programming requirements, performance, and design, where stackless is faster and smaller using modified call/return between closures, stackful is more general but slower and larger using context switching between distinct stacks, and asymmetric is simpler control-flow than symmetric.
     566Additionally, storage management for the closure/stack must be factored into design and performance, especially in unmanaged languages without garbage collection.
     567Note, creation cost (closure/stack) is amortized across usage, so activation cost (resume/suspend) is usually the dominant factor.
     568
     569% The stateful function is an old idea~\cite{Conway63,Marlin80} that is new again~\cite{C++20Coroutine19}, where execution is temporarily suspended and later resumed, \eg plugin, device driver, finite-state machine.
     570% Hence, a stateful function may not end when it returns to its caller, allowing it to be restarted with the data and execution location present at the point of suspension.
     571% If the closure is fixed size, we call it a \emph{generator} (or \emph{stackless}), and its control flow is restricted, \eg suspending outside the generator is prohibited.
     572% If the closure is variable size, we call it a \emph{coroutine} (or \emph{stackful}), and as the names implies, often implemented with a separate stack with no programming restrictions.
     573% Hence, refactoring a stackless coroutine may require changing it to stackful.
     574% A foundational property of all \emph{stateful functions} is that resume/suspend \emph{do not} cause incremental stack growth, \ie resume/suspend operations are remembered through the closure not the stack.
     575% As well, a