Changes in / [4f7b418:09f357ec]


Ignore:
Files:
7 added
11 deleted
30 edited

Legend:

Unmodified
Added
Removed
  • benchmark/Makefile.am

    r4f7b418 r09f357ec  
    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 : Mon Jan 20 11:50:13 2020
     14## Update Count     : 244
    1515###############################################################################
    1616
     
    7575.ONESHELL:              # use one shell to execute recipe
    7676.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)
     77.PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv signal.csv
     78
     79## =========================================================================================================
     80
     81all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) signal$(EXEEXT) waitfor$(EXEEXT) creation$(EXEEXT)
    8282
    8383basic_loop_DURATION = 15000000000
     
    8989ctxswitch_rust_thread_DURATION = $(ctxswitch_pthread_DURATION)
    9090ctxswitch_cfa_generator_DURATION = 5000000000
    91 ctxswitch_nodejs_await_DURATION = 5000000
    9291ctxswitch_DURATION = 100000000
    9392
    94 #mutex_java_DURATION = 10000000
     93mutex_java_DURATION = 10000000
    9594mutex_DURATION = 50000000
    9695
    97 schedint_pthread_DURATION = 1000000
    98 schedint_java_DURATION = $(schedint_pthread_DURATION)
    99 schedint_rust_DURATION = $(schedint_pthread_DURATION)
    100 schedint_DURATION = 10000000
    101 
    102 schedext_DURATION = 10000000
     96signal_pthread_DURATION = 1000000
     97signal_java_DURATION = $(signal_pthread_DURATION)
     98signal_rust_DURATION = $(signal_pthread_DURATION)
     99signal_DURATION = 10000000
     100
     101waitfor_DURATION = 10000000
    103102
    104103creation_pthread_DURATION = 250000
    105 creation_rust_thread_DURATION = ${creation_pthread_DURATION}
    106 creation_java_thread_DURATION = ${creation_pthread_DURATION}
     104creation_rust_DURATION = ${creation_pthread_DURATION}
    107105creation_cfa_coroutine_DURATION = 100000000
    108106creation_cfa_coroutine_eager_DURATION = 10000000
     
    153151        +make mutex.csv
    154152        -+make mutex.diff.csv
    155         +make schedint.csv
    156         -+make schedint.diff.csv
     153        +make signal.csv
     154        -+make signal.diff.csv
    157155@DOifskipcompile@
    158156        cat compile.csv
     
    165163        cat mutex.csv
    166164        -cat mutex.diff.csv
    167         cat schedint.csv
    168         -cat schedint.diff.csv
     165        cat signal.csv
     166        -cat signal.diff.csv
    169167
    170168compile.csv:
     
    200198        $(srcdir)/fixcsv.sh $@
    201199
    202 schedint.csv:
    203         echo "schedint-1,schedint-2,schedext-1,schedext-2" > $@
    204         +make schedint-cfa1.runquiet >> $@ && echo -n ',' >> $@
    205         +make schedint-cfa2.runquiet >> $@ && echo -n ',' >> $@
    206         +make schedext-cfa1.runquiet >> $@ && echo -n ',' >> $@
    207         +make schedext-cfa2.runquiet >> $@
     200signal.csv:
     201        echo "signal-1,signal-2,waitfor-1,waitfor-2" > $@
     202        +make signal-cfa1.runquiet >> $@ && echo -n ',' >> $@
     203        +make signal-cfa2.runquiet >> $@ && echo -n ',' >> $@
     204        +make waitfor-cfa1.runquiet >> $@ && echo -n ',' >> $@
     205        +make waitfor-cfa2.runquiet >> $@
    208206        $(srcdir)/fixcsv.sh $@
    209207
     
    249247        ctxswitch-python_coroutine.run  \
    250248        ctxswitch-nodejs_coroutine.run  \
    251         ctxswitch-nodejs_await.run      \
    252249        ctxswitch-goroutine_thread.run  \
    253250        ctxswitch-rust_thread.run       \
     
    296293        echo "#!/bin/sh" > a.out
    297294        echo "nodejs $(srcdir)/ctxswitch/node_cor.js" >> a.out
    298         chmod a+x a.out
    299 
    300 ctxswitch-nodejs_await$(EXEEXT):
    301         echo "#!/bin/sh" > a.out
    302         echo "nodejs $(srcdir)/ctxswitch/node_await.js" >> a.out
    303295        chmod a+x a.out
    304296
     
    359351## =========================================================================================================
    360352
    361 schedint$(EXEEXT) :             \
    362         schedint-cfa1.run       \
    363         schedint-cfa2.run       \
    364         schedint-cfa4.run       \
    365         schedint-upp.run        \
    366         schedint-rust.run       \
    367         schedint-java.run       \
    368         schedint-pthread.run
    369 
    370 schedint-cfa1$(EXEEXT):
     353signal$(EXEEXT) :               \
     354        signal-cfa1.run         \
     355        signal-cfa2.run         \
     356        signal-cfa4.run         \
     357        signal-upp.run          \
     358        signal-rust.run         \
     359        signal-java.run         \
     360        signal-pthread.run
     361
     362signal-pthread$(EXEEXT):
     363        $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c
     364
     365signal-upp$(EXEEXT):
     366        $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc
     367
     368signal-cfa1$(EXEEXT):
    371369        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa
    372370
    373 schedint-cfa2$(EXEEXT):
     371signal-cfa2$(EXEEXT):
    374372        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa
    375373
    376 schedint-cfa4$(EXEEXT):
     374signal-cfa4$(EXEEXT):
    377375        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa
    378376
    379 schedint-upp$(EXEEXT):
    380         $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc
    381 
    382 schedint-rust$(EXEEXT):
     377signal-rust$(EXEEXT):
    383378        $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/schedint/rust.rs
    384379
    385 schedint-java$(EXEEXT):
     380signal-java$(EXEEXT):
    386381        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
    387382        echo "#!/bin/sh" > a.out
     
    389384        chmod a+x a.out
    390385
    391 schedint-pthread$(EXEEXT):
    392         $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c
    393 
    394 ## =========================================================================================================
    395 
    396 schedext$(EXEEXT) :             \
    397         schedext-cfa1.run       \
    398         schedext-cfa2.run       \
    399         schedext-cfa4.run       \
    400         schedext-upp.run        \
    401         schedext-goroutine.run
    402 
    403 schedext-cfa1$(EXEEXT):
     386## =========================================================================================================
     387
     388waitfor$(EXEEXT) :              \
     389        waitfor-cfa1.run        \
     390        waitfor-cfa2.run        \
     391        waitfor-cfa4.run        \
     392        waitfor-upp.run
     393
     394waitfor-upp$(EXEEXT):
     395        $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc
     396
     397waitfor-cfa1$(EXEEXT):
    404398        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa
    405399
    406 schedext-cfa2$(EXEEXT):
     400waitfor-cfa2$(EXEEXT):
    407401        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa
    408402
    409 schedext-cfa4$(EXEEXT):
     403waitfor-cfa4$(EXEEXT):
    410404        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa
    411405
    412 schedext-upp$(EXEEXT):
    413         $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc
    414 
    415 schedext-goroutine$(EXEEXT):
    416         $(BENCH_V_GOC)go build -o a.out $(srcdir)/schedext/goroutine.go
    417 
    418 
    419406## =========================================================================================================
    420407
    421408creation$(EXEEXT) :                             \
    422         creation-cfa_generator.run              \
    423409        creation-cfa_coroutine.run              \
    424410        creation-cfa_coroutine_eager.run        \
     
    433419        creation-pthread.run
    434420
    435 creation-cfa_generator$(EXEEXT):
    436         $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_gen.cfa
    437 
    438421creation-cfa_coroutine$(EXEEXT):
    439422        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa
     
    467450        $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/creation/rust_thrd.rs
    468451
    469 creation-java_thread$(EXEEXT):
     452creation-java$(EXEEXT):
    470453        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
    471454        echo "#!/bin/sh" > a.out
  • benchmark/Makefile.in

    r4f7b418 r09f357ec  
    426426ctxswitch_rust_thread_DURATION = $(ctxswitch_pthread_DURATION)
    427427ctxswitch_cfa_generator_DURATION = 5000000000
    428 ctxswitch_nodejs_await_DURATION = 5000000
    429428ctxswitch_DURATION = 100000000
    430 
    431 #mutex_java_DURATION = 10000000
     429mutex_java_DURATION = 10000000
    432430mutex_DURATION = 50000000
    433 schedint_pthread_DURATION = 1000000
    434 schedint_java_DURATION = $(schedint_pthread_DURATION)
    435 schedint_rust_DURATION = $(schedint_pthread_DURATION)
    436 schedint_DURATION = 10000000
    437 schedext_DURATION = 10000000
     431signal_pthread_DURATION = 1000000
     432signal_java_DURATION = $(signal_pthread_DURATION)
     433signal_rust_DURATION = $(signal_pthread_DURATION)
     434signal_DURATION = 10000000
     435waitfor_DURATION = 10000000
    438436creation_pthread_DURATION = 250000
    439 creation_rust_thread_DURATION = ${creation_pthread_DURATION}
    440 creation_java_thread_DURATION = ${creation_pthread_DURATION}
     437creation_rust_DURATION = ${creation_pthread_DURATION}
    441438creation_cfa_coroutine_DURATION = 100000000
    442439creation_cfa_coroutine_eager_DURATION = 10000000
     
    457454        ctxswitch-cfa_thread2.run ctxswitch-upp_coroutine.run \
    458455        ctxswitch-upp_thread.run ctxswitch-python_coroutine.run \
    459         ctxswitch-nodejs_coroutine.run ctxswitch-nodejs_await.run \
    460         ctxswitch-goroutine_thread.run ctxswitch-rust_thread.run \
    461         ctxswitch-nodejs_coroutine.run ctxswitch-java_thread.run \
    462         ctxswitch-pthread.run $(am__append_1)
     456        ctxswitch-nodejs_coroutine.run ctxswitch-goroutine_thread.run \
     457        ctxswitch-rust_thread.run ctxswitch-nodejs_coroutine.run \
     458        ctxswitch-java_thread.run ctxswitch-pthread.run \
     459        $(am__append_1)
    463460testdir = $(top_srcdir)/tests
    464461all: all-am
     
    787784.ONESHELL:              # use one shell to execute recipe
    788785.NOTPARALLEL:
    789 .PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv schedint.csv
    790 
    791 all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) schedint$(EXEEXT) schedext$(EXEEXT) creation$(EXEEXT)
     786.PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv signal.csv
     787
     788all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) signal$(EXEEXT) waitfor$(EXEEXT) creation$(EXEEXT)
    792789
    793790%.run : %$(EXEEXT) ${REPEAT}
     
    828825        +make mutex.csv
    829826        -+make mutex.diff.csv
    830         +make schedint.csv
    831         -+make schedint.diff.csv
     827        +make signal.csv
     828        -+make signal.diff.csv
    832829@DOifskipcompile@
    833830        cat compile.csv
     
    840837        cat mutex.csv
    841838        -cat mutex.diff.csv
    842         cat schedint.csv
    843         -cat schedint.diff.csv
     839        cat signal.csv
     840        -cat signal.diff.csv
    844841
    845842compile.csv:
     
    875872        $(srcdir)/fixcsv.sh $@
    876873
    877 schedint.csv:
    878         echo "schedint-1,schedint-2,schedext-1,schedext-2" > $@
    879         +make schedint-cfa1.runquiet >> $@ && echo -n ',' >> $@
    880         +make schedint-cfa2.runquiet >> $@ && echo -n ',' >> $@
    881         +make schedext-cfa1.runquiet >> $@ && echo -n ',' >> $@
    882         +make schedext-cfa2.runquiet >> $@
     874signal.csv:
     875        echo "signal-1,signal-2,waitfor-1,waitfor-2" > $@
     876        +make signal-cfa1.runquiet >> $@ && echo -n ',' >> $@
     877        +make signal-cfa2.runquiet >> $@ && echo -n ',' >> $@
     878        +make waitfor-cfa1.runquiet >> $@ && echo -n ',' >> $@
     879        +make waitfor-cfa2.runquiet >> $@
    883880        $(srcdir)/fixcsv.sh $@
    884881
     
    938935        echo "#!/bin/sh" > a.out
    939936        echo "nodejs $(srcdir)/ctxswitch/node_cor.js" >> a.out
    940         chmod a+x a.out
    941 
    942 ctxswitch-nodejs_await$(EXEEXT):
    943         echo "#!/bin/sh" > a.out
    944         echo "nodejs $(srcdir)/ctxswitch/node_await.js" >> a.out
    945937        chmod a+x a.out
    946938
     
    997989        chmod a+x a.out
    998990
    999 schedint$(EXEEXT) :             \
    1000         schedint-cfa1.run       \
    1001         schedint-cfa2.run       \
    1002         schedint-cfa4.run       \
    1003         schedint-upp.run        \
    1004         schedint-rust.run       \
    1005         schedint-java.run       \
    1006         schedint-pthread.run
    1007 
    1008 schedint-cfa1$(EXEEXT):
     991signal$(EXEEXT) :               \
     992        signal-cfa1.run         \
     993        signal-cfa2.run         \
     994        signal-cfa4.run         \
     995        signal-upp.run          \
     996        signal-rust.run         \
     997        signal-java.run         \
     998        signal-pthread.run
     999
     1000signal-pthread$(EXEEXT):
     1001        $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c
     1002
     1003signal-upp$(EXEEXT):
     1004        $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc
     1005
     1006signal-cfa1$(EXEEXT):
    10091007        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa
    10101008
    1011 schedint-cfa2$(EXEEXT):
     1009signal-cfa2$(EXEEXT):
    10121010        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa
    10131011
    1014 schedint-cfa4$(EXEEXT):
     1012signal-cfa4$(EXEEXT):
    10151013        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa
    10161014
    1017 schedint-upp$(EXEEXT):
    1018         $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc
    1019 
    1020 schedint-rust$(EXEEXT):
     1015signal-rust$(EXEEXT):
    10211016        $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/schedint/rust.rs
    10221017
    1023 schedint-java$(EXEEXT):
     1018signal-java$(EXEEXT):
    10241019        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
    10251020        echo "#!/bin/sh" > a.out
     
    10271022        chmod a+x a.out
    10281023
    1029 schedint-pthread$(EXEEXT):
    1030         $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c
    1031 
    1032 schedext$(EXEEXT) :             \
    1033         schedext-cfa1.run       \
    1034         schedext-cfa2.run       \
    1035         schedext-cfa4.run       \
    1036         schedext-upp.run        \
    1037         schedext-goroutine.run
    1038 
    1039 schedext-cfa1$(EXEEXT):
     1024waitfor$(EXEEXT) :              \
     1025        waitfor-cfa1.run        \
     1026        waitfor-cfa2.run        \
     1027        waitfor-cfa4.run        \
     1028        waitfor-upp.run
     1029
     1030waitfor-upp$(EXEEXT):
     1031        $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc
     1032
     1033waitfor-cfa1$(EXEEXT):
    10401034        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa
    10411035
    1042 schedext-cfa2$(EXEEXT):
     1036waitfor-cfa2$(EXEEXT):
    10431037        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa
    10441038
    1045 schedext-cfa4$(EXEEXT):
     1039waitfor-cfa4$(EXEEXT):
    10461040        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa
    10471041
    1048 schedext-upp$(EXEEXT):
    1049         $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc
    1050 
    1051 schedext-goroutine$(EXEEXT):
    1052         $(BENCH_V_GOC)go build -o a.out $(srcdir)/schedext/goroutine.go
    1053 
    10541042creation$(EXEEXT) :                             \
    1055         creation-cfa_generator.run              \
    10561043        creation-cfa_coroutine.run              \
    10571044        creation-cfa_coroutine_eager.run        \
     
    10661053        creation-pthread.run
    10671054
    1068 creation-cfa_generator$(EXEEXT):
    1069         $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_gen.cfa
    1070 
    10711055creation-cfa_coroutine$(EXEEXT):
    10721056        $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa
     
    11001084        $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/creation/rust_thrd.rs
    11011085
    1102 creation-java_thread$(EXEEXT):
     1086creation-java$(EXEEXT):
    11031087        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
    11041088        echo "#!/bin/sh" > a.out
  • benchmark/schedext/cfa1.cfa

    r4f7b418 r09f357ec  
    66#include "../bench.h"
    77
     8volatile int go = 0;
     9
    810monitor M {} m1;
    911
    1012void __attribute__((noinline)) call( M & mutex p1 ) {}
     13
    1114void __attribute__((noinline)) wait( M & mutex p1 ) {
     15        go = 1;
    1216        for ( times ) {
    1317                waitfor( call : p1 );
    1418        }
     19        go = 0;
    1520}
    1621
    1722thread T {};
    1823void main( T & ) {
     24        while ( go == 0 ) { yield(); }
    1925        BENCH(
    20                 for ( times ) { call( m1 ); },
     26                while ( go == 1 ) { call( m1 ); },
    2127                result
    2228        )
  • benchmark/schedext/cfa2.cfa

    r4f7b418 r09f357ec  
    44#include <stdio.h>
    55
    6 #include "../bench.h"
     6#include "bench.h"
     7
     8volatile int go = 0;
    79
    810monitor M {} m1, m2;
    911
    1012void __attribute__((noinline)) call( M & mutex p1, M & mutex p2 ) {}
     13
    1114void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2 ) {
     15        go = 1;
    1216        for ( times ) {
    1317                waitfor( call : p1, p2 );
    1418        }
     19        go = 0;
    1520}
     21
    1622thread T {};
    1723void main( T & ) {
     24        while( go == 0 ) { yield(); }
    1825        BENCH(
    19                 for ( times ) {
    20                         call( m1, m2 );
    21                 },
     26                while ( go == 1 ) { call( m1, m2 ); },
    2227                result
    2328        )
  • benchmark/schedext/cfa4.cfa

    r4f7b418 r09f357ec  
    44#include <stdio.h>
    55
    6 #include "../bench.h"
     6#include "bench.h"
     7
     8volatile int go = 0;
    79
    810monitor M {} m1, m2, m3, m4;
    911
    1012void __attribute__((noinline)) call( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {}
     13
    1114void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {
     15        go = 1;
    1216        for ( times ) {
    1317                waitfor( call : p1, p2, p3, p4 );
    1418        }
     19        go = 0;
    1520}
     21
    1622thread T {};
    1723void main( T & ) {
     24        while( go == 0 ) { yield(); }
    1825        BENCH(
    19                 for ( times ) {
    20                         call( m1, m2, m3, m4 );
    21                 },
     26                while( go == 1 ) { call( m1, m2, m3, m4 ); },
    2227                result
    2328        )
  • benchmark/schedext/upp.cc

    r4f7b418 r09f357ec  
    33#include "bench.h"
    44
     5volatile int go = 0;
     6
    57_Monitor M {
    68public:
    79        void __attribute__((noinline)) call() {}
    8         void __attribute__((noinline)) wait() {
     10
     11        int __attribute__((noinline)) wait() {
     12                go = 1;
    913                for ( size_t i = 0; i < times; i++ ) {
    1014                        _Accept(call);
    1115                }
     16                go = 0;
     17                return 0;
    1218        }
    1319} m;
     
    1521_Task T {
    1622        void main() {
     23                while ( go == 0 ) { yield(); }
    1724                BENCH(
    18                         for ( size_t i = 0; i < times; i++ ) {
    19                                 m.call();
    20                         },
     25                        while ( go == 1 ) { m.call(); },
    2126                        result
    2227                )
     
    2833        BENCH_START()
    2934        T t;
    30         m.wait();
     35        return m.wait();
    3136}
    3237
  • benchmark/schedint/JavaThread.java

    r4f7b418 r09f357ec  
    6363                synchronized(m) {
    6464                        s.start();
    65                         while( ! Monitor.go ) { // waiter must start first
     65                        while( !Monitor.go ) {
    6666                                Thread.yield();
    6767                        }
  • benchmark/schedint/cfa1.cfa

    r4f7b418 r09f357ec  
    77
    88volatile int go = 0;
    9 
    109condition c;
    1110monitor M {} m1;
     
    1413        signal( c );
    1514}
     15
    1616void __attribute__((noinline)) wait( M & mutex p1 ) {
    1717        go = 1;
     
    1919                wait( c );
    2020        }
     21        go = 0;
    2122}
    2223
    2324thread T {};
    2425void main( T & ) {
    25         while ( go == 0 ) { yield(); } // waiter must start first
     26        while ( go == 0 ) { yield(); }
    2627        BENCH(
    27                 for ( times ) { call( m1 ); },
     28                while ( go == 1 ) { call( m1 ); },
    2829                result
    2930        )
  • benchmark/schedint/cfa2.cfa

    r4f7b418 r09f357ec  
    77
    88volatile int go = 0;
    9 
    109condition c;
    1110monitor M {} m1, m2;
     
    1413        signal( c );
    1514}
     15
    1616void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2 ) {
    1717        go = 1;
     
    1919                wait( c );
    2020        }
     21        go = 0;
    2122}
    2223
    2324thread T {};
    2425void main( T & ) {
    25         while ( go == 0 ) { yield(); } // waiter must start first
     26        while ( go == 0 ) { yield(); }
    2627        BENCH(
    27                 for ( times ) { call( m1, m2 ); },
     28                while ( go == 1 ) { call( m1, m2 ); },
    2829                result
    2930        )
  • benchmark/schedint/cfa4.cfa

    r4f7b418 r09f357ec  
    44#include <stdio.h>
    55
    6 #include "../bench.h"
     6#include "bench.h"
    77
    88volatile int go = 0;
    9 
    109condition c;
    1110monitor M {} m1, m2, m3, m4;
     
    1413        signal( c );
    1514}
     15
    1616void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {
    1717        go = 1;
     
    1919                wait( c );
    2020        }
     21        go = 0;
    2122}
    2223
    2324thread T {};
    2425void main( T & ) {
    25         while ( go == 0 ) { yield(); } // waiter must start first
     26        while ( go == 0 ) { yield(); }
    2627        BENCH(
    27                 for ( times ) { call( m1, m2, m3, m4 ); },
     28                while ( go == 1 ) { call( m1, m2, m3, m4 ); },
    2829                result
    2930        )
  • benchmark/schedint/pthreads.c

    r4f7b418 r09f357ec  
    66volatile int go = 0;
    77
     8pthread_cond_t c;
    89pthread_mutex_t m;
    9 pthread_cond_t c;
    1010
    1111void __attribute__((noinline)) call() {
    12         pthread_mutex_lock( &m );
    13         pthread_cond_signal( &c );
    14         pthread_mutex_unlock( &m );
     12        pthread_mutex_lock(&m);
     13        pthread_cond_signal(&c);
     14        pthread_mutex_unlock(&m);
    1515}
    1616
    17 void __attribute__((noinline)) wait() {
     17int __attribute__((noinline)) wait() {
    1818        pthread_mutex_lock(&m);
    1919        go = 1;
    20         for ( size_t i = 0; i < times; i++ ) {
    21                 pthread_cond_wait( &c, &m );
    22         }
    23         go = 0;
    24         pthread_mutex_unlock( &m );
    25 }
    26 
    27 void * thread_main( __attribute__((unused)) void * arg ) {
    28         while ( go == 0 ) { sched_yield(); } // waiter must start first
    29         // barging for lock acquire => may not execute N times
    3020        BENCH(
    31                 while ( go == 1 ) { call(); },
     21                for (size_t i = 0; i < times; i++) {
     22                        pthread_cond_wait(&c, &m);
     23                },
    3224                result
    3325        )
    3426        printf( "%g\n", result );
     27        go = 0;
     28        pthread_mutex_unlock(&m);
     29        return 0;
     30}
     31
     32void* thread_main(__attribute__((unused)) void * arg ) {
     33        while(go == 0) { sched_yield(); }
     34        while(go == 1) { call(); }
    3535        return NULL;
    3636}
     
    3939        BENCH_START()
    4040        pthread_t thread;
    41         if ( pthread_create( &thread, NULL, thread_main, NULL ) < 0 ) {
     41        if (pthread_create(&thread, NULL, thread_main, NULL) < 0) {
    4242                perror( "failure" );
    4343                return 1;
    4444        }
    4545        wait();
    46         if ( pthread_join( thread, NULL ) < 0 ) {
     46        if (pthread_join( thread, NULL) < 0) {
    4747                perror( "failure" );
    4848                return 1;
  • benchmark/schedint/rust.rs

    r4f7b418 r09f357ec  
    1818
    1919        let th = thread::spawn( move || {
    20                 while *m2.lock().unwrap() == 0 { // waiter must start first
     20                while *m2.lock().unwrap() == 0 {
    2121                        thread::yield_now();
    2222                }
  • benchmark/schedint/upp.cc

    r4f7b418 r09f357ec  
    1111                cond.signal();
    1212        }
    13         void __attribute__((noinline)) wait() {
     13
     14        int __attribute__((noinline)) wait() {
    1415                go = 1;
    15                 for ( size_t i = 0; i < times; i++ ) {
    16                         cond.wait();
    17                 }
    18         }
    19 } m;
    20 
    21 _Task T {
    22         void main() {
    23                 while ( go == 0 ) { yield(); } // waiter must start first
    2416                BENCH(
    25                         for ( size_t i = 0; i < times; i++ ) {
    26                                 m.call();
     17                        for (size_t i = 0; i < times; i++) {
     18                                cond.wait();
    2719                        },
    2820                        result
    2921                )
    3022                printf( "%g\n", result );
     23                go = 0;
     24                return 0;
     25        }
     26};
     27
     28M m;
     29
     30_Task T {
     31        void main() {
     32                while(go == 0) { yield(); }
     33                while(go == 1) { m.call(); }
     34
    3135        }
    3236};
     
    3539        BENCH_START()
    3640        T t;
    37         m.wait();
     41        return m.wait();
    3842}
    3943
  • driver/cfa.cc

    r4f7b418 r09f357ec  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jan 31 16:48:03 2020
    13 // Update Count     : 421
     12// Last Modified On : Tue Sep 10 17:00:15 2019
     13// Update Count     : 420
    1414//
    1515
     
    187187                        } else if ( arg == "-XCFA" ) {                          // CFA pass through
    188188                                i += 1;
    189                                 if ( i == argc ) continue;                              // next argument available ?
    190189                                Putenv( argv, argv[i] );
    191190
  • libcfa/src/bits/defs.hfa

    r4f7b418 r09f357ec  
    1010// Created On       : Thu Nov  9 13:24:10 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jan 28 22:38:27 2020
    13 // Update Count     : 9
     12// Last Modified On : Thu Feb  8 16:22:41 2018
     13// Update Count     : 8
    1414//
    1515
     
    3434
    3535#ifdef __cforall
    36 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
    37 void abort( bool signalAbort, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ ));
     36void abort ( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
    3837extern "C" {
    3938#endif
  • libcfa/src/bits/signal.hfa

    r4f7b418 r09f357ec  
    4040        sigaddset( &act.sa_mask, SIGALRM );             // disabled during signal handler
    4141        sigaddset( &act.sa_mask, SIGUSR1 );
    42         sigaddset( &act.sa_mask, SIGSEGV );
    43         sigaddset( &act.sa_mask, SIGBUS );
    44         sigaddset( &act.sa_mask, SIGILL );
    45         sigaddset( &act.sa_mask, SIGFPE );
    46         sigaddset( &act.sa_mask, SIGHUP );              // revert to default on second delivery
    47         sigaddset( &act.sa_mask, SIGTERM );
    48         sigaddset( &act.sa_mask, SIGINT );
    4942        act.sa_flags = flags;
    5043
    51         if ( sigaction( sig, &act, 0p ) == -1 ) {
     44        if ( sigaction( sig, &act, NULL ) == -1 ) {
    5245                __cfaabi_dbg_print_buffer_decl(
    5346                        " __cfaabi_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n",
     
    5548                );
    5649                _exit( EXIT_FAILURE );
    57         } // if
     50        }
    5851}
     52
     53// Sigaction wrapper : restore default handler
     54static void __cfaabi_sigdefault( int sig ) {
     55        struct sigaction act;
     56
     57        act.sa_handler = SIG_DFL;
     58        act.sa_flags = 0;
     59        sigemptyset( &act.sa_mask );
     60
     61        if ( sigaction( sig, &act, NULL ) == -1 ) {
     62                __cfaabi_dbg_print_buffer_decl(
     63                        " __cfaabi_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n",
     64                        sig, errno, strerror( errno )
     65                );
     66                _exit( EXIT_FAILURE );
     67        }
     68}
  • libcfa/src/concurrency/kernel.cfa

    r4f7b418 r09f357ec  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jan 30 22:55:50 2020
    13 // Update Count     : 56
     12// Last Modified On : Thu Dec  5 16:25:52 2019
     13// Update Count     : 52
    1414//
    1515
     
    844844                sigemptyset( &mask );
    845845                sigaddset( &mask, SIGALRM );            // block SIGALRM signals
    846                 sigaddset( &mask, SIGUSR1 );            // block SIGALRM signals
    847                 sigsuspend( &mask );                            // block the processor to prevent further damage during abort
    848                 _exit( EXIT_FAILURE );                          // if processor unblocks before it is killed, terminate it
     846                sigsuspend( &mask );                    // block the processor to prevent further damage during abort
     847                _exit( EXIT_FAILURE );                  // if processor unblocks before it is killed, terminate it
    849848        }
    850849        else {
  • libcfa/src/interpose.cfa

    r4f7b418 r09f357ec  
    1010// Created On       : Wed Mar 29 16:10:31 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jan 30 17:47:32 2020
    13 // Update Count     : 156
     12// Last Modified On : Fri Dec 13 13:45:21 2019
     13// Update Count     : 121
    1414//
    1515
     
    9595        void __cfaabi_interpose_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
    9696        void __cfaabi_interpose_startup( void ) {
    97                 const char *version = 0p;
     97                const char *version = NULL;
    9898
    9999                preload_libgcc();
     
    105105#pragma GCC diagnostic pop
    106106
    107                 // As a precaution (and necessity), errors that result in termination are delivered on a separate stack because
    108                 // task stacks might be very small (4K) and the signal delivery corrupts memory to the point that a clean
    109                 // shutdown is impossible. Also, when a stack overflow encounters the non-accessible sentinel page (debug only)
    110                 // and generates a segment fault, the signal cannot be delivered on the sentinel page. Finally, calls to abort
    111                 // print a stack trace that uses substantial stack space.
    112 
    113                 #define MINSTKSZ SIGSTKSZ * 8
    114                 static char stack[MINSTKSZ] __attribute__(( aligned (16) ));
    115                 static stack_t ss;
    116 
    117                 ss.ss_sp = stack;
    118                 ss.ss_size = MINSTKSZ;
    119                 ss.ss_flags = 0;
    120                 if ( sigaltstack( &ss, 0p ) == -1 ) {
    121                         abort( "__cfaabi_interpose_startup : internal error, sigaltstack error(%d) %s.", errno, strerror( errno ) );
    122                 } // if
    123 
    124107                // Failure handler
    125                 __cfaabi_sigaction( SIGSEGV, sigHandler_segv, SA_SIGINFO | SA_ONSTACK );
    126                 __cfaabi_sigaction( SIGBUS , sigHandler_segv, SA_SIGINFO | SA_ONSTACK );
    127                 __cfaabi_sigaction( SIGILL , sigHandler_ill , SA_SIGINFO | SA_ONSTACK );
    128                 __cfaabi_sigaction( SIGFPE , sigHandler_fpe , SA_SIGINFO | SA_ONSTACK );
    129                 __cfaabi_sigaction( SIGTERM, sigHandler_term, SA_SIGINFO | SA_ONSTACK | SA_RESETHAND ); // one shot handler, return to default
    130                 __cfaabi_sigaction( SIGINT , sigHandler_term, SA_SIGINFO | SA_ONSTACK | SA_RESETHAND );
    131                 __cfaabi_sigaction( SIGABRT, sigHandler_term, SA_SIGINFO | SA_ONSTACK | SA_RESETHAND );
    132                 __cfaabi_sigaction( SIGHUP , sigHandler_term, SA_SIGINFO | SA_ONSTACK | SA_RESETHAND ); // terminal hangup
     108                __cfaabi_sigaction( SIGSEGV, sigHandler_segv , SA_SIGINFO );
     109                __cfaabi_sigaction( SIGBUS , sigHandler_segv , SA_SIGINFO );
     110                __cfaabi_sigaction( SIGILL , sigHandler_ill  , SA_SIGINFO );
     111                __cfaabi_sigaction( SIGFPE , sigHandler_fpe  , SA_SIGINFO );
     112                __cfaabi_sigaction( SIGABRT, sigHandler_abrt, SA_SIGINFO | SA_RESETHAND);
     113                __cfaabi_sigaction( SIGTERM, sigHandler_term , SA_SIGINFO );
     114                __cfaabi_sigaction( SIGINT , sigHandler_term , SA_SIGINFO );
    133115        }
    134116}
     
    141123void exit( int status, const char fmt[], ... ) __attribute__(( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ ));
    142124void abort( const char fmt[], ... ) __attribute__(( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
    143 void abort( bool signalAbort, const char fmt[], ... ) __attribute__(( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ ));
    144125
    145126extern "C" {
    146127        void abort( void ) __attribute__(( __nothrow__, __leaf__, __noreturn__ )) {
    147                 abort( false, NULL ); // FIX ME: 0p does not work
     128                abort( NULL );
    148129        }
    149130
     
    151132                va_list argp;
    152133                va_start( argp, fmt );
    153                 abort( false, fmt, argp );
     134                abort( fmt, argp );
    154135                va_end( argp );
    155136        }
     
    160141}
    161142
    162 void * kernel_abort( void ) __attribute__(( __nothrow__, __leaf__, __weak__ )) { return 0p; }
    163 void kernel_abort_msg( void * data, char * buffer, int size ) __attribute__(( __nothrow__, __leaf__, __weak__ )) {}
    164 // See concurrency/kernel.cfa for strong definition used in multi-processor mode.
     143void * kernel_abort    ( void ) __attribute__(( __nothrow__, __leaf__, __weak__ )) { return NULL; }
     144void   kernel_abort_msg( void * data, char * buffer, int size ) __attribute__(( __nothrow__, __leaf__, __weak__ )) {}
    165145int kernel_abort_lastframe( void ) __attribute__(( __nothrow__, __leaf__, __weak__ )) { return 4; }
    166146
    167147enum { abort_text_size = 1024 };
    168148static char abort_text[ abort_text_size ];
    169 
    170 static void __cfaabi_backtrace( int start ) {
     149static int abort_lastframe;
     150
     151void exit( int status, const char fmt[], ... ) __attribute__(( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ )) {
     152    va_list args;
     153    va_start( args, fmt );
     154    vfprintf( stderr, fmt, args );
     155    va_end( args );
     156        __cabi_libc.exit( status );
     157}
     158
     159void abort( const char fmt[], ... ) __attribute__(( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )) {
     160        void * kernel_data = kernel_abort();                    // must be done here to lock down kernel
     161        int len;
     162
     163        abort_lastframe = kernel_abort_lastframe();
     164        len = snprintf( abort_text, abort_text_size, "Cforall Runtime error (UNIX pid:%ld) ", (long int)getpid() ); // use UNIX pid (versus getPid)
     165        __cfaabi_dbg_write( abort_text, len );
     166
     167        if ( fmt ) {
     168                va_list args;
     169                va_start( args, fmt );
     170
     171                len = vsnprintf( abort_text, abort_text_size, fmt, args );
     172                va_end( args );
     173                __cfaabi_dbg_write( abort_text, len );
     174
     175                if ( fmt[strlen( fmt ) - 1] != '\n' ) {         // add optional newline if missing at the end of the format text
     176                        __cfaabi_dbg_write( "\n", 1 );
     177                }
     178        }
     179
     180        kernel_abort_msg( kernel_data, abort_text, abort_text_size );
     181        __cabi_libc.abort();
     182}
     183
     184static void __cfaabi_backtrace() {
    171185        enum {
    172186                Frames = 50,                                                                    // maximum number of stack frames
     187                Start = 8,                                                                              // skip first N stack frames
    173188        };
    174         int last = kernel_abort_lastframe();                            // skip last N stack frames
    175189
    176190        void * array[Frames];
     
    178192        char ** messages = backtrace_symbols( array, size );
    179193
    180         *index( messages[0], '(' ) = '\0';                                      // find executable name
     194        // find executable name
     195        *index( messages[0], '(' ) = '\0';
    181196        __cfaabi_bits_print_nolock( STDERR_FILENO, "Stack back trace for: %s\n", messages[0]);
    182197
    183         for ( unsigned int i = start; i < size - last && messages != 0p; i += 1 ) {
     198        for ( int i = Start; i < size - abort_lastframe && messages != 0p; i += 1 ) {
    184199                char * name = 0p, * offset_begin = 0p, * offset_end = 0p;
    185200
    186                 for ( char * p = messages[i]; *p; ++p ) {               // find parantheses and +offset
     201                for ( char * p = messages[i]; *p; ++p ) {
    187202                        //__cfaabi_bits_print_nolock( "X %s\n", p);
     203                        // find parantheses and +offset
    188204                        if ( *p == '(' ) {
    189205                                name = p;
     
    196212                }
    197213
    198                 // if line contains symbol, print it
    199                 int frameNo = i - start;
     214                // if line contains symbol print it
     215                int frameNo = i - Start;
    200216                if ( name && offset_begin && offset_end && name < offset_begin ) {
    201                         *name++ = '\0';                                                         // delimit strings
     217                        // delimit strings
     218                        *name++ = '\0';
    202219                        *offset_begin++ = '\0';
    203220                        *offset_end++ = '\0';
     
    211228}
    212229
    213 void exit( int status, const char fmt[], ... ) {
    214         va_list args;
    215         va_start( args, fmt );
    216         vfprintf( stderr, fmt, args );
    217         va_end( args );
    218         __cabi_libc.exit( status );
    219 }
    220 
    221 void abort( bool signalAbort, const char fmt[], ... ) {
    222         void * kernel_data = kernel_abort();                            // must be done here to lock down kernel
    223         int len;
    224 
    225         signal( SIGABRT, SIG_DFL );                                                     // prevent final "real" abort from recursing to handler
    226 
    227         len = snprintf( abort_text, abort_text_size, "Cforall Runtime error (UNIX pid:%ld) ", (long int)getpid() ); // use UNIX pid (versus getPid)
    228         __cfaabi_bits_write( STDERR_FILENO, abort_text, len );
    229 
    230         if ( fmt ) {
    231                 va_list args;
    232                 va_start( args, fmt );
    233 
    234                 len = vsnprintf( abort_text, abort_text_size, fmt, args );
    235                 va_end( args );
    236                 __cfaabi_bits_write( STDERR_FILENO, abort_text, len );
    237 
    238                 if ( fmt[strlen( fmt ) - 1] != '\n' ) {                 // add optional newline if missing at the end of the format text
    239                         __cfaabi_dbg_write( "\n", 1 );
    240                 }
    241         }
    242 
    243         kernel_abort_msg( kernel_data, abort_text, abort_text_size );
    244         __cfaabi_backtrace( signalAbort ? 4 : 3 );
    245 
    246         __cabi_libc.abort();                                                            // print stack trace in handler
    247 }
    248 
    249 void abort( const char fmt[], ... ) {
    250         va_list args;
    251         va_start( args, fmt );
    252         abort( false, fmt, args );
    253         va_end( args );
    254 }
    255 
    256230void sigHandler_segv( __CFA_SIGPARMS__ ) {
    257                 if ( sfp->si_addr == 0p ) {
    258                         abort( true, "Null pointer (0p) dereference.\n" );
     231                if ( sfp->si_addr == NULL ) {
     232                        abort( "Null pointer (0p) dereference.\n" );
    259233                } else {
    260                         abort( true, "%s at memory location %p.\n"
     234                        abort( "%s at memory location %p.\n"
    261235                                   "Possible cause is reading outside the address space or writing to a protected area within the address space with an invalid pointer or subscript.\n",
    262236                                   (sig == SIGSEGV ? "Segment fault" : "Bus error"), sfp->si_addr );
     
    265239
    266240void sigHandler_ill( __CFA_SIGPARMS__ ) {
    267         abort( true, "Executing illegal instruction at location %p.\n"
     241        abort( "Executing illegal instruction at location %p.\n"
    268242                        "Possible cause is stack corruption.\n",
    269243                        sfp->si_addr );
     
    281255          default: msg = "unknown";
    282256        } // choose
    283         abort( true, "Computation error %s at location %p.\n", msg, sfp->si_addr );
     257        abort( "Computation error %s at location %p.\n", msg, sfp->si_addr );
     258}
     259
     260void sigHandler_abrt( __CFA_SIGPARMS__ ) {
     261        __cfaabi_backtrace();
     262
     263        // reset default signal handler
     264        __cfaabi_sigdefault( SIGABRT );
     265
     266        raise( SIGABRT );
    284267}
    285268
    286269void sigHandler_term( __CFA_SIGPARMS__ ) {
    287         abort( true, "Application interrupted by signal: %s.\n", strsignal( sig ) );
     270        abort( "Application stopped by %s signal.", sig == SIGINT ? "an interrupt (SIGINT)" : "a terminate (SIGTERM)" );
    288271}
    289272
  • libcfa/src/stdhdr/bfdlink.h

    r4f7b418 r09f357ec  
    1010// Created On       : Tue Jul 18 07:26:04 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Feb  1 07:15:29 2020
    13 // Update Count     : 5
     12// Last Modified On : Sun Jul 22 13:49:30 2018
     13// Update Count     : 4
    1414//
    1515
    1616// include file uses the CFA keyword "with".
    1717#if ! defined( with )                                                                   // nesting ?
    18 #define with ``with``                                                                   // make keyword an identifier
     18#define with `with`                                                                             // make keyword an identifier
    1919#define __CFA_BFDLINK_H__
    2020#endif
  • libcfa/src/stdhdr/hwloc.h

    r4f7b418 r09f357ec  
    1010// Created On       : Tue Jul 18 07:45:00 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Feb  1 07:15:39 2020
    13 // Update Count     : 5
     12// Last Modified On : Sun Jul 22 13:49:58 2018
     13// Update Count     : 4
    1414//
    1515
    1616// include file uses the CFA keyword "thread".
    1717#if ! defined( thread )                                                                 // nesting ?
    18 #define thread ``thread``                                                               // make keyword an identifier
     18#define thread `thread`                                                                 // make keyword an identifier
    1919#define __CFA_HWLOC_H__
    2020#endif
  • libcfa/src/stdhdr/krb5.h

    r4f7b418 r09f357ec  
    1010// Created On       : Tue Jul 18 07:55:44 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Feb  1 07:15:47 2020
    13 // Update Count     : 5
     12// Last Modified On : Sun Jul 22 13:50:24 2018
     13// Update Count     : 4
    1414//
    1515
    1616// include file uses the CFA keyword "enable".
    1717#if ! defined( enable )                                                                 // nesting ?
    18 #define enable ``enable``                                                               // make keyword an identifier
     18#define enable `enable`                                                                 // make keyword an identifier
    1919#define __CFA_KRB5_H__
    2020#endif
  • libcfa/src/stdhdr/math.h

    r4f7b418 r09f357ec  
    1010// Created On       : Mon Jul  4 23:25:26 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Feb  1 07:15:58 2020
    13 // Update Count     : 14
     12// Last Modified On : Thu Feb 22 18:16:07 2018
     13// Update Count     : 13
    1414//
    1515
    1616extern "C" {
    1717#if ! defined( exception )                                                              // nesting ?
    18 #define exception ``exception``                                                 // make keyword an identifier
     18#define exception `exception`                                                   // make keyword an identifier
    1919#define __CFA_MATH_H__
    2020#endif
  • libcfa/src/stdhdr/sys/ucontext.h

    r4f7b418 r09f357ec  
    1010// Created On       : Thu Feb  8 23:48:16 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Feb  1 07:16:05 2020
    13 // Update Count     : 5
     12// Last Modified On : Thu Feb  8 23:50:44 2018
     13// Update Count     : 4
    1414//
    1515
    1616#if ! defined( ftype )                                                                  // nesting ?
    17 #define ftype ``ftype``                                                                 // make keyword an identifier
     17#define ftype `ftype`                                                                   // make keyword an identifier
    1818#define __CFA_UCONTEXT_H__
    1919#endif
  • src/ControlStruct/LabelFixer.cc

    r4f7b418 r09f357ec  
    4545        void LabelFixer::postvisit( FunctionDecl * functionDecl ) {
    4646                PassVisitor<MultiLevelExitMutator> mlem( resolveJumps(), generator );
    47                 // We start in the body so we can stop when we hit another FunctionDecl.
    48                 maybeMutate( functionDecl->statements, mlem );
     47                functionDecl->acceptMutator( mlem );
    4948        }
    5049
  • src/ControlStruct/MLEMutator.cc

    r4f7b418 r09f357ec  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jan 22 11:50:00 2020
    13 // Update Count     : 223
     12// Last Modified On : Tue Jan 21 10:33:00 2020
     13// Update Count     : 222
    1414//
    1515
     
    6060                }
    6161        } // namespace
    62 
    63         void MultiLevelExitMutator::premutate( FunctionDecl * ) {
    64                 visit_children = false;
    65         }
    6662
    6763        // break labels have to come after the statement they break out of, so mutate a statement, then if they inform us
     
    356352                });
    357353                enclosingControlStructures = std::list<Entry>();
    358                 GuardValue( inFinally );
    359                 inFinally = true;
    360         }
    361 
    362         void MultiLevelExitMutator::premutate( ReturnStmt *returnStmt ) {
    363                 if ( inFinally ) {
    364                         SemanticError( returnStmt->location, "'return' may not appear in a finally clause" );
    365                 }
    366354        }
    367355
  • src/ControlStruct/MLEMutator.h

    r4f7b418 r09f357ec  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Jan 22 11:50:00 2020
    13 // Update Count     : 48
     12// Last Modified On : Tue Jan 21 10:33:00 2020
     13// Update Count     : 47
    1414//
    1515
     
    3838                ~MultiLevelExitMutator();
    3939
    40                 void premutate( FunctionDecl * );
    41 
    4240                void premutate( CompoundStmt *cmpndStmt );
    4341                Statement * postmutate( BranchStmt *branchStmt ) throw ( SemanticErrorException );
     
    5149                void premutate( SwitchStmt *switchStmt );
    5250                Statement * postmutate( SwitchStmt *switchStmt );
    53                 void premutate( ReturnStmt *returnStmt );
    5451                void premutate( TryStmt *tryStmt );
    5552                Statement * postmutate( TryStmt *tryStmt );
     
    116113                Label breakLabel;
    117114                LabelGenerator *generator;
    118                 bool inFinally = false;
    119115
    120116                template< typename LoopClass >
  • src/Parser/lex.ll

    r4f7b418 r09f357ec  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Sat Feb  1 07:16:44 2020
    13  * Update Count     : 724
     12 * Last Modified On : Sun Aug  4 20:53:47 2019
     13 * Update Count     : 719
    1414 */
    1515
     
    330330                                /* identifier */
    331331{identifier}    { IDENTIFIER_RETURN(); }
    332 "``"{identifier}"``" {                                                                  // CFA
    333         yytext[yyleng - 2] = '\0'; yytext += 2;                         // SKULLDUGGERY: remove backquotes (ok to shorten?)
     332"`"{identifier}"`" {                                                                    // CFA
     333        yytext[yyleng - 1] = '\0'; yytext += 1;                         // SKULLDUGGERY: remove backquotes (ok to shorten?)
    334334        IDENTIFIER_RETURN();
    335335}
  • src/Parser/parser.yy

    r4f7b418 r09f357ec  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Feb  1 10:04:40 2020
    13 // Update Count     : 4440
     12// Last Modified On : Fri Jan 17 14:54:55 2020
     13// Update Count     : 4426
    1414//
    1515
     
    579579        | '(' compound_statement ')'                                            // GCC, lambda expression
    580580                { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); }
     581        | constant '`' IDENTIFIER                                                       // CFA, postfix call
     582                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
     583        | string_literal '`' IDENTIFIER                                         // CFA, postfix call
     584                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); }
     585        | IDENTIFIER '`' IDENTIFIER                                                     // CFA, postfix call
     586                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( build_varref( $1 ) ) ) ); }
     587        | tuple '`' IDENTIFIER                                                          // CFA, postfix call
     588                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
     589        | '(' comma_expression ')' '`' IDENTIFIER                       // CFA, postfix call
     590                { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); }
    581591        | type_name '.' identifier                                                      // CFA, nested type
    582592                { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; }
     
    632642        | postfix_expression '(' argument_expression_list ')'
    633643                { $$ = new ExpressionNode( build_func( $1, $3 ) ); }
    634         | postfix_expression '`' identifier                                     // CFA, postfix call
    635                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
    636         | constant '`' identifier                                                       // CFA, postfix call
    637                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }
    638         | string_literal '`' identifier                                         // CFA, postfix call
    639                 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); }
    640644        | postfix_expression '.' identifier
    641645                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
     
    662666        | '(' type_no_function ')' '@' '{' initializer_list_opt comma_opt '}' // CFA, explicit C compound-literal
    663667                { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); }
    664         | '^' primary_expression '{' argument_expression_list '}' // CFA, destructor call
     668        | '^' primary_expression '{' argument_expression_list '}' // CFA
    665669                {
    666670                        Token fn;
  • tests/expression.cfa

    r4f7b418 r09f357ec  
    1 struct S { int i; };
    2 void ?{}( S & s, int i ) { s.i = i; }
    3 int ?`mary( int );
    4 int ?`mary( S );
    5 [int] ?`mary( [int, int] );
    6 int & ?`jane( int & );
    7 int jack( int );
    8 
    91int main() {
    10     int a[3] = { 0, 0, 0 };
    11     S s = { 3 }, * ps = &s;
    12     [int] t = { 3 };
    13     * [int] pt = &t;
    14     int i = 1, j = 2;
     2    struct s { int i; } x, *p = &x;
     3    int i = 3;
    154
    165    // operators
    176
    18     !i;
     7    ! i;
    198    ~i;
    209    +i;
    2110    -i;
    22     *ps;
    23     ++ps;
    24     --ps;
    25     ps++;
    26     ps--;
     11    *p;
     12    ++p;
     13    --p;
     14    p++;
     15    p--;
    2716
    28     i + j;
    29     i - j;
    30     i * j;
     17    i+i;
     18    i-i;
     19    i*i;
    3120
    32     i / j;
    33     i % j;
    34     i ^ j;
    35     i & j;
    36     i | j;
    37     i < j;
    38     i > j;
    39     i = j;
     21    i/i;
     22    i%i;
     23    i^i;
     24    i&i;
     25    i|i;
     26    i<i;
     27    i>i;
     28    i=i;
    4029
    41     i == j;
    42     i != j;
    43     i << j;
    44     i >> j;
    45     i <= j;
    46     i >= j;
    47     i && j;
    48     i || j;
    49     ps->i;
     30    i==i;
     31    i!=i;
     32    i<<i;
     33    i>>i;
     34    i<=i;
     35    i>=i;
     36    i&&i;
     37    i||i;
     38    p->i;
     39    i*=i;
     40    i/=i;
     41    i%=i;
     42    i+=i;
     43    i-=i;
     44    i&=i;
     45    i|=i;
     46    i^=i;
     47    i<<=i;
     48    i>>=i;
    5049
    51     i *= j;
    52     i /= j;
    53     i %= j;
    54     i += j;
    55     i -= j;
    56     i &= j;
    57     i |= j;
    58     i ^= j;
    59     i <<= j;
    60     i >>= j;
    61 
    62     i ? i : j;
    63 
    64     // postfix function call
    65 
    66     (3 + 4)`mary;
    67     ({3 + 4;})`mary;
    68     [3, 4]`mary;
    69     3`mary;
    70     a[0]`mary;
    71     a[0]`mary`mary;
    72     s{0}`mary;
    73     a[3]`jane++;
    74     jack(3)`mary;
    75     s.i`mary;
    76     t.0`mary;
    77     s.[i]`mary;
    78     ps->i`mary;
    79     pt->0`mary;
    80     ps->[i]`mary;
    81     i++`mary;
    82     i--`mary;
    83     (S){2}`mary;
    84     (S)@{2}`mary;
     50    i?i:i;
    8551} // main
  • tests/quotedKeyword.cfa

    r4f7b418 r09f357ec  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Feb  1 00:02:22 2020
    13 // Update Count     : 24
     12// Last Modified On : Tue Dec  4 21:45:53 2018
     13// Update Count     : 23
    1414//
    1515
     
    1717
    1818struct {
    19         int ``otype``;
    20         int ``struct``;
     19        int `otype`;
     20        int `struct`;
    2121} st = { 10, 10 };
    2222
    23 typedef int ``forall``;
    24 ``forall`` xxx = 10;
     23typedef int `forall`;
     24`forall` xxx = 10;
    2525
    26 int ``_Alignas``, ``_Alignof``, ``__alignof``, ``__alignof__``, ``asm``, ``__asm``, ``__asm__``, ``_At``, ``_Atomic``, ``__attribute``,
    27         ``__attribute__``, ``auto``, ``_Bool``, ``break``, ``case``, ``catch``, ``catchResume``, ``char``, ``choose``, ``_Complex``, ``__complex``,
    28         ``__complex__``, ``const``, ``__const``, ``__const__``, ``continue``, ``default``, ``disable``, ``do``, ``double``, ``dtype``, ``else``,
    29         ``enable``, ``enum``, ``__extension__``, ``extern``, ``fallthru``, ``finally``, ``float``, ``__float128``, ``for``, ``forall``, ``fortran``,
    30         ``ftype``, ``_Generic``, ``goto``, ``if``, ``_Imaginary``, ``__imag``, ``__imag__``, ``inline``, ``__inline``, ``__inline__``, ``int``,
    31         ``__int128``, ``__label__``, ``long``, ``lvalue``, ``_Noreturn``, ``__builtin_offsetof``, ``otype``, ``register``, ``restrict``,
    32         ``__restrict``, ``__restrict__``, ``return``, ``short``, ``signed``, ``__signed``, ``__signed__``, ``sizeof``, ``static``,
    33         ``_Static_assert``, ``struct``, ``switch``, ``_Thread_local``, ``throw``, ``throwResume``, ``trait``, ``try``, ``typedef``,
    34         ``typeof``, ``__typeof``, ``__typeof__``, ``union``, ``unsigned``, ``__builtin_va_list``, ``void``, ``volatile``, ``__volatile``,
    35         ``__volatile__``, ``while``;
     26int `_Alignas`, `_Alignof`, `__alignof`, `__alignof__`, `asm`, `__asm`, `__asm__`, `_At`, `_Atomic`, `__attribute`,
     27        `__attribute__`, `auto`, `_Bool`, `break`, `case`, `catch`, `catchResume`, `char`, `choose`, `_Complex`, `__complex`,
     28        `__complex__`, `const`, `__const`, `__const__`, `continue`, `default`, `disable`, `do`, `double`, `dtype`, `else`,
     29        `enable`, `enum`, `__extension__`, `extern`, `fallthru`, `finally`, `float`, `__float128`, `for`, `forall`, `fortran`,
     30        `ftype`, `_Generic`, `goto`, `if`, `_Imaginary`, `__imag`, `__imag__`, `inline`, `__inline`, `__inline__`, `int`,
     31        `__int128`, `__label__`, `long`, `lvalue`, `_Noreturn`, `__builtin_offsetof`, `otype`, `register`, `restrict`,
     32        `__restrict`, `__restrict__`, `return`, `short`, `signed`, `__signed`, `__signed__`, `sizeof`, `static`,
     33        `_Static_assert`, `struct`, `switch`, `_Thread_local`, `throw`, `throwResume`, `trait`, `try`, `typedef`,
     34        `typeof`, `__typeof`, `__typeof__`, `union`, `unsigned`, `__builtin_va_list`, `void`, `volatile`, `__volatile`,
     35        `__volatile__`, `while`;
    3636
    3737int main() {
    38         int ``if`` = 0;
    39         ``catch`` = 1;
    40         st.``otype`` = 2;
    41         st.``struct`` = 3;
    42         ``throw`` = 4;
    43         sout | ``catch`` + st.``otype`` + st.``struct`` + ``throw``;
     38        int `if` = 0;
     39        `catch` = 1;
     40        st.`otype` = 2;
     41        st.`struct` = 3;
     42        `throw` = 4;
     43        sout | `catch` + st.`otype` + st.`struct` + `throw`;
    4444}
    4545
Note: See TracChangeset for help on using the changeset viewer.