Changeset 4f7b418
- Timestamp:
- Feb 4, 2020, 11:29:22 AM (3 years ago)
- Branches:
- arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 52142c2, 9f575ea, bdfc032
- Parents:
- 09f357ec (diff), e56eb455 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 5 added
- 1 deleted
- 30 edited
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
benchmark/Makefile.am
r09f357ec r4f7b418 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Mon Jan 20 11:50:13202014 ## Update Count : 2 4413 ## Last Modified On : Sat Jan 25 09:20:44 2020 14 ## Update Count : 255 15 15 ############################################################################### 16 16 … … 75 75 .ONESHELL: # use one shell to execute recipe 76 76 .NOTPARALLEL: 77 .PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv s ignal.csv78 79 ## ========================================================================================================= 80 81 all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) s ignal$(EXEEXT) waitfor$(EXEEXT) creation$(EXEEXT)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) 82 82 83 83 basic_loop_DURATION = 15000000000 … … 89 89 ctxswitch_rust_thread_DURATION = $(ctxswitch_pthread_DURATION) 90 90 ctxswitch_cfa_generator_DURATION = 5000000000 91 ctxswitch_nodejs_await_DURATION = 5000000 91 92 ctxswitch_DURATION = 100000000 92 93 93 mutex_java_DURATION = 1000000094 #mutex_java_DURATION = 10000000 94 95 mutex_DURATION = 50000000 95 96 96 s ignal_pthread_DURATION = 100000097 s ignal_java_DURATION = $(signal_pthread_DURATION)98 s ignal_rust_DURATION = $(signal_pthread_DURATION)99 s ignal_DURATION = 10000000100 101 waitfor_DURATION = 1000000097 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 102 103 103 104 creation_pthread_DURATION = 250000 104 creation_rust_DURATION = ${creation_pthread_DURATION} 105 creation_rust_thread_DURATION = ${creation_pthread_DURATION} 106 creation_java_thread_DURATION = ${creation_pthread_DURATION} 105 107 creation_cfa_coroutine_DURATION = 100000000 106 108 creation_cfa_coroutine_eager_DURATION = 10000000 … … 151 153 +make mutex.csv 152 154 -+make mutex.diff.csv 153 +make s ignal.csv154 -+make s ignal.diff.csv155 +make schedint.csv 156 -+make schedint.diff.csv 155 157 @DOifskipcompile@ 156 158 cat compile.csv … … 163 165 cat mutex.csv 164 166 -cat mutex.diff.csv 165 cat s ignal.csv166 -cat s ignal.diff.csv167 cat schedint.csv 168 -cat schedint.diff.csv 167 169 168 170 compile.csv: … … 198 200 $(srcdir)/fixcsv.sh $@ 199 201 200 s ignal.csv:201 echo "s ignal-1,signal-2,waitfor-1,waitfor-2" > $@202 +make s ignal-cfa1.runquiet >> $@ && echo -n ',' >> $@203 +make s ignal-cfa2.runquiet >> $@ && echo -n ',' >> $@204 +make waitfor-cfa1.runquiet >> $@ && echo -n ',' >> $@205 +make waitfor-cfa2.runquiet >> $@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 >> $@ 206 208 $(srcdir)/fixcsv.sh $@ 207 209 … … 247 249 ctxswitch-python_coroutine.run \ 248 250 ctxswitch-nodejs_coroutine.run \ 251 ctxswitch-nodejs_await.run \ 249 252 ctxswitch-goroutine_thread.run \ 250 253 ctxswitch-rust_thread.run \ … … 293 296 echo "#!/bin/sh" > a.out 294 297 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 295 303 chmod a+x a.out 296 304 … … 351 359 ## ========================================================================================================= 352 360 353 signal$(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 362 signal-pthread$(EXEEXT): 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): 371 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa 372 373 schedint-cfa2$(EXEEXT): 374 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa 375 376 schedint-cfa4$(EXEEXT): 377 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa 378 379 schedint-upp$(EXEEXT): 380 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc 381 382 schedint-rust$(EXEEXT): 383 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/schedint/rust.rs 384 385 schedint-java$(EXEEXT): 386 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java 387 echo "#!/bin/sh" > a.out 388 echo "java JavaThread" >> a.out 389 chmod a+x a.out 390 391 schedint-pthread$(EXEEXT): 363 392 $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c 364 393 365 signal-upp$(EXEEXT): 366 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc 367 368 signal-cfa1$(EXEEXT): 369 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa 370 371 signal-cfa2$(EXEEXT): 372 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa 373 374 signal-cfa4$(EXEEXT): 375 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa 376 377 signal-rust$(EXEEXT): 378 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/schedint/rust.rs 379 380 signal-java$(EXEEXT): 381 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java 382 echo "#!/bin/sh" > a.out 383 echo "java JavaThread" >> a.out 384 chmod a+x a.out 385 386 ## ========================================================================================================= 387 388 waitfor$(EXEEXT) : \ 389 waitfor-cfa1.run \ 390 waitfor-cfa2.run \ 391 waitfor-cfa4.run \ 392 waitfor-upp.run 393 394 waitfor-upp$(EXEEXT): 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): 404 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa 405 406 schedext-cfa2$(EXEEXT): 407 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa 408 409 schedext-cfa4$(EXEEXT): 410 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa 411 412 schedext-upp$(EXEEXT): 395 413 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc 396 414 397 waitfor-cfa1$(EXEEXT): 398 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa 399 400 waitfor-cfa2$(EXEEXT): 401 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa 402 403 waitfor-cfa4$(EXEEXT): 404 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa 415 schedext-goroutine$(EXEEXT): 416 $(BENCH_V_GOC)go build -o a.out $(srcdir)/schedext/goroutine.go 417 405 418 406 419 ## ========================================================================================================= 407 420 408 421 creation$(EXEEXT) : \ 422 creation-cfa_generator.run \ 409 423 creation-cfa_coroutine.run \ 410 424 creation-cfa_coroutine_eager.run \ … … 419 433 creation-pthread.run 420 434 435 creation-cfa_generator$(EXEEXT): 436 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_gen.cfa 437 421 438 creation-cfa_coroutine$(EXEEXT): 422 439 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa … … 450 467 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/creation/rust_thrd.rs 451 468 452 creation-java $(EXEEXT):469 creation-java_thread$(EXEEXT): 453 470 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java 454 471 echo "#!/bin/sh" > a.out -
benchmark/Makefile.in
r09f357ec r4f7b418 426 426 ctxswitch_rust_thread_DURATION = $(ctxswitch_pthread_DURATION) 427 427 ctxswitch_cfa_generator_DURATION = 5000000000 428 ctxswitch_nodejs_await_DURATION = 5000000 428 429 ctxswitch_DURATION = 100000000 429 mutex_java_DURATION = 10000000 430 431 #mutex_java_DURATION = 10000000 430 432 mutex_DURATION = 50000000 431 s ignal_pthread_DURATION = 1000000432 s ignal_java_DURATION = $(signal_pthread_DURATION)433 s ignal_rust_DURATION = $(signal_pthread_DURATION)434 s ignal_DURATION = 10000000435 waitfor_DURATION = 10000000433 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 436 438 creation_pthread_DURATION = 250000 437 creation_rust_DURATION = ${creation_pthread_DURATION} 439 creation_rust_thread_DURATION = ${creation_pthread_DURATION} 440 creation_java_thread_DURATION = ${creation_pthread_DURATION} 438 441 creation_cfa_coroutine_DURATION = 100000000 439 442 creation_cfa_coroutine_eager_DURATION = 10000000 … … 454 457 ctxswitch-cfa_thread2.run ctxswitch-upp_coroutine.run \ 455 458 ctxswitch-upp_thread.run ctxswitch-python_coroutine.run \ 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)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) 460 463 testdir = $(top_srcdir)/tests 461 464 all: all-am … … 784 787 .ONESHELL: # use one shell to execute recipe 785 788 .NOTPARALLEL: 786 .PHONY: compile.csv basic.csv ctxswitch.csv mutex.csv s ignal.csv787 788 all : basic$(EXEEXT) ctxswitch$(EXEEXT) mutex$(EXEEXT) s ignal$(EXEEXT) waitfor$(EXEEXT) creation$(EXEEXT)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) 789 792 790 793 %.run : %$(EXEEXT) ${REPEAT} … … 825 828 +make mutex.csv 826 829 -+make mutex.diff.csv 827 +make s ignal.csv828 -+make s ignal.diff.csv830 +make schedint.csv 831 -+make schedint.diff.csv 829 832 @DOifskipcompile@ 830 833 cat compile.csv … … 837 840 cat mutex.csv 838 841 -cat mutex.diff.csv 839 cat s ignal.csv840 -cat s ignal.diff.csv842 cat schedint.csv 843 -cat schedint.diff.csv 841 844 842 845 compile.csv: … … 872 875 $(srcdir)/fixcsv.sh $@ 873 876 874 s ignal.csv:875 echo "s ignal-1,signal-2,waitfor-1,waitfor-2" > $@876 +make s ignal-cfa1.runquiet >> $@ && echo -n ',' >> $@877 +make s ignal-cfa2.runquiet >> $@ && echo -n ',' >> $@878 +make waitfor-cfa1.runquiet >> $@ && echo -n ',' >> $@879 +make waitfor-cfa2.runquiet >> $@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 >> $@ 880 883 $(srcdir)/fixcsv.sh $@ 881 884 … … 935 938 echo "#!/bin/sh" > a.out 936 939 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 937 945 chmod a+x a.out 938 946 … … 989 997 chmod a+x a.out 990 998 991 signal$(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 1000 signal-pthread$(EXEEXT): 1001 $(BENCH_V_CC)$(COMPILE) $(srcdir)/schedint/pthreads.c 1002 1003 signal-upp$(EXEEXT): 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): 1009 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa 1010 1011 schedint-cfa2$(EXEEXT): 1012 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa 1013 1014 schedint-cfa4$(EXEEXT): 1015 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa 1016 1017 schedint-upp$(EXEEXT): 1004 1018 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc 1005 1019 1006 signal-cfa1$(EXEEXT): 1007 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa1.cfa 1008 1009 signal-cfa2$(EXEEXT): 1010 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa2.cfa 1011 1012 signal-cfa4$(EXEEXT): 1013 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedint/cfa4.cfa 1014 1015 signal-rust$(EXEEXT): 1020 schedint-rust$(EXEEXT): 1016 1021 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/schedint/rust.rs 1017 1022 1018 s ignal-java$(EXEEXT):1023 schedint-java$(EXEEXT): 1019 1024 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java 1020 1025 echo "#!/bin/sh" > a.out … … 1022 1027 chmod a+x a.out 1023 1028 1024 waitfor$(EXEEXT) : \ 1025 waitfor-cfa1.run \ 1026 waitfor-cfa2.run \ 1027 waitfor-cfa4.run \ 1028 waitfor-upp.run 1029 1030 waitfor-upp$(EXEEXT): 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): 1040 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa 1041 1042 schedext-cfa2$(EXEEXT): 1043 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa 1044 1045 schedext-cfa4$(EXEEXT): 1046 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa 1047 1048 schedext-upp$(EXEEXT): 1031 1049 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedext/upp.cc 1032 1050 1033 waitfor-cfa1$(EXEEXT): 1034 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa1.cfa 1035 1036 waitfor-cfa2$(EXEEXT): 1037 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa2.cfa 1038 1039 waitfor-cfa4$(EXEEXT): 1040 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/schedext/cfa4.cfa 1051 schedext-goroutine$(EXEEXT): 1052 $(BENCH_V_GOC)go build -o a.out $(srcdir)/schedext/goroutine.go 1041 1053 1042 1054 creation$(EXEEXT) : \ 1055 creation-cfa_generator.run \ 1043 1056 creation-cfa_coroutine.run \ 1044 1057 creation-cfa_coroutine_eager.run \ … … 1053 1066 creation-pthread.run 1054 1067 1068 creation-cfa_generator$(EXEEXT): 1069 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_gen.cfa 1070 1055 1071 creation-cfa_coroutine$(EXEEXT): 1056 1072 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa … … 1084 1100 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/creation/rust_thrd.rs 1085 1101 1086 creation-java $(EXEEXT):1102 creation-java_thread$(EXEEXT): 1087 1103 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java 1088 1104 echo "#!/bin/sh" > a.out -
benchmark/schedext/cfa1.cfa
r09f357ec r4f7b418 6 6 #include "../bench.h" 7 7 8 volatile int go = 0;9 10 8 monitor M {} m1; 11 9 12 10 void __attribute__((noinline)) call( M & mutex p1 ) {} 13 14 11 void __attribute__((noinline)) wait( M & mutex p1 ) { 15 go = 1;16 12 for ( times ) { 17 13 waitfor( call : p1 ); 18 14 } 19 go = 0;20 15 } 21 16 22 17 thread T {}; 23 18 void main( T & ) { 24 while ( go == 0 ) { yield(); }25 19 BENCH( 26 while ( go == 1) { call( m1 ); },20 for ( times ) { call( m1 ); }, 27 21 result 28 22 ) -
benchmark/schedext/cfa2.cfa
r09f357ec r4f7b418 4 4 #include <stdio.h> 5 5 6 #include "bench.h" 7 8 volatile int go = 0; 6 #include "../bench.h" 9 7 10 8 monitor M {} m1, m2; 11 9 12 10 void __attribute__((noinline)) call( M & mutex p1, M & mutex p2 ) {} 13 14 11 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2 ) { 15 go = 1;16 12 for ( times ) { 17 13 waitfor( call : p1, p2 ); 18 14 } 19 go = 0;20 15 } 21 22 16 thread T {}; 23 17 void main( T & ) { 24 while( go == 0 ) { yield(); }25 18 BENCH( 26 while ( go == 1 ) { call( m1, m2 ); }, 19 for ( times ) { 20 call( m1, m2 ); 21 }, 27 22 result 28 23 ) -
benchmark/schedext/cfa4.cfa
r09f357ec r4f7b418 4 4 #include <stdio.h> 5 5 6 #include "bench.h" 7 8 volatile int go = 0; 6 #include "../bench.h" 9 7 10 8 monitor M {} m1, m2, m3, m4; 11 9 12 10 void __attribute__((noinline)) call( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {} 13 14 11 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) { 15 go = 1;16 12 for ( times ) { 17 13 waitfor( call : p1, p2, p3, p4 ); 18 14 } 19 go = 0;20 15 } 21 22 16 thread T {}; 23 17 void main( T & ) { 24 while( go == 0 ) { yield(); }25 18 BENCH( 26 while( go == 1 ) { call( m1, m2, m3, m4 ); }, 19 for ( times ) { 20 call( m1, m2, m3, m4 ); 21 }, 27 22 result 28 23 ) -
benchmark/schedext/upp.cc
r09f357ec r4f7b418 3 3 #include "bench.h" 4 4 5 volatile int go = 0;6 7 5 _Monitor M { 8 6 public: 9 7 void __attribute__((noinline)) call() {} 10 11 int __attribute__((noinline)) wait() { 12 go = 1; 8 void __attribute__((noinline)) wait() { 13 9 for ( size_t i = 0; i < times; i++ ) { 14 10 _Accept(call); 15 11 } 16 go = 0;17 return 0;18 12 } 19 13 } m; … … 21 15 _Task T { 22 16 void main() { 23 while ( go == 0 ) { yield(); }24 17 BENCH( 25 while ( go == 1 ) { m.call(); }, 18 for ( size_t i = 0; i < times; i++ ) { 19 m.call(); 20 }, 26 21 result 27 22 ) … … 33 28 BENCH_START() 34 29 T t; 35 returnm.wait();30 m.wait(); 36 31 } 37 32 -
benchmark/schedint/JavaThread.java
r09f357ec r4f7b418 63 63 synchronized(m) { 64 64 s.start(); 65 while( ! Monitor.go ) {65 while( ! Monitor.go ) { // waiter must start first 66 66 Thread.yield(); 67 67 } -
benchmark/schedint/cfa1.cfa
r09f357ec r4f7b418 7 7 8 8 volatile int go = 0; 9 9 10 condition c; 10 11 monitor M {} m1; … … 13 14 signal( c ); 14 15 } 15 16 16 void __attribute__((noinline)) wait( M & mutex p1 ) { 17 17 go = 1; … … 19 19 wait( c ); 20 20 } 21 go = 0;22 21 } 23 22 24 23 thread T {}; 25 24 void main( T & ) { 26 while ( go == 0 ) { yield(); } 25 while ( go == 0 ) { yield(); } // waiter must start first 27 26 BENCH( 28 while ( go == 1) { call( m1 ); },27 for ( times ) { call( m1 ); }, 29 28 result 30 29 ) -
benchmark/schedint/cfa2.cfa
r09f357ec r4f7b418 7 7 8 8 volatile int go = 0; 9 9 10 condition c; 10 11 monitor M {} m1, m2; … … 13 14 signal( c ); 14 15 } 15 16 16 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2 ) { 17 17 go = 1; … … 19 19 wait( c ); 20 20 } 21 go = 0;22 21 } 23 22 24 23 thread T {}; 25 24 void main( T & ) { 26 while ( go == 0 ) { yield(); } 25 while ( go == 0 ) { yield(); } // waiter must start first 27 26 BENCH( 28 while ( go == 1) { call( m1, m2 ); },27 for ( times ) { call( m1, m2 ); }, 29 28 result 30 29 ) -
benchmark/schedint/cfa4.cfa
r09f357ec r4f7b418 4 4 #include <stdio.h> 5 5 6 #include " bench.h"6 #include "../bench.h" 7 7 8 8 volatile int go = 0; 9 9 10 condition c; 10 11 monitor M {} m1, m2, m3, m4; … … 13 14 signal( c ); 14 15 } 15 16 16 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) { 17 17 go = 1; … … 19 19 wait( c ); 20 20 } 21 go = 0;22 21 } 23 22 24 23 thread T {}; 25 24 void main( T & ) { 26 while ( go == 0 ) { yield(); } 25 while ( go == 0 ) { yield(); } // waiter must start first 27 26 BENCH( 28 while ( go == 1) { call( m1, m2, m3, m4 ); },27 for ( times ) { call( m1, m2, m3, m4 ); }, 29 28 result 30 29 ) -
benchmark/schedint/pthreads.c
r09f357ec r4f7b418 6 6 volatile int go = 0; 7 7 8 pthread_mutex_t m; 8 9 pthread_cond_t c; 9 pthread_mutex_t m;10 10 11 11 void __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 ); 15 15 } 16 16 17 int__attribute__((noinline)) wait() {17 void __attribute__((noinline)) wait() { 18 18 pthread_mutex_lock(&m); 19 19 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 20 30 BENCH( 21 for (size_t i = 0; i < times; i++) { 22 pthread_cond_wait(&c, &m); 23 }, 31 while ( go == 1 ) { call(); }, 24 32 result 25 33 ) 26 34 printf( "%g\n", result ); 27 go = 0;28 pthread_mutex_unlock(&m);29 return 0;30 }31 32 void* thread_main(__attribute__((unused)) void * arg ) {33 while(go == 0) { sched_yield(); }34 while(go == 1) { call(); }35 35 return NULL; 36 36 } … … 39 39 BENCH_START() 40 40 pthread_t thread; 41 if ( pthread_create(&thread, NULL, thread_main, NULL) < 0) {41 if ( pthread_create( &thread, NULL, thread_main, NULL ) < 0 ) { 42 42 perror( "failure" ); 43 43 return 1; 44 44 } 45 45 wait(); 46 if ( pthread_join( thread, NULL) < 0) {46 if ( pthread_join( thread, NULL ) < 0 ) { 47 47 perror( "failure" ); 48 48 return 1; -
benchmark/schedint/rust.rs
r09f357ec r4f7b418 18 18 19 19 let th = thread::spawn( move || { 20 while *m2.lock().unwrap() == 0 { 20 while *m2.lock().unwrap() == 0 { // waiter must start first 21 21 thread::yield_now(); 22 22 } -
benchmark/schedint/upp.cc
r09f357ec r4f7b418 11 11 cond.signal(); 12 12 } 13 void __attribute__((noinline)) wait() { 14 go = 1; 15 for ( size_t i = 0; i < times; i++ ) { 16 cond.wait(); 17 } 18 } 19 } m; 13 20 14 int __attribute__((noinline)) wait() { 15 go = 1; 21 _Task T { 22 void main() { 23 while ( go == 0 ) { yield(); } // waiter must start first 16 24 BENCH( 17 for ( size_t i = 0; i < times; i++) {18 cond.wait();25 for ( size_t i = 0; i < times; i++ ) { 26 m.call(); 19 27 }, 20 28 result 21 29 ) 22 30 printf( "%g\n", result ); 23 go = 0;24 return 0;25 }26 };27 28 M m;29 30 _Task T {31 void main() {32 while(go == 0) { yield(); }33 while(go == 1) { m.call(); }34 35 31 } 36 32 }; … … 39 35 BENCH_START() 40 36 T t; 41 returnm.wait();37 m.wait(); 42 38 } 43 39 -
driver/cfa.cc
r09f357ec r4f7b418 10 10 // Created On : Tue Aug 20 13:44:49 2002 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Sep 10 17:00:15 201913 // Update Count : 42 012 // Last Modified On : Fri Jan 31 16:48:03 2020 13 // Update Count : 421 14 14 // 15 15 … … 187 187 } else if ( arg == "-XCFA" ) { // CFA pass through 188 188 i += 1; 189 if ( i == argc ) continue; // next argument available ? 189 190 Putenv( argv, argv[i] ); 190 191 -
libcfa/src/bits/defs.hfa
r09f357ec r4f7b418 10 10 // Created On : Thu Nov 9 13:24:10 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Feb 8 16:22:41 201813 // Update Count : 812 // Last Modified On : Tue Jan 28 22:38:27 2020 13 // Update Count : 9 14 14 // 15 15 … … 34 34 35 35 #ifdef __cforall 36 void abort ( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )); 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__ )); 37 38 extern "C" { 38 39 #endif -
libcfa/src/bits/signal.hfa
r09f357ec r4f7b418 40 40 sigaddset( &act.sa_mask, SIGALRM ); // disabled during signal handler 41 41 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 ); 42 49 act.sa_flags = flags; 43 50 44 if ( sigaction( sig, &act, NULL) == -1 ) {51 if ( sigaction( sig, &act, 0p ) == -1 ) { 45 52 __cfaabi_dbg_print_buffer_decl( 46 53 " __cfaabi_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n", … … 48 55 ); 49 56 _exit( EXIT_FAILURE ); 50 } 57 } // if 51 58 } 52 53 // Sigaction wrapper : restore default handler54 static 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
r09f357ec r4f7b418 10 10 // Created On : Tue Jan 17 12:27:26 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 5 16:25:52 201913 // Update Count : 5 212 // Last Modified On : Thu Jan 30 22:55:50 2020 13 // Update Count : 56 14 14 // 15 15 … … 844 844 sigemptyset( &mask ); 845 845 sigaddset( &mask, SIGALRM ); // block SIGALRM signals 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 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 848 849 } 849 850 else { -
libcfa/src/interpose.cfa
r09f357ec r4f7b418 10 10 // Created On : Wed Mar 29 16:10:31 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 13:45:21 201913 // Update Count : 1 2112 // Last Modified On : Thu Jan 30 17:47:32 2020 13 // Update Count : 156 14 14 // 15 15 … … 95 95 void __cfaabi_interpose_startup(void) __attribute__(( constructor( STARTUP_PRIORITY_CORE ) )); 96 96 void __cfaabi_interpose_startup( void ) { 97 const char *version = NULL;97 const char *version = 0p; 98 98 99 99 preload_libgcc(); … … 105 105 #pragma GCC diagnostic pop 106 106 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 107 124 // Failure handler 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 ); 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 115 133 } 116 134 } … … 123 141 void exit( int status, const char fmt[], ... ) __attribute__(( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ )); 124 142 void 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__ )); 125 144 126 145 extern "C" { 127 146 void abort( void ) __attribute__(( __nothrow__, __leaf__, __noreturn__ )) { 128 abort( NULL );147 abort( false, NULL ); // FIX ME: 0p does not work 129 148 } 130 149 … … 132 151 va_list argp; 133 152 va_start( argp, fmt ); 134 abort( f mt, argp );153 abort( false, fmt, argp ); 135 154 va_end( argp ); 136 155 } … … 141 160 } 142 161 143 void * kernel_abort ( void ) __attribute__(( __nothrow__, __leaf__, __weak__ )) { return NULL; } 144 void kernel_abort_msg( void * data, char * buffer, int size ) __attribute__(( __nothrow__, __leaf__, __weak__ )) {} 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. 145 165 int kernel_abort_lastframe( void ) __attribute__(( __nothrow__, __leaf__, __weak__ )) { return 4; } 146 166 147 167 enum { abort_text_size = 1024 }; 148 168 static char abort_text[ abort_text_size ]; 149 static int abort_lastframe; 150 151 void 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 159 void 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 184 static void __cfaabi_backtrace() { 169 170 static void __cfaabi_backtrace( int start ) { 185 171 enum { 186 172 Frames = 50, // maximum number of stack frames 187 Start = 8, // skip first N stack frames188 173 }; 174 int last = kernel_abort_lastframe(); // skip last N stack frames 189 175 190 176 void * array[Frames]; … … 192 178 char ** messages = backtrace_symbols( array, size ); 193 179 194 // find executable name 195 *index( messages[0], '(' ) = '\0'; 180 *index( messages[0], '(' ) = '\0'; // find executable name 196 181 __cfaabi_bits_print_nolock( STDERR_FILENO, "Stack back trace for: %s\n", messages[0]); 197 182 198 for ( int i = Start; i < size - abort_lastframe&& messages != 0p; i += 1 ) {183 for ( unsigned int i = start; i < size - last && messages != 0p; i += 1 ) { 199 184 char * name = 0p, * offset_begin = 0p, * offset_end = 0p; 200 185 201 for ( char * p = messages[i]; *p; ++p ) { 186 for ( char * p = messages[i]; *p; ++p ) { // find parantheses and +offset 202 187 //__cfaabi_bits_print_nolock( "X %s\n", p); 203 // find parantheses and +offset204 188 if ( *p == '(' ) { 205 189 name = p; … … 212 196 } 213 197 214 // if line contains symbol print it215 int frameNo = i - Start;198 // if line contains symbol, print it 199 int frameNo = i - start; 216 200 if ( name && offset_begin && offset_end && name < offset_begin ) { 217 // delimit strings 218 *name++ = '\0'; 201 *name++ = '\0'; // delimit strings 219 202 *offset_begin++ = '\0'; 220 203 *offset_end++ = '\0'; … … 228 211 } 229 212 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 230 256 void sigHandler_segv( __CFA_SIGPARMS__ ) { 231 if ( sfp->si_addr == NULL) {232 abort( "Null pointer (0p) dereference.\n" );257 if ( sfp->si_addr == 0p ) { 258 abort( true, "Null pointer (0p) dereference.\n" ); 233 259 } else { 234 abort( "%s at memory location %p.\n"260 abort( true, "%s at memory location %p.\n" 235 261 "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", 236 262 (sig == SIGSEGV ? "Segment fault" : "Bus error"), sfp->si_addr ); … … 239 265 240 266 void sigHandler_ill( __CFA_SIGPARMS__ ) { 241 abort( "Executing illegal instruction at location %p.\n"267 abort( true, "Executing illegal instruction at location %p.\n" 242 268 "Possible cause is stack corruption.\n", 243 269 sfp->si_addr ); … … 255 281 default: msg = "unknown"; 256 282 } // choose 257 abort( "Computation error %s at location %p.\n", msg, sfp->si_addr ); 258 } 259 260 void sigHandler_abrt( __CFA_SIGPARMS__ ) { 261 __cfaabi_backtrace(); 262 263 // reset default signal handler 264 __cfaabi_sigdefault( SIGABRT ); 265 266 raise( SIGABRT ); 283 abort( true, "Computation error %s at location %p.\n", msg, sfp->si_addr ); 267 284 } 268 285 269 286 void sigHandler_term( __CFA_SIGPARMS__ ) { 270 abort( "Application stopped by %s signal.", sig == SIGINT ? "an interrupt (SIGINT)" : "a terminate (SIGTERM)");287 abort( true, "Application interrupted by signal: %s.\n", strsignal( sig ) ); 271 288 } 272 289 -
libcfa/src/stdhdr/bfdlink.h
r09f357ec r4f7b418 10 10 // Created On : Tue Jul 18 07:26:04 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Jul 22 13:49:30 201813 // Update Count : 412 // Last Modified On : Sat Feb 1 07:15:29 2020 13 // Update Count : 5 14 14 // 15 15 16 16 // include file uses the CFA keyword "with". 17 17 #if ! defined( with ) // nesting ? 18 #define with ` with`// make keyword an identifier18 #define with ``with`` // make keyword an identifier 19 19 #define __CFA_BFDLINK_H__ 20 20 #endif -
libcfa/src/stdhdr/hwloc.h
r09f357ec r4f7b418 10 10 // Created On : Tue Jul 18 07:45:00 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Jul 22 13:49:58 201813 // Update Count : 412 // Last Modified On : Sat Feb 1 07:15:39 2020 13 // Update Count : 5 14 14 // 15 15 16 16 // include file uses the CFA keyword "thread". 17 17 #if ! defined( thread ) // nesting ? 18 #define thread ` thread`// make keyword an identifier18 #define thread ``thread`` // make keyword an identifier 19 19 #define __CFA_HWLOC_H__ 20 20 #endif -
libcfa/src/stdhdr/krb5.h
r09f357ec r4f7b418 10 10 // Created On : Tue Jul 18 07:55:44 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Jul 22 13:50:24 201813 // Update Count : 412 // Last Modified On : Sat Feb 1 07:15:47 2020 13 // Update Count : 5 14 14 // 15 15 16 16 // include file uses the CFA keyword "enable". 17 17 #if ! defined( enable ) // nesting ? 18 #define enable ` enable`// make keyword an identifier18 #define enable ``enable`` // make keyword an identifier 19 19 #define __CFA_KRB5_H__ 20 20 #endif -
libcfa/src/stdhdr/math.h
r09f357ec r4f7b418 10 10 // Created On : Mon Jul 4 23:25:26 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 22 18:16:07 201813 // Update Count : 1 312 // Last Modified On : Sat Feb 1 07:15:58 2020 13 // Update Count : 14 14 14 // 15 15 16 16 extern "C" { 17 17 #if ! defined( exception ) // nesting ? 18 #define exception ` exception` // make keyword an identifier18 #define exception ``exception`` // make keyword an identifier 19 19 #define __CFA_MATH_H__ 20 20 #endif -
libcfa/src/stdhdr/sys/ucontext.h
r09f357ec r4f7b418 10 10 // Created On : Thu Feb 8 23:48:16 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 8 23:50:44 201813 // Update Count : 412 // Last Modified On : Sat Feb 1 07:16:05 2020 13 // Update Count : 5 14 14 // 15 15 16 16 #if ! defined( ftype ) // nesting ? 17 #define ftype ` ftype` // make keyword an identifier17 #define ftype ``ftype`` // make keyword an identifier 18 18 #define __CFA_UCONTEXT_H__ 19 19 #endif -
src/ControlStruct/LabelFixer.cc
r09f357ec r4f7b418 45 45 void LabelFixer::postvisit( FunctionDecl * functionDecl ) { 46 46 PassVisitor<MultiLevelExitMutator> mlem( resolveJumps(), generator ); 47 functionDecl->acceptMutator( mlem ); 47 // We start in the body so we can stop when we hit another FunctionDecl. 48 maybeMutate( functionDecl->statements, mlem ); 48 49 } 49 50 -
src/ControlStruct/MLEMutator.cc
r09f357ec r4f7b418 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Jan 21 10:33:00 202013 // Update Count : 22 212 // Last Modified On : Wed Jan 22 11:50:00 2020 13 // Update Count : 223 14 14 // 15 15 … … 60 60 } 61 61 } // namespace 62 63 void MultiLevelExitMutator::premutate( FunctionDecl * ) { 64 visit_children = false; 65 } 62 66 63 67 // break labels have to come after the statement they break out of, so mutate a statement, then if they inform us … … 352 356 }); 353 357 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 } 354 366 } 355 367 -
src/ControlStruct/MLEMutator.h
r09f357ec r4f7b418 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Jan 21 10:33:00 202013 // Update Count : 4 712 // Last Modified On : Wed Jan 22 11:50:00 2020 13 // Update Count : 48 14 14 // 15 15 … … 38 38 ~MultiLevelExitMutator(); 39 39 40 void premutate( FunctionDecl * ); 41 40 42 void premutate( CompoundStmt *cmpndStmt ); 41 43 Statement * postmutate( BranchStmt *branchStmt ) throw ( SemanticErrorException ); … … 49 51 void premutate( SwitchStmt *switchStmt ); 50 52 Statement * postmutate( SwitchStmt *switchStmt ); 53 void premutate( ReturnStmt *returnStmt ); 51 54 void premutate( TryStmt *tryStmt ); 52 55 Statement * postmutate( TryStmt *tryStmt ); … … 113 116 Label breakLabel; 114 117 LabelGenerator *generator; 118 bool inFinally = false; 115 119 116 120 template< typename LoopClass > -
src/Parser/lex.ll
r09f357ec r4f7b418 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : S un Aug 4 20:53:47 201913 * Update Count : 7 1912 * Last Modified On : Sat Feb 1 07:16:44 2020 13 * Update Count : 724 14 14 */ 15 15 … … 330 330 /* identifier */ 331 331 {identifier} { IDENTIFIER_RETURN(); } 332 "` "{identifier}"`" { // CFA333 yytext[yyleng - 1] = '\0'; yytext += 1; // SKULLDUGGERY: remove backquotes (ok to shorten?)332 "``"{identifier}"``" { // CFA 333 yytext[yyleng - 2] = '\0'; yytext += 2; // SKULLDUGGERY: remove backquotes (ok to shorten?) 334 334 IDENTIFIER_RETURN(); 335 335 } -
src/Parser/parser.yy
r09f357ec r4f7b418 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jan 17 14:54:55202013 // Update Count : 44 2612 // Last Modified On : Sat Feb 1 10:04:40 2020 13 // Update Count : 4440 14 14 // 15 15 … … 579 579 | '(' compound_statement ')' // GCC, lambda expression 580 580 { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); } 581 | constant '`' IDENTIFIER // CFA, postfix call582 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }583 | string_literal '`' IDENTIFIER // CFA, postfix call584 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); }585 | IDENTIFIER '`' IDENTIFIER // CFA, postfix call586 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( build_varref( $1 ) ) ) ); }587 | tuple '`' IDENTIFIER // CFA, postfix call588 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }589 | '(' comma_expression ')' '`' IDENTIFIER // CFA, postfix call590 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); }591 581 | type_name '.' identifier // CFA, nested type 592 582 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; } … … 642 632 | postfix_expression '(' argument_expression_list ')' 643 633 { $$ = 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 ) ) ); } 644 640 | postfix_expression '.' identifier 645 641 { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); } … … 666 662 | '(' type_no_function ')' '@' '{' initializer_list_opt comma_opt '}' // CFA, explicit C compound-literal 667 663 { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); } 668 | '^' primary_expression '{' argument_expression_list '}' // CFA 664 | '^' primary_expression '{' argument_expression_list '}' // CFA, destructor call 669 665 { 670 666 Token fn; -
tests/exceptions/finally-error.cfa
r09f357ec r4f7b418 142 142 } 143 143 144 // Checked in the same place, make sure it does't break. 145 void break_in_function() { 146 while (true) { 147 void inner() { 148 break; 149 } 150 } 151 } 152 144 153 void main() { 145 154 // Should not compile. -
tests/expression.cfa
r09f357ec r4f7b418 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 1 9 int main() { 2 struct s { int i; } x, *p = &x; 3 int i = 3; 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; 4 15 5 16 // operators 6 17 7 ! 18 !i; 8 19 ~i; 9 20 +i; 10 21 -i; 11 *p ;12 ++p ;13 --p ;14 p ++;15 p --;22 *ps; 23 ++ps; 24 --ps; 25 ps++; 26 ps--; 16 27 17 i +i;18 i -i;19 i *i;28 i + j; 29 i - j; 30 i * j; 20 31 21 i /i;22 i %i;23 i ^i;24 i &i;25 i |i;26 i <i;27 i >i;28 i =i;32 i / j; 33 i % j; 34 i ^ j; 35 i & j; 36 i | j; 37 i < j; 38 i > j; 39 i = j; 29 40 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; 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; 49 50 50 i?i:i; 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; 51 85 } // main -
tests/quotedKeyword.cfa
r09f357ec r4f7b418 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 4 21:45:53 201813 // Update Count : 2 312 // Last Modified On : Sat Feb 1 00:02:22 2020 13 // Update Count : 24 14 14 // 15 15 … … 17 17 18 18 struct { 19 int ` otype`;20 int ` struct`;19 int ``otype``; 20 int ``struct``; 21 21 } st = { 10, 10 }; 22 22 23 typedef int ` forall`;24 ` forall` xxx = 10;23 typedef int ``forall``; 24 ``forall`` xxx = 10; 25 25 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`;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``; 36 36 37 37 int 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``; 44 44 } 45 45
Note: See TracChangeset
for help on using the changeset viewer.