Changes in / [aefb247:bdfc032]
- Files:
-
- 32 added
- 10 deleted
- 95 edited
Legend:
- Unmodified
- Added
- Removed
-
benchmark/Makefile.am
raefb247 rbdfc032 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Mon Jul 29 18:02:19 201914 ## Update Count : 5413 ## Last Modified On : Sat Jan 25 09:20:44 2020 14 ## Update Count : 255 15 15 ############################################################################### 16 16 … … 28 28 BENCH_V_CFA = $(__bench_v_CFA_$(__quiet)) 29 29 BENCH_V_CXX = $(__bench_v_CXX_$(__quiet)) 30 BENCH_V_UPP = $(__bench_v_UPP_$(__quiet)) 30 31 BENCH_V_GOC = $(__bench_v_GOC_$(__quiet)) 32 BENCH_V_RUSTC = $(__bench_v_RUSTC_$(__quiet)) 33 BENCH_V_NODEJS = $(__bench_v_NODEJS_$(__quiet)) 31 34 BENCH_V_JAVAC = $(__bench_v_JAVAC_$(__quiet)) 32 BENCH_V_UPP = $(__bench_v_UPP_$(__quiet))33 35 34 36 __quiet = verbose … … 36 38 __bench_v_CFA_quiet = @ 37 39 __bench_v_CXX_quiet = @ 40 __bench_v_UPP_quiet = @ 38 41 __bench_v_GOC_quiet = @ 42 __bench_v_RUSTC_quiet = @ 39 43 __bench_v_JAVAC_quiet = @ 40 __bench_v_UPP_quiet = @41 44 __bench_v_CC_verbose = $(AM_V_CC) 42 45 __bench_v_CFA_verbose = $(AM_V_CFA) 43 46 __bench_v_CXX_verbose = $(AM_V_CXX) 47 __bench_v_UPP_verbose = $(AM_V_UPP) 44 48 __bench_v_GOC_verbose = $(AM_V_GOC) 49 __bench_v_RUSTC_verbose = $(AM_V_RUSTC) 50 __bench_v_NODEJS_verbose = $(AM_V_NODEJS) 45 51 __bench_v_JAVAC_verbose = $(AM_V_JAVAC) 46 __bench_v_UPP_verbose = $(AM_V_UPP)47 52 48 53 … … 51 56 STATS = ${abs_top_srcdir}/tools/stat.py 52 57 # NEED AT LEAST 4 DATA VALUES FOR BENCHMARKS BECAUSE THE MAX AND MIN VALUES ARE REMOVED 53 repeats = 5# 31 for benchmarks58 repeats = 13 # 31 for benchmarks 54 59 arch = x64 55 60 skipcompile = no … … 62 67 63 68 dummyC.c: 64 @echo "int main() { return 0; }" > ${@}69 echo "int main() { return 0; }" > ${@} 65 70 66 71 dummyCXX.cpp: 67 @echo "int main() { return 0; }" > ${@} 68 72 echo "int main() { return 0; }" > ${@} 73 74 #.SILENT: # do not print recipe 75 .ONESHELL: # use one shell to execute recipe 69 76 .NOTPARALLEL: 70 .PHONY: compile.csv ctxswitch.csv mutex.csv signal.csv 71 72 ## ========================================================================================================= 73 all : ctxswitch$(EXEEXT) mutex$(EXEEXT) signal$(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 83 basic_loop_DURATION = 15000000000 84 basic_function_DURATION = 10000000000 85 basic_tls_fetch_add_DURATION = 10000000000 86 basic_DURATION = 250000000 87 88 ctxswitch_pthread_DURATION = 25000000 89 ctxswitch_rust_thread_DURATION = $(ctxswitch_pthread_DURATION) 90 ctxswitch_cfa_generator_DURATION = 5000000000 91 ctxswitch_nodejs_await_DURATION = 5000000 92 ctxswitch_DURATION = 100000000 93 94 #mutex_java_DURATION = 10000000 95 mutex_DURATION = 50000000 96 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 103 104 creation_pthread_DURATION = 250000 105 creation_rust_thread_DURATION = ${creation_pthread_DURATION} 106 creation_java_thread_DURATION = ${creation_pthread_DURATION} 107 creation_cfa_coroutine_DURATION = 100000000 108 creation_cfa_coroutine_eager_DURATION = 10000000 109 creation_upp_coroutine_DURATION = ${creation_cfa_coroutine_eager_DURATION} 110 creation_cfa_thread_DURATION = 10000000 111 creation_upp_thread_DURATION = ${creation_cfa_thread_DURATION} 112 creation_DURATION = 10000000 74 113 75 114 %.run : %$(EXEEXT) ${REPEAT} 76 @rm -f .result.log 77 @echo "------------------------------------------------------" 78 @echo $< 79 @${REPEAT} ${repeats} ./a.out | tee -a .result.log 80 @${STATS} .result.log 81 @echo "------------------------------------------------------" 82 @rm -f a.out .result.log *.class 115 rm -f .result.log 116 echo "------------------------------------------------------" 117 echo $< 118 ${REPEAT} ${repeats} -- ./a.out\ 119 $(if ${$(subst -,_,$(basename $@))_DURATION},\ 120 ${$(subst -,_,$(basename $@))_DURATION},\ 121 ${$(firstword $(subst -, ,$(basename $@)))_DURATION}) | tee -a .result.log 122 ${STATS} .result.log 123 echo "------------------------------------------------------" 124 rm -f a.out .result.log *.class 125 126 # ${REPEAT} ${repeats} -- /usr/bin/time -f "%Uu %Ss %Er %Mkb" ./a.out 83 127 84 128 %.runquiet : 85 @+make $(basename $@) CFLAGS="-w" __quiet=quiet86 @taskset -c 1 ./a.out87 @rm -f a.out129 +make $(basename $@) CFLAGS="-w" __quiet=quiet 130 taskset -c 1 ./a.out 131 rm -f a.out 88 132 89 133 %.make : 90 @printf "${PRINT_FORMAT}" $(basename $(subst compile-,,$@))91 @+/usr/bin/time -f ${TIME_FORMAT} make $(basename $@) 2>&1134 printf "${PRINT_FORMAT}" $(basename $(subst compile-,,$@)) 135 +/usr/bin/time -f ${TIME_FORMAT} make $(basename $@) 2>&1 92 136 93 137 ${REPEAT} : 94 @+make -C ${abs_top_builddir}/tools repeat138 +make -C ${abs_top_builddir}/tools repeat 95 139 96 140 ## ========================================================================================================= … … 100 144 jenkins$(EXEEXT): 101 145 @DOifskipcompile@ 102 @+make compile.csv103 @-+make compile.diff.csv146 +make compile.csv 147 -+make compile.diff.csv 104 148 @DOendif@ 105 @+make ctxswitch.csv 106 @-+make ctxswitch.diff.csv 107 @+make mutex.csv 108 @-+make mutex.diff.csv 109 @+make signal.csv 110 @-+make signal.diff.csv 149 +make basic.csv 150 -+make basic.diff.csv 151 +make ctxswitch.csv 152 -+make ctxswitch.diff.csv 153 +make mutex.csv 154 -+make mutex.diff.csv 155 +make schedint.csv 156 -+make schedint.diff.csv 111 157 @DOifskipcompile@ 112 158 cat compile.csv 113 159 -cat compile.diff.csv 114 160 @DOendif@ 161 cat basic.csv 162 -cat basic.diff.csv 115 163 cat ctxswitch.csv 116 164 -cat ctxswitch.diff.csv 117 165 cat mutex.csv 118 166 -cat mutex.diff.csv 119 cat s ignal.csv120 -cat s ignal.diff.csv167 cat schedint.csv 168 -cat schedint.diff.csv 121 169 122 170 compile.csv: 123 @echo "array,attributes,empty,expression,io,monitor,operators,typeof" > $@ 124 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-array.make >> $@ 125 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-attributes.make >> $@ 126 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-empty.make >> $@ 127 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-expression.make >> $@ 128 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-io.make >> $@ 129 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-monitor.make >> $@ 130 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-operators.make >> $@ 131 @+make TIME_FORMAT='%e' PRINT_FORMAT='' compile-typeof.make >> $@ 132 @$(srcdir)/fixcsv.sh $@ 171 echo "array,attributes,empty,expression,io,monitor,operators,typeof" > $@ 172 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-array.make >> $@ 173 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-attributes.make >> $@ 174 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-empty.make >> $@ 175 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-expression.make >> $@ 176 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-io.make >> $@ 177 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-monitor.make >> $@ 178 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-operators.make >> $@ 179 +make TIME_FORMAT='%e' PRINT_FORMAT='' compile-typeof.make >> $@ 180 $(srcdir)/fixcsv.sh $@ 181 182 basic.csv: 183 echo "generator,coroutine,thread" > $@ 184 +make basic-cfa_generator.runquiet >> $@ && echo -n ',' >> $@ 185 +make basic-cfa_coroutine.runquiet >> $@ && echo -n ',' >> $@ 186 +make basic-cfa_thread.runquiet >> $@ 187 $(srcdir)/fixcsv.sh $@ 133 188 134 189 ctxswitch.csv: 135 @echo "generator,coroutine,thread" > $@136 @+make ctxswitch-cfa_generator.runquiet >> $@ && echo -n ',' >> $@137 @+make ctxswitch-cfa_coroutine.runquiet >> $@ && echo -n ',' >> $@138 @+make ctxswitch-cfa_thread.runquiet >> $@139 @$(srcdir)/fixcsv.sh $@190 echo "generator,coroutine,thread" > $@ 191 +make ctxswitch-cfa_generator.runquiet >> $@ && echo -n ',' >> $@ 192 +make ctxswitch-cfa_coroutine.runquiet >> $@ && echo -n ',' >> $@ 193 +make ctxswitch-cfa_thread.runquiet >> $@ 194 $(srcdir)/fixcsv.sh $@ 140 195 141 196 mutex.csv: 142 @echo "1-monitor,2-monitor" > $@143 @+make mutex-cfa1.runquiet >> $@ && echo -n ',' >> $@144 @+make mutex-cfa2.runquiet >> $@145 @$(srcdir)/fixcsv.sh $@146 147 s ignal.csv:148 @echo "signal-1,signal-2,waitfor-1,waitfor-2" > $@149 @+make signal-cfa1.runquiet >> $@ && echo -n ',' >> $@150 @+make signal-cfa2.runquiet >> $@ && echo -n ',' >> $@151 @+make waitfor-cfa1.runquiet >> $@ && echo -n ',' >> $@152 @+make waitfor-cfa2.runquiet >> $@153 @$(srcdir)/fixcsv.sh $@197 echo "1-monitor,2-monitor" > $@ 198 +make mutex-cfa1.runquiet >> $@ && echo -n ',' >> $@ 199 +make mutex-cfa2.runquiet >> $@ 200 $(srcdir)/fixcsv.sh $@ 201 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 >> $@ 208 $(srcdir)/fixcsv.sh $@ 154 209 155 210 %.diff.csv: %.csv 156 @test -e $(srcdir)/baselines/$(arch)/$< || (echo "Error : Missing baseline for ${<}" && false) 157 @$(srcdir)/baselines/calc.py $(srcdir)/baselines/$(arch)/$(<) $(<) > $@ 158 159 160 ## ========================================================================================================= 161 loop$(EXEEXT): 162 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c 163 164 function$(EXEEXT): 165 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/function.c 166 167 fetch_add$(EXEEXT): 168 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000000 $(srcdir)/fetch_add.c 169 170 ttst_lock$(EXEEXT): 171 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000000 $(srcdir)/ttst_lock.c 172 173 tls-fetch_add$(EXEEXT): 174 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000000 $(srcdir)/tls-fetch_add.c 175 176 ## ========================================================================================================= 177 CTXSWITCH_DEPEND = \ 178 loop.run \ 179 function.run \ 180 fetch_add.run \ 181 ttst_lock.run \ 182 tls-fetch_add.run \ 183 ctxswitch-pthread.run \ 211 test -e $(srcdir)/baselines/$(arch)/$< || (echo "Error : Missing baseline for ${<}" && false) 212 $(srcdir)/baselines/calc.py $(srcdir)/baselines/$(arch)/$(<) $(<) > $@ 213 214 ## ========================================================================================================= 215 216 BASIC_DEPEND = \ 217 basic-loop.run \ 218 basic-function.run \ 219 basic-fetch_add.run \ 220 basic-ttst_lock.run \ 221 basic-tls-fetch_add.run 222 223 basic-loop$(EXEEXT): 224 $(BENCH_V_CC)$(COMPILE) $(srcdir)/basic/loop.c 225 226 basic-function$(EXEEXT): 227 $(BENCH_V_CC)$(COMPILE) $(srcdir)/basic/function.c 228 229 basic-fetch_add$(EXEEXT): 230 $(BENCH_V_CC)$(COMPILE) $(srcdir)/basic/fetch_add.c 231 232 basic-ttst_lock$(EXEEXT): 233 $(BENCH_V_CC)$(COMPILE) $(srcdir)/basic/ttst_lock.c 234 235 basic-tls-fetch_add$(EXEEXT): 236 $(BENCH_V_CC)$(COMPILE) $(srcdir)/basic/tls_fetch_add.c 237 238 basic$(EXEEXT): $(BASIC_DEPEND) 239 240 ## ========================================================================================================= 241 242 CTXSWITCH_DEPEND = \ 184 243 ctxswitch-cfa_generator.run \ 185 244 ctxswitch-cfa_coroutine.run \ … … 188 247 ctxswitch-upp_coroutine.run \ 189 248 ctxswitch-upp_thread.run \ 190 ctxswitch-goroutine.run \ 191 ctxswitch-java_thread.run 192 249 ctxswitch-python_coroutine.run \ 250 ctxswitch-nodejs_coroutine.run \ 251 ctxswitch-nodejs_await.run \ 252 ctxswitch-goroutine_thread.run \ 253 ctxswitch-rust_thread.run \ 254 ctxswitch-nodejs_coroutine.run \ 255 ctxswitch-java_thread.run \ 256 ctxswitch-pthread.run 193 257 194 258 if WITH_LIBFIBRE 195 CTXSWITCH_DEPEND += 196 ctxswitch-kos_fibre.run 259 CTXSWITCH_DEPEND += \ 260 ctxswitch-kos_fibre.run \ 197 261 ctxswitch-kos_fibre2.run 198 199 262 200 263 ctxswitch-kos_fibre$(EXEEXT): … … 207 270 ctxswitch$(EXEEXT): $(CTXSWITCH_DEPEND) 208 271 209 ctxswitch-pthread$(EXEEXT):210 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/pthreads.c211 212 272 ctxswitch-cfa_generator$(EXEEXT): 213 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000$(srcdir)/ctxswitch/cfa_gen.cfa273 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/ctxswitch/cfa_gen.cfa 214 274 215 275 ctxswitch-cfa_coroutine$(EXEEXT): 216 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000$(srcdir)/ctxswitch/cfa_cor.cfa276 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/ctxswitch/cfa_cor.cfa 217 277 218 278 ctxswitch-cfa_thread$(EXEEXT): 219 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000$(srcdir)/ctxswitch/cfa_thrd.cfa279 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/ctxswitch/cfa_thrd.cfa 220 280 221 281 ctxswitch-cfa_thread2$(EXEEXT): 222 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000$(srcdir)/ctxswitch/cfa_thrd2.cfa282 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/ctxswitch/cfa_thrd2.cfa 223 283 224 284 ctxswitch-upp_coroutine$(EXEEXT): 225 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000$(srcdir)/ctxswitch/upp_cor.cc285 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/ctxswitch/upp_cor.cc 226 286 227 287 ctxswitch-upp_thread$(EXEEXT): 228 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc 229 230 ctxswitch-goroutine$(EXEEXT): 288 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/ctxswitch/upp_thrd.cc 289 290 ctxswitch-python_coroutine$(EXEEXT): 291 echo "#!/bin/sh" > a.out 292 echo "python3.7 $(srcdir)/ctxswitch/python_cor.py" >> a.out 293 chmod a+x a.out 294 295 ctxswitch-nodejs_coroutine$(EXEEXT): 296 echo "#!/bin/sh" > a.out 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 303 chmod a+x a.out 304 305 ctxswitch-goroutine_thread$(EXEEXT): 231 306 $(BENCH_V_GOC)go build -o a.out $(srcdir)/ctxswitch/goroutine.go 307 308 ctxswitch-rust_thread$(EXEEXT): 309 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/ctxswitch/rust_thrd.rs 232 310 233 311 ctxswitch-java_thread$(EXEEXT): 234 312 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java 235 @echo "#!/bin/sh" > a.out 236 @echo "java JavaThread" >> a.out 237 @chmod a+x a.out 238 239 ## ========================================================================================================= 240 mutex$(EXEEXT) :\ 241 loop.run \ 242 function.run \ 243 fetch_add.run \ 244 mutex-pthread_lock.run \ 245 mutex-upp.run \ 313 echo "#!/bin/sh" > a.out 314 echo "java JavaThread" >> a.out 315 chmod a+x a.out 316 317 ctxswitch-pthread$(EXEEXT): 318 $(BENCH_V_CC)$(COMPILE) $(srcdir)/ctxswitch/pthreads.c 319 320 ## ========================================================================================================= 321 322 mutex$(EXEEXT) : \ 246 323 mutex-cfa1.run \ 247 324 mutex-cfa2.run \ 248 325 mutex-cfa4.run \ 249 mutex-java_thread.run 250 251 mutex-pthread_lock$(EXEEXT): 252 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/pthreads.c 326 mutex-upp.run \ 327 mutex-go.run \ 328 mutex-rust.run \ 329 mutex-java.run \ 330 mutex-pthread.run 331 332 mutex-pthread$(EXEEXT): 333 $(BENCH_V_CC)$(COMPILE) $(srcdir)/mutex/pthreads.c 334 335 mutex-cfa1$(EXEEXT): 336 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/mutex/cfa1.cfa 337 338 mutex-cfa2$(EXEEXT): 339 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/mutex/cfa2.cfa 340 341 mutex-cfa4$(EXEEXT): 342 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/mutex/cfa4.cfa 253 343 254 344 mutex-upp$(EXEEXT): 255 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/upp.cc 256 257 mutex-cfa1$(EXEEXT): 258 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000 $(srcdir)/mutex/cfa1.cfa 259 260 mutex-cfa2$(EXEEXT): 261 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000 $(srcdir)/mutex/cfa2.cfa 262 263 mutex-cfa4$(EXEEXT): 264 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000 $(srcdir)/mutex/cfa4.cfa 265 266 mutex-java_thread$(EXEEXT): 345 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/mutex/upp.cc 346 347 mutex-go$(EXEEXT): 348 $(BENCH_V_GOC)go build -o a.out $(srcdir)/mutex/goroutine.go 349 350 mutex-rust$(EXEEXT): 351 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/mutex/rust.rs 352 353 mutex-java$(EXEEXT): 267 354 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java 268 @echo "#!/bin/sh" > a.out 269 @echo "java JavaThread" >> a.out 270 @chmod a+x a.out 271 272 ## ========================================================================================================= 273 signal$(EXEEXT) :\ 274 signal-pthread_cond.run \ 275 signal-upp.run \ 276 signal-cfa1.run \ 277 signal-cfa2.run \ 278 signal-cfa4.run \ 279 signal-java_thread.run 280 281 signal-pthread_cond$(EXEEXT): 282 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000 $(srcdir)/schedint/pthreads.c 283 284 signal-upp$(EXEEXT): 285 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedint/upp.cc 286 287 signal-cfa1$(EXEEXT): 288 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedint/cfa1.cfa 289 290 signal-cfa2$(EXEEXT): 291 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedint/cfa2.cfa 292 293 signal-cfa4$(EXEEXT): 294 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedint/cfa4.cfa 295 296 signal-java_thread$(EXEEXT): 355 echo "#!/bin/sh" > a.out 356 echo "java JavaThread" >> a.out 357 chmod a+x a.out 358 359 ## ========================================================================================================= 360 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): 297 386 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java 298 @echo "#!/bin/sh" > a.out 299 @echo "java JavaThread" >> a.out 300 @chmod a+x a.out 301 302 303 ## ========================================================================================================= 304 waitfor$(EXEEXT) :\ 305 waitfor-upp.run \ 306 waitfor-cfa1.run \ 307 waitfor-cfa2.run \ 308 waitfor-cfa4.run 309 310 waitfor-upp$(EXEEXT): 311 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedext/upp.cc 312 313 waitfor-cfa1$(EXEEXT): 314 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedext/cfa1.cfa 315 316 waitfor-cfa2$(EXEEXT): 317 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedext/cfa2.cfa 318 319 waitfor-cfa4$(EXEEXT): 320 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedext/cfa4.cfa 321 322 ## ========================================================================================================= 323 creation$(EXEEXT) :\ 324 creation-pthread.run \ 387 echo "#!/bin/sh" > a.out 388 echo "java JavaThread" >> a.out 389 chmod a+x a.out 390 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): 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): 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 419 ## ========================================================================================================= 420 421 creation$(EXEEXT) : \ 422 creation-cfa_generator.run \ 325 423 creation-cfa_coroutine.run \ 326 424 creation-cfa_coroutine_eager.run \ … … 328 426 creation-upp_coroutine.run \ 329 427 creation-upp_thread.run \ 330 creation-goroutine.run \ 331 creation-java_thread.run 428 creation-python_coroutine.run \ 429 creation-nodejs_coroutine.run \ 430 creation-goroutine_thread.run \ 431 creation-rust_thread.run \ 432 creation-java_thread.run \ 433 creation-pthread.run 434 435 creation-cfa_generator$(EXEEXT): 436 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_gen.cfa 332 437 333 438 creation-cfa_coroutine$(EXEEXT): 334 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000$(srcdir)/creation/cfa_cor.cfa439 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa 335 440 336 441 creation-cfa_coroutine_eager$(EXEEXT): 337 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000$(srcdir)/creation/cfa_cor.cfa -DEAGER442 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa -DEAGER 338 443 339 444 creation-cfa_thread$(EXEEXT): 340 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000$(srcdir)/creation/cfa_thrd.cfa445 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_thrd.cfa 341 446 342 447 creation-upp_coroutine$(EXEEXT): 343 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000$(srcdir)/creation/upp_cor.cc448 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/creation/upp_cor.cc 344 449 345 450 creation-upp_thread$(EXEEXT): 346 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_thrd.cc 347 348 creation-pthread$(EXEEXT): 349 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=250000 $(srcdir)/creation/pthreads.c 350 351 creation-goroutine$(EXEEXT): 451 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/creation/upp_thrd.cc 452 453 creation-python_coroutine$(EXEEXT): 454 echo "#!/bin/sh" > a.out 455 echo "python3.7 $(srcdir)/creation/python_cor.py" >> a.out 456 chmod a+x a.out 457 458 creation-nodejs_coroutine$(EXEEXT): 459 echo "#!/bin/sh" > a.out 460 echo "nodejs $(srcdir)/creation/node_cor.js" >> a.out 461 chmod a+x a.out 462 463 creation-goroutine_thread$(EXEEXT): 352 464 $(BENCH_V_GOC)go build -o a.out $(srcdir)/creation/goroutine.go 465 466 creation-rust_thread$(EXEEXT): 467 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/creation/rust_thrd.rs 353 468 354 469 creation-java_thread$(EXEEXT): 355 470 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java 356 @echo "#!/bin/sh" > a.out 357 @echo "java JavaThread" >> a.out 358 @chmod a+x a.out 359 360 ## ========================================================================================================= 361 362 compile$(EXEEXT) :\ 471 echo "#!/bin/sh" > a.out 472 echo "java JavaThread" >> a.out 473 chmod a+x a.out 474 475 creation-pthread$(EXEEXT): 476 $(BENCH_V_CC)$(COMPILE) $(srcdir)/creation/pthreads.c 477 478 ## ========================================================================================================= 479 480 compile$(EXEEXT) : \ 363 481 compile-array.make \ 364 482 compile-attributes.make \ … … 370 488 compile-typeof.make 371 489 372 373 490 testdir = $(top_srcdir)/tests 374 491 375 492 compile-array$(EXEEXT): 376 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/array.cfa493 $(CFACOMPILE) -fsyntax-only -w $(testdir)/array.cfa 377 494 378 495 compile-attributes$(EXEEXT): 379 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa496 $(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa 380 497 381 498 compile-empty$(EXEEXT): 382 @$(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.cfa499 $(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.cfa 383 500 384 501 compile-expression$(EXEEXT): 385 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.cfa502 $(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.cfa 386 503 387 504 compile-io$(EXEEXT): 388 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.cfa505 $(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.cfa 389 506 390 507 compile-monitor$(EXEEXT): 391 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.cfa508 $(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.cfa 392 509 393 510 compile-operators$(EXEEXT): 394 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.cfa511 $(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.cfa 395 512 396 513 compile-thread$(EXEEXT): 397 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.cfa514 $(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.cfa 398 515 399 516 compile-typeof$(EXEEXT): 400 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.cfa517 $(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.cfa -
benchmark/Makefile.in
raefb247 rbdfc032 93 93 EXTRA_PROGRAMS = dummy$(EXEEXT) 94 94 @WITH_LIBFIBRE_TRUE@am__append_1 = \ 95 @WITH_LIBFIBRE_TRUE@ ctxswitch-kos_fibre.run 95 @WITH_LIBFIBRE_TRUE@ ctxswitch-kos_fibre.run \ 96 96 @WITH_LIBFIBRE_TRUE@ ctxswitch-kos_fibre2.run 97 97 … … 358 358 am__v_CFA_0 = @echo " CFA " $@; 359 359 am__v_CFA_1 = 360 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@)361 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@)362 am__v_JAVAC_0 = @echo " JAVAC " $@;363 am__v_JAVAC_1 =364 AM_V_GOC = $(am__v_GOC_@AM_V@)365 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@)366 am__v_GOC_0 = @echo " GOC " $@;367 am__v_GOC_1 =368 360 UPPCC = u++ 369 361 UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS) … … 372 364 am__v_UPP_0 = @echo " UPP " $@; 373 365 am__v_UPP_1 = 366 AM_V_GOC = $(am__v_GOC_@AM_V@) 367 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@) 368 am__v_GOC_0 = @echo " GOC " $@; 369 am__v_GOC_1 = 370 AM_V_RUST = $(am__v_RUST_@AM_V@) 371 am__v_RUST_ = $(am__v_RUST_@AM_DEFAULT_V@) 372 am__v_RUST_0 = @echo " RUST " $@; 373 am__v_RUST_1 = 374 AM_V_NODEJS = $(am__v_NODEJS_@AM_V@) 375 am__v_NODEJS_ = $(am__v_NODEJS_@AM_DEFAULT_V@) 376 am__v_NODEJS_0 = @echo " NODEJS " $@; 377 am__v_NODEJS_1 = 378 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@) 379 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@) 380 am__v_JAVAC_0 = @echo " JAVAC " $@; 381 am__v_JAVAC_1 = 374 382 375 383 # applies to both programs … … 380 388 BENCH_V_CFA = $(__bench_v_CFA_$(__quiet)) 381 389 BENCH_V_CXX = $(__bench_v_CXX_$(__quiet)) 390 BENCH_V_UPP = $(__bench_v_UPP_$(__quiet)) 382 391 BENCH_V_GOC = $(__bench_v_GOC_$(__quiet)) 392 BENCH_V_RUSTC = $(__bench_v_RUSTC_$(__quiet)) 393 BENCH_V_NODEJS = $(__bench_v_NODEJS_$(__quiet)) 383 394 BENCH_V_JAVAC = $(__bench_v_JAVAC_$(__quiet)) 384 BENCH_V_UPP = $(__bench_v_UPP_$(__quiet))385 395 __quiet = verbose 386 396 __bench_v_CC_quiet = @ 387 397 __bench_v_CFA_quiet = @ 388 398 __bench_v_CXX_quiet = @ 399 __bench_v_UPP_quiet = @ 389 400 __bench_v_GOC_quiet = @ 401 __bench_v_RUSTC_quiet = @ 390 402 __bench_v_JAVAC_quiet = @ 391 __bench_v_UPP_quiet = @392 403 __bench_v_CC_verbose = $(AM_V_CC) 393 404 __bench_v_CFA_verbose = $(AM_V_CFA) 394 405 __bench_v_CXX_verbose = $(AM_V_CXX) 406 __bench_v_UPP_verbose = $(AM_V_UPP) 395 407 __bench_v_GOC_verbose = $(AM_V_GOC) 408 __bench_v_RUSTC_verbose = $(AM_V_RUSTC) 409 __bench_v_NODEJS_verbose = $(AM_V_NODEJS) 396 410 __bench_v_JAVAC_verbose = $(AM_V_JAVAC) 397 __bench_v_UPP_verbose = $(AM_V_UPP)398 411 TOOLSDIR = ${abs_top_builddir}/tools/ 399 412 REPEAT = ${abs_top_builddir}/tools/repeat 400 413 STATS = ${abs_top_srcdir}/tools/stat.py 401 414 # NEED AT LEAST 4 DATA VALUES FOR BENCHMARKS BECAUSE THE MAX AND MIN VALUES ARE REMOVED 402 repeats = 5# 31 for benchmarks415 repeats = 13 # 31 for benchmarks 403 416 arch = x64 404 417 skipcompile = no … … 406 419 PRINT_FORMAT = %20s: #Comments needed for spacing 407 420 dummy_SOURCES = dummyC.c dummyCXX.cpp 421 basic_loop_DURATION = 15000000000 422 basic_function_DURATION = 10000000000 423 basic_tls_fetch_add_DURATION = 10000000000 424 basic_DURATION = 250000000 425 ctxswitch_pthread_DURATION = 25000000 426 ctxswitch_rust_thread_DURATION = $(ctxswitch_pthread_DURATION) 427 ctxswitch_cfa_generator_DURATION = 5000000000 428 ctxswitch_nodejs_await_DURATION = 5000000 429 ctxswitch_DURATION = 100000000 430 431 #mutex_java_DURATION = 10000000 432 mutex_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 438 creation_pthread_DURATION = 250000 439 creation_rust_thread_DURATION = ${creation_pthread_DURATION} 440 creation_java_thread_DURATION = ${creation_pthread_DURATION} 441 creation_cfa_coroutine_DURATION = 100000000 442 creation_cfa_coroutine_eager_DURATION = 10000000 443 creation_upp_coroutine_DURATION = ${creation_cfa_coroutine_eager_DURATION} 444 creation_cfa_thread_DURATION = 10000000 445 creation_upp_thread_DURATION = ${creation_cfa_thread_DURATION} 446 creation_DURATION = 10000000 408 447 FIX_NEW_LINES = cat $@ | tr "\n" "\t" | sed -r 's/\t,/,/' | tr "\t" "\n" > $@ 409 CTXSWITCH_DEPEND = loop.run function.run fetch_add.run ttst_lock.run \ 410 tls-fetch_add.run ctxswitch-pthread.run \ 411 ctxswitch-cfa_generator.run ctxswitch-cfa_coroutine.run \ 412 ctxswitch-cfa_thread.run ctxswitch-cfa_thread2.run \ 413 ctxswitch-upp_coroutine.run ctxswitch-upp_thread.run \ 414 ctxswitch-goroutine.run ctxswitch-java_thread.run \ 415 $(am__append_1) 448 BASIC_DEPEND = \ 449 basic-loop.run \ 450 basic-function.run \ 451 basic-fetch_add.run \ 452 basic-ttst_lock.run \ 453 basic-tls-fetch_add.run 454 455 CTXSWITCH_DEPEND = ctxswitch-cfa_generator.run \ 456 ctxswitch-cfa_coroutine.run ctxswitch-cfa_thread.run \ 457 ctxswitch-cfa_thread2.run ctxswitch-upp_coroutine.run \ 458 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) 416 463 testdir = $(top_srcdir)/tests 417 464 all: all-am … … 732 779 733 780 dummyC.c: 734 @echo "int main() { return 0; }" > ${@}781 echo "int main() { return 0; }" > ${@} 735 782 736 783 dummyCXX.cpp: 737 @echo "int main() { return 0; }" > ${@} 738 784 echo "int main() { return 0; }" > ${@} 785 786 #.SILENT: # do not print recipe 787 .ONESHELL: # use one shell to execute recipe 739 788 .NOTPARALLEL: 740 .PHONY: compile.csv ctxswitch.csv mutex.csv signal.csv741 742 all : ctxswitch$(EXEEXT) mutex$(EXEEXT) signal$(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) 743 792 744 793 %.run : %$(EXEEXT) ${REPEAT} 745 @rm -f .result.log 746 @echo "------------------------------------------------------" 747 @echo $< 748 @${REPEAT} ${repeats} ./a.out | tee -a .result.log 749 @${STATS} .result.log 750 @echo "------------------------------------------------------" 751 @rm -f a.out .result.log *.class 794 rm -f .result.log 795 echo "------------------------------------------------------" 796 echo $< 797 ${REPEAT} ${repeats} -- ./a.out\ 798 $(if ${$(subst -,_,$(basename $@))_DURATION},\ 799 ${$(subst -,_,$(basename $@))_DURATION},\ 800 ${$(firstword $(subst -, ,$(basename $@)))_DURATION}) | tee -a .result.log 801 ${STATS} .result.log 802 echo "------------------------------------------------------" 803 rm -f a.out .result.log *.class 804 805 # ${REPEAT} ${repeats} -- /usr/bin/time -f "%Uu %Ss %Er %Mkb" ./a.out 752 806 753 807 %.runquiet : 754 @+make $(basename $@) CFLAGS="-w" __quiet=quiet755 @taskset -c 1 ./a.out756 @rm -f a.out808 +make $(basename $@) CFLAGS="-w" __quiet=quiet 809 taskset -c 1 ./a.out 810 rm -f a.out 757 811 758 812 %.make : 759 @printf "${PRINT_FORMAT}" $(basename $(subst compile-,,$@))760 @+/usr/bin/time -f ${TIME_FORMAT} make $(basename $@) 2>&1813 printf "${PRINT_FORMAT}" $(basename $(subst compile-,,$@)) 814 +/usr/bin/time -f ${TIME_FORMAT} make $(basename $@) 2>&1 761 815 762 816 ${REPEAT} : 763 @+make -C ${abs_top_builddir}/tools repeat817 +make -C ${abs_top_builddir}/tools repeat 764 818 765 819 jenkins$(EXEEXT): 766 820 @DOifskipcompile@ 767 @+make compile.csv768 @-+make compile.diff.csv821 +make compile.csv 822 -+make compile.diff.csv 769 823 @DOendif@ 770 @+make ctxswitch.csv 771 @-+make ctxswitch.diff.csv 772 @+make mutex.csv 773 @-+make mutex.diff.csv 774 @+make signal.csv 775 @-+make signal.diff.csv 824 +make basic.csv 825 -+make basic.diff.csv 826 +make ctxswitch.csv 827 -+make ctxswitch.diff.csv 828 +make mutex.csv 829 -+make mutex.diff.csv 830 +make schedint.csv 831 -+make schedint.diff.csv 776 832 @DOifskipcompile@ 777 833 cat compile.csv 778 834 -cat compile.diff.csv 779 835 @DOendif@ 836 cat basic.csv 837 -cat basic.diff.csv 780 838 cat ctxswitch.csv 781 839 -cat ctxswitch.diff.csv 782 840 cat mutex.csv 783 841 -cat mutex.diff.csv 784 cat s ignal.csv785 -cat s ignal.diff.csv842 cat schedint.csv 843 -cat schedint.diff.csv 786 844 787 845 compile.csv: 788 @echo "array,attributes,empty,expression,io,monitor,operators,typeof" > $@ 789 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-array.make >> $@ 790 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-attributes.make >> $@ 791 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-empty.make >> $@ 792 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-expression.make >> $@ 793 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-io.make >> $@ 794 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-monitor.make >> $@ 795 @+make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-operators.make >> $@ 796 @+make TIME_FORMAT='%e' PRINT_FORMAT='' compile-typeof.make >> $@ 797 @$(srcdir)/fixcsv.sh $@ 846 echo "array,attributes,empty,expression,io,monitor,operators,typeof" > $@ 847 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-array.make >> $@ 848 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-attributes.make >> $@ 849 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-empty.make >> $@ 850 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-expression.make >> $@ 851 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-io.make >> $@ 852 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-monitor.make >> $@ 853 +make TIME_FORMAT='%e,' PRINT_FORMAT='' compile-operators.make >> $@ 854 +make TIME_FORMAT='%e' PRINT_FORMAT='' compile-typeof.make >> $@ 855 $(srcdir)/fixcsv.sh $@ 856 857 basic.csv: 858 echo "generator,coroutine,thread" > $@ 859 +make basic-cfa_generator.runquiet >> $@ && echo -n ',' >> $@ 860 +make basic-cfa_coroutine.runquiet >> $@ && echo -n ',' >> $@ 861 +make basic-cfa_thread.runquiet >> $@ 862 $(srcdir)/fixcsv.sh $@ 798 863 799 864 ctxswitch.csv: 800 @echo "generator,coroutine,thread" > $@801 @+make ctxswitch-cfa_generator.runquiet >> $@ && echo -n ',' >> $@802 @+make ctxswitch-cfa_coroutine.runquiet >> $@ && echo -n ',' >> $@803 @+make ctxswitch-cfa_thread.runquiet >> $@804 @$(srcdir)/fixcsv.sh $@865 echo "generator,coroutine,thread" > $@ 866 +make ctxswitch-cfa_generator.runquiet >> $@ && echo -n ',' >> $@ 867 +make ctxswitch-cfa_coroutine.runquiet >> $@ && echo -n ',' >> $@ 868 +make ctxswitch-cfa_thread.runquiet >> $@ 869 $(srcdir)/fixcsv.sh $@ 805 870 806 871 mutex.csv: 807 @echo "1-monitor,2-monitor" > $@808 @+make mutex-cfa1.runquiet >> $@ && echo -n ',' >> $@809 @+make mutex-cfa2.runquiet >> $@810 @$(srcdir)/fixcsv.sh $@811 812 s ignal.csv:813 @echo "signal-1,signal-2,waitfor-1,waitfor-2" > $@814 @+make signal-cfa1.runquiet >> $@ && echo -n ',' >> $@815 @+make signal-cfa2.runquiet >> $@ && echo -n ',' >> $@816 @+make waitfor-cfa1.runquiet >> $@ && echo -n ',' >> $@817 @+make waitfor-cfa2.runquiet >> $@818 @$(srcdir)/fixcsv.sh $@872 echo "1-monitor,2-monitor" > $@ 873 +make mutex-cfa1.runquiet >> $@ && echo -n ',' >> $@ 874 +make mutex-cfa2.runquiet >> $@ 875 $(srcdir)/fixcsv.sh $@ 876 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 >> $@ 883 $(srcdir)/fixcsv.sh $@ 819 884 820 885 %.diff.csv: %.csv 821 @test -e $(srcdir)/baselines/$(arch)/$< || (echo "Error : Missing baseline for ${<}" && false) 822 @$(srcdir)/baselines/calc.py $(srcdir)/baselines/$(arch)/$(<) $(<) > $@ 823 824 loop$(EXEEXT): 825 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c 826 827 function$(EXEEXT): 828 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/function.c 829 830 fetch_add$(EXEEXT): 831 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000000 $(srcdir)/fetch_add.c 832 833 ttst_lock$(EXEEXT): 834 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000000 $(srcdir)/ttst_lock.c 835 836 tls-fetch_add$(EXEEXT): 837 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000000 $(srcdir)/tls-fetch_add.c 886 test -e $(srcdir)/baselines/$(arch)/$< || (echo "Error : Missing baseline for ${<}" && false) 887 $(srcdir)/baselines/calc.py $(srcdir)/baselines/$(arch)/$(<) $(<) > $@ 888 889 basic-loop$(EXEEXT): 890 $(BENCH_V_CC)$(COMPILE) $(srcdir)/basic/loop.c 891 892 basic-function$(EXEEXT): 893 $(BENCH_V_CC)$(COMPILE) $(srcdir)/basic/function.c 894 895 basic-fetch_add$(EXEEXT): 896 $(BENCH_V_CC)$(COMPILE) $(srcdir)/basic/fetch_add.c 897 898 basic-ttst_lock$(EXEEXT): 899 $(BENCH_V_CC)$(COMPILE) $(srcdir)/basic/ttst_lock.c 900 901 basic-tls-fetch_add$(EXEEXT): 902 $(BENCH_V_CC)$(COMPILE) $(srcdir)/basic/tls_fetch_add.c 903 904 basic$(EXEEXT): $(BASIC_DEPEND) 838 905 839 906 @WITH_LIBFIBRE_TRUE@ctxswitch-kos_fibre$(EXEEXT): … … 845 912 ctxswitch$(EXEEXT): $(CTXSWITCH_DEPEND) 846 913 847 ctxswitch-pthread$(EXEEXT):848 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/pthreads.c849 850 914 ctxswitch-cfa_generator$(EXEEXT): 851 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000$(srcdir)/ctxswitch/cfa_gen.cfa915 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/ctxswitch/cfa_gen.cfa 852 916 853 917 ctxswitch-cfa_coroutine$(EXEEXT): 854 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000$(srcdir)/ctxswitch/cfa_cor.cfa918 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/ctxswitch/cfa_cor.cfa 855 919 856 920 ctxswitch-cfa_thread$(EXEEXT): 857 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000$(srcdir)/ctxswitch/cfa_thrd.cfa921 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/ctxswitch/cfa_thrd.cfa 858 922 859 923 ctxswitch-cfa_thread2$(EXEEXT): 860 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000$(srcdir)/ctxswitch/cfa_thrd2.cfa924 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/ctxswitch/cfa_thrd2.cfa 861 925 862 926 ctxswitch-upp_coroutine$(EXEEXT): 863 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000$(srcdir)/ctxswitch/upp_cor.cc927 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/ctxswitch/upp_cor.cc 864 928 865 929 ctxswitch-upp_thread$(EXEEXT): 866 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc 867 868 ctxswitch-goroutine$(EXEEXT): 930 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/ctxswitch/upp_thrd.cc 931 932 ctxswitch-python_coroutine$(EXEEXT): 933 echo "#!/bin/sh" > a.out 934 echo "python3.7 $(srcdir)/ctxswitch/python_cor.py" >> a.out 935 chmod a+x a.out 936 937 ctxswitch-nodejs_coroutine$(EXEEXT): 938 echo "#!/bin/sh" > a.out 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 945 chmod a+x a.out 946 947 ctxswitch-goroutine_thread$(EXEEXT): 869 948 $(BENCH_V_GOC)go build -o a.out $(srcdir)/ctxswitch/goroutine.go 949 950 ctxswitch-rust_thread$(EXEEXT): 951 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/ctxswitch/rust_thrd.rs 870 952 871 953 ctxswitch-java_thread$(EXEEXT): 872 954 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java 873 @echo "#!/bin/sh" > a.out 874 @echo "java JavaThread" >> a.out 875 @chmod a+x a.out 876 877 mutex$(EXEEXT) :\ 878 loop.run \ 879 function.run \ 880 fetch_add.run \ 881 mutex-pthread_lock.run \ 882 mutex-upp.run \ 955 echo "#!/bin/sh" > a.out 956 echo "java JavaThread" >> a.out 957 chmod a+x a.out 958 959 ctxswitch-pthread$(EXEEXT): 960 $(BENCH_V_CC)$(COMPILE) $(srcdir)/ctxswitch/pthreads.c 961 962 mutex$(EXEEXT) : \ 883 963 mutex-cfa1.run \ 884 964 mutex-cfa2.run \ 885 965 mutex-cfa4.run \ 886 mutex-java_thread.run 887 888 mutex-pthread_lock$(EXEEXT): 889 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/pthreads.c 966 mutex-upp.run \ 967 mutex-go.run \ 968 mutex-rust.run \ 969 mutex-java.run \ 970 mutex-pthread.run 971 972 mutex-pthread$(EXEEXT): 973 $(BENCH_V_CC)$(COMPILE) $(srcdir)/mutex/pthreads.c 974 975 mutex-cfa1$(EXEEXT): 976 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/mutex/cfa1.cfa 977 978 mutex-cfa2$(EXEEXT): 979 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/mutex/cfa2.cfa 980 981 mutex-cfa4$(EXEEXT): 982 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/mutex/cfa4.cfa 890 983 891 984 mutex-upp$(EXEEXT): 892 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/upp.cc 893 894 mutex-cfa1$(EXEEXT): 895 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000 $(srcdir)/mutex/cfa1.cfa 896 897 mutex-cfa2$(EXEEXT): 898 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000 $(srcdir)/mutex/cfa2.cfa 899 900 mutex-cfa4$(EXEEXT): 901 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000 $(srcdir)/mutex/cfa4.cfa 902 903 mutex-java_thread$(EXEEXT): 985 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/mutex/upp.cc 986 987 mutex-go$(EXEEXT): 988 $(BENCH_V_GOC)go build -o a.out $(srcdir)/mutex/goroutine.go 989 990 mutex-rust$(EXEEXT): 991 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/mutex/rust.rs 992 993 mutex-java$(EXEEXT): 904 994 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java 905 @echo "#!/bin/sh" > a.out 906 @echo "java JavaThread" >> a.out 907 @chmod a+x a.out 908 909 signal$(EXEEXT) :\ 910 signal-pthread_cond.run \ 911 signal-upp.run \ 912 signal-cfa1.run \ 913 signal-cfa2.run \ 914 signal-cfa4.run \ 915 signal-java_thread.run 916 917 signal-pthread_cond$(EXEEXT): 918 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000 $(srcdir)/schedint/pthreads.c 919 920 signal-upp$(EXEEXT): 921 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedint/upp.cc 922 923 signal-cfa1$(EXEEXT): 924 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedint/cfa1.cfa 925 926 signal-cfa2$(EXEEXT): 927 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedint/cfa2.cfa 928 929 signal-cfa4$(EXEEXT): 930 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedint/cfa4.cfa 931 932 signal-java_thread$(EXEEXT): 995 echo "#!/bin/sh" > a.out 996 echo "java JavaThread" >> a.out 997 chmod a+x a.out 998 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): 1018 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/schedint/upp.cc 1019 1020 schedint-rust$(EXEEXT): 1021 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/schedint/rust.rs 1022 1023 schedint-java$(EXEEXT): 933 1024 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java 934 @echo "#!/bin/sh" > a.out 935 @echo "java JavaThread" >> a.out 936 @chmod a+x a.out 937 938 waitfor$(EXEEXT) :\ 939 waitfor-upp.run \ 940 waitfor-cfa1.run \ 941 waitfor-cfa2.run \ 942 waitfor-cfa4.run 943 944 waitfor-upp$(EXEEXT): 945 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedext/upp.cc 946 947 waitfor-cfa1$(EXEEXT): 948 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedext/cfa1.cfa 949 950 waitfor-cfa2$(EXEEXT): 951 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedext/cfa2.cfa 952 953 waitfor-cfa4$(EXEEXT): 954 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000 $(srcdir)/schedext/cfa4.cfa 955 956 creation$(EXEEXT) :\ 957 creation-pthread.run \ 1025 echo "#!/bin/sh" > a.out 1026 echo "java JavaThread" >> a.out 1027 chmod a+x a.out 1028 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): 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 1054 creation$(EXEEXT) : \ 1055 creation-cfa_generator.run \ 958 1056 creation-cfa_coroutine.run \ 959 1057 creation-cfa_coroutine_eager.run \ … … 961 1059 creation-upp_coroutine.run \ 962 1060 creation-upp_thread.run \ 963 creation-goroutine.run \ 964 creation-java_thread.run 1061 creation-python_coroutine.run \ 1062 creation-nodejs_coroutine.run \ 1063 creation-goroutine_thread.run \ 1064 creation-rust_thread.run \ 1065 creation-java_thread.run \ 1066 creation-pthread.run 1067 1068 creation-cfa_generator$(EXEEXT): 1069 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_gen.cfa 965 1070 966 1071 creation-cfa_coroutine$(EXEEXT): 967 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000$(srcdir)/creation/cfa_cor.cfa1072 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa 968 1073 969 1074 creation-cfa_coroutine_eager$(EXEEXT): 970 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000$(srcdir)/creation/cfa_cor.cfa -DEAGER1075 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_cor.cfa -DEAGER 971 1076 972 1077 creation-cfa_thread$(EXEEXT): 973 $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000$(srcdir)/creation/cfa_thrd.cfa1078 $(BENCH_V_CFA)$(CFACOMPILE) $(srcdir)/creation/cfa_thrd.cfa 974 1079 975 1080 creation-upp_coroutine$(EXEEXT): 976 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000$(srcdir)/creation/upp_cor.cc1081 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/creation/upp_cor.cc 977 1082 978 1083 creation-upp_thread$(EXEEXT): 979 $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_thrd.cc 980 981 creation-pthread$(EXEEXT): 982 $(BENCH_V_CC)$(COMPILE) -DBENCH_N=250000 $(srcdir)/creation/pthreads.c 983 984 creation-goroutine$(EXEEXT): 1084 $(BENCH_V_UPP)$(UPPCOMPILE) $(srcdir)/creation/upp_thrd.cc 1085 1086 creation-python_coroutine$(EXEEXT): 1087 echo "#!/bin/sh" > a.out 1088 echo "python3.7 $(srcdir)/creation/python_cor.py" >> a.out 1089 chmod a+x a.out 1090 1091 creation-nodejs_coroutine$(EXEEXT): 1092 echo "#!/bin/sh" > a.out 1093 echo "nodejs $(srcdir)/creation/node_cor.js" >> a.out 1094 chmod a+x a.out 1095 1096 creation-goroutine_thread$(EXEEXT): 985 1097 $(BENCH_V_GOC)go build -o a.out $(srcdir)/creation/goroutine.go 1098 1099 creation-rust_thread$(EXEEXT): 1100 $(BENCH_V_RUSTC)rustc -C opt-level=3 -o a.out $(srcdir)/creation/rust_thrd.rs 986 1101 987 1102 creation-java_thread$(EXEEXT): 988 1103 $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java 989 @echo "#!/bin/sh" > a.out 990 @echo "java JavaThread" >> a.out 991 @chmod a+x a.out 992 993 compile$(EXEEXT) :\ 1104 echo "#!/bin/sh" > a.out 1105 echo "java JavaThread" >> a.out 1106 chmod a+x a.out 1107 1108 creation-pthread$(EXEEXT): 1109 $(BENCH_V_CC)$(COMPILE) $(srcdir)/creation/pthreads.c 1110 1111 compile$(EXEEXT) : \ 994 1112 compile-array.make \ 995 1113 compile-attributes.make \ … … 1002 1120 1003 1121 compile-array$(EXEEXT): 1004 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/array.cfa1122 $(CFACOMPILE) -fsyntax-only -w $(testdir)/array.cfa 1005 1123 1006 1124 compile-attributes$(EXEEXT): 1007 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa1125 $(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa 1008 1126 1009 1127 compile-empty$(EXEEXT): 1010 @$(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.cfa1128 $(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.cfa 1011 1129 1012 1130 compile-expression$(EXEEXT): 1013 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.cfa1131 $(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.cfa 1014 1132 1015 1133 compile-io$(EXEEXT): 1016 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.cfa1134 $(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.cfa 1017 1135 1018 1136 compile-monitor$(EXEEXT): 1019 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.cfa1137 $(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.cfa 1020 1138 1021 1139 compile-operators$(EXEEXT): 1022 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.cfa1140 $(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.cfa 1023 1141 1024 1142 compile-thread$(EXEEXT): 1025 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.cfa1143 $(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.cfa 1026 1144 1027 1145 compile-typeof$(EXEEXT): 1028 @$(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.cfa1146 $(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.cfa 1029 1147 1030 1148 # Tell versions [3.59,3.63) of GNU make to not export all variables. -
benchmark/bench.h
raefb247 rbdfc032 5 5 #endif 6 6 #include <stdlib.h> 7 #include <unistd.h> // sysconf 7 #include <stdint.h> // uint64_t 8 #include <unistd.h> // sysconf 8 9 #if ! defined(__cforall) 9 10 #include <time.h> … … 15 16 16 17 17 static inline unsigned long long int bench_time() { 18 struct timespec ts; 19 clock_gettime( 20 #if defined( __linux__ ) 21 CLOCK_THREAD_CPUTIME_ID, 22 #elif defined( __freebsd__ ) 23 CLOCK_PROF, 24 #elif defined( __solaris__ ) 25 CLOCK_HIGHRES, 26 #else 27 #error uC++ : internal error, unsupported architecture 28 #endif 29 &ts ); 30 return 1000000000LL * ts.tv_sec + ts.tv_nsec; 31 } // Time 18 static inline uint64_t bench_time() { 19 struct timespec ts; 20 clock_gettime( CLOCK_THREAD_CPUTIME_ID, &ts ); 21 return 1000000000LL * ts.tv_sec + ts.tv_nsec; 22 } // bench_time 32 23 33 24 #ifndef BENCH_N 34 #define BENCH_N 500 //1000000025 #define BENCH_N 10000000 35 26 #endif 36 27 28 size_t times = BENCH_N; 29 30 #define BENCH_START() \ 31 if ( argc > 2 ) exit( EXIT_FAILURE ); \ 32 if ( argc == 2 ) { \ 33 times = atoi( argv[1] ); \ 34 } 35 37 36 #define BENCH(statement, output) \ 38 size_t n = BENCH_N; \ 39 if( argc > 2 ) return 1; \ 40 if( argc == 2 ) { \ 41 n = atoi(argv[1]); \ 42 } \ 43 long long int StartTime, EndTime; \ 37 uint64_t StartTime, EndTime; \ 44 38 StartTime = bench_time(); \ 45 statement; 39 statement; \ 46 40 EndTime = bench_time(); \ 47 double output = \48 (double)( EndTime - StartTime ) / n; 41 double output = (double)( EndTime - StartTime ) / times; 42 49 43 50 44 #if defined(__cforall) … … 53 47 } 54 48 #endif 49 #if defined(__U_CPLUSPLUS__) 50 unsigned int uDefaultPreemption() { 51 return 0; 52 } 53 #endif -
benchmark/creation/JavaThread.java
raefb247 rbdfc032 26 26 static int x = 2; 27 27 28 static private final int NoOfTimes = Integer.parseInt("10000") ;28 static private int times = Integer.parseInt("10000") ; 29 29 30 30 public static class MyThread extends Thread { … … 33 33 } 34 34 public static void helper() throws InterruptedException { 35 for(int i = 1; i <= NoOfTimes; i += 1) {35 for(int i = 1; i <= times; i += 1) { 36 36 MyThread m = new MyThread(); 37 37 x = nextRandom( x ); … … 44 44 helper(); 45 45 long end = System.nanoTime(); 46 System.out.println( (end - start) / NoOfTimes );46 System.out.println( (end - start) / times ); 47 47 } 48 48 public static void main(String[] args) throws InterruptedException { 49 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 49 if ( args.length > 2 ) System.exit( 1 ); 50 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); } 51 52 for (int i = Integer.parseInt("5"); --i >= 0 ; ) { 50 53 InnerMain(); 51 Thread.sleep(2000); 54 Thread.sleep(2000); // 2 seconds 52 55 x = nextRandom(x); 53 56 } … … 55 58 } 56 59 } 60 61 // Local Variables: // 62 // tab-width: 4 // 63 // End: // -
benchmark/creation/cfa_cor.cfa
raefb247 rbdfc032 5 5 6 6 coroutine MyCoroutine {}; 7 void ?{} (MyCoroutine & this) {7 void ?{}( MyCoroutine & this ) { 8 8 #ifdef EAGER 9 resume( this);9 resume( this ); 10 10 #endif 11 11 } 12 void main( MyCoroutine &) {}12 void main( MyCoroutine & ) {} 13 13 14 int main(int argc, char* argv[]) { 14 int main( int argc, char * argv[] ) { 15 BENCH_START() 15 16 BENCH( 16 for ( i; n) {17 MyCoroutine m;17 for ( times ) { 18 MyCoroutine c; 18 19 }, 19 20 result 20 21 ) 22 printf( "%g\n", result ); 23 } 21 24 22 printf("%g\n", result); 23 } 25 // Local Variables: // 26 // tab-width: 4 // 27 // End: // -
benchmark/creation/cfa_thrd.cfa
raefb247 rbdfc032 7 7 void main(MyThread &) {} 8 8 9 int main(int argc, char* argv[]) { 9 int main( int argc, char * argv[] ) { 10 BENCH_START() 10 11 BENCH( 11 for ( i; n) {12 for ( times ) { 12 13 MyThread m; 13 14 }, 14 15 result 15 16 ) 17 printf( "%g\n", result ); 18 } 16 19 17 printf("%g\n", result); 18 } 20 // Local Variables: // 21 // tab-width: 4 // 22 // End: // -
benchmark/creation/goroutine.go
raefb247 rbdfc032 2 2 3 3 import ( 4 "fmt" 5 "time" 4 "fmt" 5 "time" 6 "os" 7 "strconv" 6 8 ) 7 9 … … 17 19 18 20 func main() { 19 const NoOfTimes = 500000 21 var times int = 10000000 22 if len( os.Args ) > 2 { os.Exit( 1 ) } 23 if len( os.Args ) == 2 { times, _ = strconv.Atoi(os.Args[1]) } 24 20 25 start := time.Now() 21 for i := 1; i <= NoOfTimes; i += 1 {26 for i := 1; i <= times; i += 1 { 22 27 go noop() // creation 28 <- shake // wait for completion 23 29 } 24 30 end := time.Now() 25 fmt.Printf("%d\n", end.Sub(start) / time.Duration(NoOfTimes)) 26 <- shake 31 fmt.Printf( "%d\n", end.Sub(start) / time.Duration(times) ) 27 32 } 33 34 // Local Variables: // 35 // tab-width: 4 // 36 // End: // -
benchmark/creation/pthreads.c
raefb247 rbdfc032 4 4 #include "bench.h" 5 5 6 static void * foo(void *arg) {6 static void * foo(void *arg) { 7 7 return arg; 8 8 } 9 9 10 int main(int argc, char* argv[]) { 10 int main( int argc, char * argv[] ) { 11 BENCH_START() 11 12 BENCH( 12 for (size_t i = 0; i < n; i++) {13 for (size_t i = 0; i < times; i++) { 13 14 pthread_t thread; 14 15 if (pthread_create(&thread, NULL, foo, NULL) < 0) { … … 16 17 return 1; 17 18 } 18 19 19 if (pthread_join( thread, NULL) < 0) { 20 20 perror( "failure" ); … … 24 24 result 25 25 ) 26 printf( "%g\n", result ); 27 } 26 28 27 printf("%g\n", result); 28 } 29 // Local Variables: // 30 // tab-width: 4 // 31 // End: // -
benchmark/creation/upp_cor.cc
raefb247 rbdfc032 5 5 _Coroutine MyCor { 6 6 void main() {} 7 public: 8 MyCor() { resume(); } 7 9 }; 8 10 9 int main(int argc, char* argv[]) { 11 int main( int argc, char * argv[] ) { 12 BENCH_START() 10 13 BENCH( 11 for (size_t i = 0; i < n; i++) {14 for (size_t i = 0; i < times; i++) { 12 15 MyCor m; 13 16 }, 14 17 result 15 18 ) 19 printf( "%g\n", result ); 20 } 16 21 17 printf("%g\n", result); 18 } 22 // Local Variables: // 23 // tab-width: 4 // 24 // End: // -
benchmark/creation/upp_thrd.cc
raefb247 rbdfc032 7 7 }; 8 8 9 int main(int argc, char* argv[]) { 9 int main( int argc, char * argv[] ) { 10 BENCH_START() 10 11 BENCH( 11 for (size_t i = 0; i < n; i++) {12 for (size_t i = 0; i < times; i++) { 12 13 MyThread m; 13 14 }, 14 15 result 15 16 ) 17 printf( "%g\n", result ); 18 } 16 19 17 printf("%g\n", result); 18 } 20 // Local Variables: // 21 // tab-width: 4 // 22 // End: // -
benchmark/ctxswitch/JavaThread.java
raefb247 rbdfc032 26 26 static int x = 2; 27 27 28 static private final int NoOfTimes = Integer.parseInt("1000000");28 static private int times = Integer.parseInt("100000"); 29 29 30 30 public static void helper() { 31 for(int i = 1; i <= NoOfTimes; i += 1) {31 for(int i = 1; i <= times; i += 1) { 32 32 Thread.yield(); 33 33 } … … 37 37 helper(); 38 38 long end = System.nanoTime(); 39 System.out.println( (end - start) / NoOfTimes );39 System.out.println( (end - start) / times ); 40 40 } 41 41 public static void main(String[] args) throws InterruptedException { 42 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 42 if ( args.length > 2 ) System.exit( 1 ); 43 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); } 44 45 for (int i = Integer.parseInt("5"); --i >= 0 ; ) { 43 46 InnerMain(); 44 Thread.sleep(2000); 47 Thread.sleep(2000); // 2 seconds 45 48 x = nextRandom(x); 46 49 } … … 48 51 } 49 52 } 53 54 // Local Variables: // 55 // tab-width: 4 // 56 // End: // -
benchmark/ctxswitch/cfa_cor.cfa
raefb247 rbdfc032 4 4 #include "bench.h" 5 5 6 coroutine GreatSuspender {}; 7 8 void ?{}( GreatSuspender & this ) { 9 prime(this); 10 } 11 12 void main( __attribute__((unused)) GreatSuspender & this ) { 13 while( true ) { 6 coroutine C {} c; 7 void main( __attribute__((unused)) C & ) { 8 while () { 14 9 suspend(); 15 10 } 16 11 } 17 18 int main(int argc, char* argv[]) { 19 GreatSuspender s; 20 12 int main( int argc, char * argv[] ) { 13 BENCH_START() 21 14 BENCH( 22 for ( i; n) {23 resume( s);15 for ( times ) { 16 resume( c ); 24 17 }, 25 18 result 26 19 ) 20 printf( "%g\n", result ); 21 } 27 22 28 printf("%g\n", result); 29 } 23 // Local Variables: // 24 // tab-width: 4 // 25 // End: // -
benchmark/ctxswitch/cfa_cor_then.cfa
raefb247 rbdfc032 6 6 void noOp(void) {} 7 7 8 coroutine GreatSuspender {};8 coroutine C {} c; 9 9 10 void ?{}( GreatSuspender& this ) {10 void ?{}( C & this ) { 11 11 prime(this); 12 12 } 13 13 14 void main( __attribute__((unused)) GreatSuspender& this ) {15 while ( true) {14 void main( __attribute__((unused)) C & this ) { 15 while () { 16 16 suspend_then(noOp); 17 17 } 18 18 } 19 19 20 int main(int argc, char* argv[]) { 21 GreatSuspender s; 22 20 int main( int argc, char * argv[] ) { 21 BENCH_START() 23 22 BENCH( 24 for ( i; n) {25 resume( s);23 for ( times ) { 24 resume( c ); 26 25 }, 27 26 result 28 27 ) 28 printf( "%g\n", result ); 29 } 29 30 30 printf("%g\n", result); 31 } 31 // Local Variables: // 32 // tab-width: 4 // 33 // End: // -
benchmark/ctxswitch/cfa_gen.cfa
raefb247 rbdfc032 3 3 typedef struct { 4 4 void * next; 5 } GreatSuspender;5 } C; 6 6 7 void comain( GreatSuspender * this) {8 if ( __builtin_expect(this->next != 0, 1) ) goto *(this->next);9 this->next = &&s1;7 void comain( C * c ) { 8 if ( __builtin_expect(c->next != 0, 1) ) goto *(c->next); 9 c->next = &&s1; 10 10 for () { 11 11 return; 12 12 s1: ; 13 13 } 14 14 } 15 15 16 int main( int argc, char* argv[]) {17 GreatSuspender s = { 0 }; 18 16 int main( int argc, char * argv[] ) { 17 BENCH_START() 18 C c = { 0 }; 19 19 BENCH( 20 for ( i; n) {21 comain( & s);20 for ( times ) { 21 comain( &c ); 22 22 }, 23 23 result 24 24 ) 25 printf( "%g\n", result ); 26 } 25 27 26 printf("%g\n", result); 27 } 28 // Local Variables: // 29 // tab-width: 4 // 30 // End: // -
benchmark/ctxswitch/cfa_thrd.cfa
raefb247 rbdfc032 3 3 #include "bench.h" 4 4 5 int main(int argc, char* argv[]) { 5 int main( int argc, char * argv[] ) { 6 BENCH_START() 6 7 BENCH( 7 for ( i; n) {8 for ( times ) { 8 9 yield(); 9 10 }, 10 11 result 11 12 ) 13 printf( "%g\n", result ); 14 } 12 15 13 printf("%g\n", result); 14 } 16 // Local Variables: // 17 // tab-width: 4 // 18 // End: // -
benchmark/ctxswitch/cfa_thrd2.cfa
raefb247 rbdfc032 8 8 9 9 void main(__attribute__((unused)) Fibre & this) { 10 while (!done) {10 while ( ! done ) { 11 11 yield(); 12 12 } 13 13 } 14 14 15 int main(int argc, char* argv[]) { 15 int main( int argc, char * argv[] ) { 16 BENCH_START() 16 17 Fibre f1; 17 18 BENCH( 18 for ( i; n) {19 for ( times ) { 19 20 yield(); 20 21 }, 21 22 result 22 23 ) 24 printf( "%g\n", result ); 25 done = true; 26 } 23 27 24 printf("%g\n", result); 25 done = true; 26 return 0; 27 } 28 // Local Variables: // 29 // tab-width: 4 // 30 // End: // -
benchmark/ctxswitch/goroutine.go
raefb247 rbdfc032 2 2 3 3 import ( 4 "fmt" 5 "runtime" 6 "time" 4 "fmt" 5 "time" 6 "os" 7 "strconv" 8 "runtime" 7 9 ) 8 10 … … 28 30 29 31 func main() { 30 const NoOfTimes = 10000000 31 go ContextSwitch( NoOfTimes ) // context switch 32 var times int = 10000000 33 if len( os.Args ) > 2 { os.Exit( 1 ) } 34 if len( os.Args ) == 2 { times, _ = strconv.Atoi(os.Args[1]) } 35 go ContextSwitch( times ) // context switch 32 36 <- shake 33 37 } 38 39 // Local Variables: // 40 // tab-width: 4 // 41 // End: // -
benchmark/ctxswitch/kos_fibre.cpp
raefb247 rbdfc032 3 3 #include "bench.h" 4 4 5 int main(int argc, char* argv[]) { 5 int main( int argc, char * argv[] ) { 6 BENCH_START() 6 7 BENCH( 7 for (size_t i = 0; i < n; i++) {8 for (size_t i = 0; i < times; i++) { 8 9 Fibre::yield(); 9 10 }, 10 11 result 11 12 ) 12 printf("%g\n", result); 13 return 0; 13 printf( "%g\n", result ); 14 14 } 15 16 // Local Variables: // 17 // tab-width: 4 // 18 // End: // -
benchmark/ctxswitch/kos_fibre2.cpp
raefb247 rbdfc032 11 11 } 12 12 13 int main(int argc, char* argv[]) { 13 int main( int argc, char * argv[] ) { 14 BENCH_START() 14 15 Fibre* f1 = (new Fibre)->run(f1main); 15 16 BENCH( 16 for (size_t i = 0; i < n; i++) {17 for (size_t i = 0; i < times; i++) { 17 18 Fibre::yield(); 18 19 }, 19 20 result 20 21 ) 21 printf( "%g\n", result);22 printf( "%g\n", result ); 22 23 done = true; 23 24 Fibre::yield(); 24 25 f1->join(); 25 return 0;26 26 } 27 28 // Local Variables: // 29 // tab-width: 4 // 30 // End: // -
benchmark/ctxswitch/pthreads.c
raefb247 rbdfc032 6 6 #include "bench.h" 7 7 8 int main(int argc, char* argv[]) { 8 int main( int argc, char * argv[] ) { 9 BENCH_START() 9 10 BENCH( 10 for (size_t i = 0; i < n; i++) {11 for (size_t i = 0; i < times; i++) { 11 12 sched_yield(); 12 13 }, 13 14 result 14 15 ) 15 16 printf("%g\n", result); 16 printf( "%g\n", result ); 17 17 } -
benchmark/ctxswitch/upp_cor.cc
raefb247 rbdfc032 3 3 #include "bench.h" 4 4 5 _Coroutine GreatSuspender { 6 public: 7 GreatSuspender() { 8 resume(); 9 } 10 11 void do_resume() { 12 resume(); 13 } 14 private: 5 _Coroutine C { 15 6 void main() { 16 7 while( true ) { … … 18 9 } 19 10 } 20 }; 21 22 int main(int argc, char* argv[]) { 23 GreatSuspender s; 24 11 public: 12 void do_resume() { 13 resume(); 14 } 15 } c; 16 int main( int argc, char * argv[] ) { 17 BENCH_START() 25 18 BENCH( 26 for (size_t i = 0; i < n; i++) {27 s.do_resume();19 for (size_t i = 0; i < times; i++) { 20 c.do_resume(); 28 21 }, 29 22 result 30 23 ) 24 printf( "%g\n", result ); 25 } 31 26 32 printf("%g\n", result); 33 } 27 // Local Variables: // 28 // tab-width: 4 // 29 // End: // -
benchmark/ctxswitch/upp_thrd.cc
raefb247 rbdfc032 3 3 #include "bench.h" 4 4 5 int main(int argc, char* argv[]) { 5 int main( int argc, char * argv[] ) { 6 BENCH_START() 6 7 BENCH( 7 for (size_t i = 0; i < n; i++) {8 for (size_t i = 0; i < times; i++) { 8 9 uThisTask().yield(); 9 10 }, 10 11 result 11 12 ) 13 printf( "%g\n", result ); 14 } 12 15 13 printf("%g\n", result); 14 } 16 // Local Variables: // 17 // tab-width: 4 // 18 // End: // -
benchmark/mutex/JavaThread.java
raefb247 rbdfc032 26 26 static int x = 2; 27 27 28 static private final int NoOfTimes = Integer.parseInt("100000000");28 static private int times = Integer.parseInt("100000000"); 29 29 30 30 public synchronized void noop() { … … 35 35 // Inhibit biased locking ... 36 36 x = (j.hashCode() ^ System.identityHashCode(j)) | 1 ; 37 for(int i = 1; i <= NoOfTimes; i += 1) {37 for(int i = 1; i <= times; i += 1) { 38 38 x = nextRandom(x); 39 39 j.noop(); … … 44 44 helper(); 45 45 long end = System.nanoTime(); 46 System.out.println( (end - start) / NoOfTimes );46 System.out.println( (end - start) / times ); 47 47 } 48 48 public static void main(String[] args) throws InterruptedException { 49 if ( args.length > 2 ) System.exit( 1 ); 50 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); } 51 49 52 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 50 53 InnerMain(); … … 55 58 } 56 59 } 60 61 // Local Variables: // 62 // tab-width: 4 // 63 // End: // -
benchmark/mutex/cfa1.cfa
raefb247 rbdfc032 4 4 #include "bench.h" 5 5 6 monitor M {} ;7 void __attribute__((noinline)) call( M & mutex m) {}6 monitor M {} m1; 7 void __attribute__((noinline)) call( M & mutex p1 ) {} 8 8 9 int main( int argc, char* argv[]) {10 M m;9 int main( int argc, char * argv[] ) { 10 BENCH_START() 11 11 BENCH( 12 for ( i; n) {13 call( m);12 for ( times ) { 13 call( m1 ); 14 14 }, 15 15 result 16 16 ) 17 printf( "%g\n", result ); 18 } 17 19 18 printf("%g\n", result); 19 } 20 // Local Variables: // 21 // tab-width: 4 // 22 // End: // -
benchmark/mutex/cfa2.cfa
raefb247 rbdfc032 4 4 #include "bench.h" 5 5 6 monitor M {}; 7 void __attribute__((noinline)) call( M & mutex m1, M & mutex m2 ) {} 6 monitor M {} m1, m2; 8 7 9 int main(int argc, char* argv[]) { 10 M m1, m2; 8 void __attribute__((noinline)) call( M & mutex p1, M & mutex p2 ) {} 9 10 int main( int argc, char * argv[] ) { 11 BENCH_START() 11 12 BENCH( 12 for ( i; n) {13 call( m1, m2);13 for ( times ) { 14 call( m1, m2 ); 14 15 }, 15 16 result 16 17 ) 18 printf( "%g\n", result ); 19 } 17 20 18 printf("%g\n", result); 19 } 21 // Local Variables: // 22 // tab-width: 4 // 23 // End: // -
benchmark/mutex/cfa4.cfa
raefb247 rbdfc032 5 5 6 6 7 monitor M {} ;8 void __attribute__((noinline)) call( M & mutex m1, M & mutex m2, M & mutex m3, M & mutex m4 ) {}7 monitor M {} m1, m2, m3, m4; 8 void __attribute__((noinline)) call( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {} 9 9 10 int main( int argc, char* argv[]) {11 M m1, m2, m3, m4;10 int main( int argc, char * argv[] ) { 11 BENCH_START() 12 12 BENCH( 13 for ( i; n) {14 call( m1, m2, m3, m4);13 for ( times ) { 14 call( m1, m2, m3, m4 ); 15 15 }, 16 16 result 17 17 ) 18 printf( "%g\n", result ); 19 } 18 20 19 printf("%g\n", result); 20 } 21 // Local Variables: // 22 // tab-width: 4 // 23 // End: // -
benchmark/mutex/pthreads.c
raefb247 rbdfc032 7 7 8 8 void __attribute__((noinline)) call() { 9 pthread_mutex_lock (&mutex);10 pthread_mutex_unlock( &mutex);9 pthread_mutex_lock( &mutex ); 10 pthread_mutex_unlock( &mutex ); 11 11 } 12 13 int main(int argc, char* argv[]) { 12 int main( int argc, char * argv[] ) { 13 BENCH_START() 14 14 BENCH( 15 for ( size_t i = 0; i < n; i++) {15 for ( size_t i = 0; i < times; i++ ) { 16 16 call(); 17 17 }, 18 18 result 19 19 ) 20 printf( "%g\n", result ); 21 } 20 22 21 printf("%g\n", result); 22 } 23 // Local Variables: // 24 // tab-width: 4 // 25 // End: // -
benchmark/mutex/upp.cc
raefb247 rbdfc032 8 8 }; 9 9 10 int main(int argc, char* argv[]) { 10 int main( int argc, char * argv[] ) { 11 BENCH_START() 11 12 MyMonitor m; 12 13 BENCH( 13 for ( size_t i = 0; i < n; i++) {14 for ( size_t i = 0; i < times; i++ ) { 14 15 m.call(); 15 16 }, 16 17 result 17 18 ) 19 printf( "%g\n", result ); 20 } 18 21 19 printf("%g\n", result); 20 } 22 // Local Variables: // 23 // tab-width: 4 // 24 // End: // -
benchmark/schedext/cfa1.cfa
raefb247 rbdfc032 4 4 #include <stdio.h> 5 5 6 #include " bench.h"6 #include "../bench.h" 7 7 8 int argc; 9 char** argv; 10 volatile int go = 0; 8 monitor M {} m1; 11 9 12 monitor M {}; 13 M m1; 14 15 void __attribute__((noinline)) call( M & mutex a1 ) {} 16 17 int __attribute__((noinline)) wait( M & mutex a1 ) { 18 go = 1; 19 BENCH( 20 for ( i; n ) { 21 waitfor(call, a1); 22 }, 23 result 24 ) 25 26 printf("%g\n", result); 27 go = 0; 28 return 0; 10 void __attribute__((noinline)) call( M & mutex p1 ) {} 11 void __attribute__((noinline)) wait( M & mutex p1 ) { 12 for ( times ) { 13 waitfor( call : p1 ); 14 } 29 15 } 30 16 31 17 thread T {}; 32 void ^?{}( T & mutex this ) {}33 18 void main( T & ) { 34 while(go == 0) { yield(); } 35 while(go == 1) { call(m1); } 36 19 BENCH( 20 for ( times ) { call( m1 ); }, 21 result 22 ) 23 printf( "%g\n", result ); 37 24 } 38 25 39 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 26 int main( int argc, char * argv[] ) { 27 BENCH_START() 40 28 T t; 41 return wait(m1);29 wait( m1 ); 42 30 } 31 32 // Local Variables: // 33 // tab-width: 4 // 34 // End: // -
benchmark/schedext/cfa2.cfa
raefb247 rbdfc032 4 4 #include <stdio.h> 5 5 6 #include " bench.h"6 #include "../bench.h" 7 7 8 int argc; 9 char** argv; 10 volatile int go = 0; 8 monitor M {} m1, m2; 11 9 12 monitor M {}; 13 M m1, m2; 14 15 void __attribute__((noinline)) call( M & mutex a1, M & mutex a2 ) {} 16 17 int __attribute__((noinline)) wait( M & mutex a1, M & mutex a2 ) { 18 go = 1; 10 void __attribute__((noinline)) call( M & mutex p1, M & mutex p2 ) {} 11 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2 ) { 12 for ( times ) { 13 waitfor( call : p1, p2 ); 14 } 15 } 16 thread T {}; 17 void main( T & ) { 19 18 BENCH( 20 for ( i; n) {21 waitfor(call, a1, a2);19 for ( times ) { 20 call( m1, m2 ); 22 21 }, 23 22 result 24 23 ) 25 26 printf("%g\n", result); 27 go = 0; 28 return 0; 24 printf( "%g\n", result ); 29 25 } 30 26 31 thread T {}; 32 void ^?{}( T & mutex this ) {} 33 void main( T & ) { 34 while(go == 0) { yield(); } 35 while(go == 1) { call(m1, m2); } 36 27 int main( int argc, char * argv[] ) { 28 BENCH_START() 29 T t; 30 wait( m1, m2 ); 37 31 } 38 32 39 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 40 T t; 41 return wait(m1, m2); 42 } 33 // Local Variables: // 34 // tab-width: 4 // 35 // End: // -
benchmark/schedext/cfa4.cfa
raefb247 rbdfc032 4 4 #include <stdio.h> 5 5 6 #include " bench.h"6 #include "../bench.h" 7 7 8 int argc; 9 char** argv; 10 volatile int go = 0; 8 monitor M {} m1, m2, m3, m4; 11 9 12 monitor M {}; 13 M m1, m2, m3, m4; 14 15 void __attribute__((noinline)) call( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) {} 16 17 int __attribute__((noinline)) wait( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) { 18 go = 1; 10 void __attribute__((noinline)) call( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) {} 11 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) { 12 for ( times ) { 13 waitfor( call : p1, p2, p3, p4 ); 14 } 15 } 16 thread T {}; 17 void main( T & ) { 19 18 BENCH( 20 for ( i; n) {21 waitfor(call, a1, a2, a3, a4);19 for ( times ) { 20 call( m1, m2, m3, m4 ); 22 21 }, 23 22 result 24 23 ) 25 26 printf("%g\n", result); 27 go = 0; 28 return 0; 24 printf( "%g\n", result ); 29 25 } 30 26 31 thread T {}; 32 void ^?{}( T & mutex this ) {} 33 void main( T & ) { 34 while(go == 0) { yield(); } 35 while(go == 1) { call(m1, m2, m3, m4); } 36 27 int main( int argc, char * argv[] ) { 28 BENCH_START() 29 T t; 30 wait( m1, m2, m3, m4 ); 37 31 } 38 32 39 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 40 T t; 41 return wait(m1, m2, m3, m4); 42 } 33 // Local Variables: // 34 // tab-width: 4 // 35 // End: // -
benchmark/schedext/upp.cc
raefb247 rbdfc032 3 3 #include "bench.h" 4 4 5 int argc;6 char** argv;7 volatile int go = 0;8 9 5 _Monitor M { 10 6 public: 11 7 void __attribute__((noinline)) call() {} 8 void __attribute__((noinline)) wait() { 9 for ( size_t i = 0; i < times; i++ ) { 10 _Accept(call); 11 } 12 } 13 } m; 12 14 13 int __attribute__((noinline)) wait(){14 go = 1;15 _Task T { 16 void main() { 15 17 BENCH( 16 for ( size_t i = 0; i < n; i++) {17 _Accept(call);18 for ( size_t i = 0; i < times; i++ ) { 19 m.call(); 18 20 }, 19 21 result 20 22 ) 21 22 printf("%g\n", result); 23 go = 0; 24 return 0; 23 printf( "%g\n", result ); 25 24 } 26 25 }; 27 26 28 M m; 27 int main( int argc, char * argv[] ) { 28 BENCH_START() 29 T t; 30 m.wait(); 31 } 29 32 30 _Task T { 31 void main() { 32 while(go == 0) { yield(); } 33 while(go == 1) { m.call(); } 34 35 } 36 }; 37 38 int main(int margc, char* margv[]) { 39 argc = margc; 40 argv = margv; 41 T t; 42 return m.wait(); 43 } 33 // Local Variables: // 34 // tab-width: 4 // 35 // End: // -
benchmark/schedint/JavaThread.java
raefb247 rbdfc032 49 49 static int x = 2; 50 50 51 static private final int NoOfTimes = Integer.parseInt("1000000");51 static private int times = Integer.parseInt("1000000"); 52 52 53 53 public static void helper( Monitor m ) throws InterruptedException { 54 for(int i = 1; i <= NoOfTimes; i += 1) {54 for(int i = 1; i <= times; i += 1) { 55 55 m.wait(); // relase monitor lock 56 56 m.next = true; … … 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 } … … 72 72 Monitor.go = false; 73 73 s.join(); 74 System.out.println( (end - start) / NoOfTimes);74 System.out.println( (end - start) / times); 75 75 } 76 76 public static void main(String[] args) throws InterruptedException { 77 if ( args.length > 2 ) System.exit( 1 ); 78 if ( args.length == 2 ) { times = Integer.parseInt(args[1]); } 79 77 80 for (int n = Integer.parseInt("5"); --n >= 0 ; ) { 78 81 InnerMain(); … … 83 86 } 84 87 } 88 89 // Local Variables: // 90 // tab-width: 4 // 91 // End: // -
benchmark/schedint/cfa1.cfa
raefb247 rbdfc032 4 4 #include <stdio.h> 5 5 6 #include " bench.h"6 #include "../bench.h" 7 7 8 int argc;9 char** argv;10 8 volatile int go = 0; 11 9 12 10 condition c; 13 monitor M {}; 14 M m1; 11 monitor M {} m1; 15 12 16 void __attribute__((noinline)) call( M & mutex a1 ) {17 signal( c);13 void __attribute__((noinline)) call( M & mutex p1 ) { 14 signal( c ); 18 15 } 19 20 int __attribute__((noinline)) wait( M & mutex a1 ) { 16 void __attribute__((noinline)) wait( M & mutex p1 ) { 21 17 go = 1; 22 BENCH( 23 for ( i; n ) { 24 wait(c); 25 }, 26 result 27 ) 28 29 printf("%g\n", result); 30 go = 0; 31 return 0; 18 for ( times ) { 19 wait( c ); 20 } 32 21 } 33 22 34 23 thread T {}; 35 void ^?{}( T & mutex ) {}36 24 void main( T & ) { 37 while(go == 0) { yield(); } 38 while(go == 1) { call(m1); } 39 25 while ( go == 0 ) { yield(); } // waiter must start first 26 BENCH( 27 for ( times ) { call( m1 ); }, 28 result 29 ) 30 printf( "%g\n", result ); 40 31 } 41 32 42 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 33 int main( int argc, char * argv[] ) { 34 BENCH_START() 43 35 T t; 44 return wait(m1);36 wait( m1 ); 45 37 } 38 39 // Local Variables: // 40 // tab-width: 4 // 41 // End: // -
benchmark/schedint/cfa2.cfa
raefb247 rbdfc032 4 4 #include <stdio.h> 5 5 6 #include " bench.h"6 #include "../bench.h" 7 7 8 int argc;9 char** argv;10 8 volatile int go = 0; 11 9 12 10 condition c; 13 monitor M {}; 14 M m1, m2; 11 monitor M {} m1, m2; 15 12 16 void __attribute__((noinline)) call( M & mutex a1, M & mutex a2 ) {17 signal( c);13 void __attribute__((noinline)) call( M & mutex p1, M & mutex p2 ) { 14 signal( c ); 18 15 } 19 20 int __attribute__((noinline)) wait( M & mutex a1, M & mutex a2 ) { 16 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2 ) { 21 17 go = 1; 22 BENCH( 23 for ( i; n ) { 24 wait(c); 25 }, 26 result 27 ) 28 29 printf("%g\n", result); 30 go = 0; 31 return 0; 18 for ( times ) { 19 wait( c ); 20 } 32 21 } 33 22 34 23 thread T {}; 35 void ^?{}( T & mutex this ) {}36 24 void main( T & ) { 37 while(go == 0) { yield(); } 38 while(go == 1) { call(m1, m2); } 39 25 while ( go == 0 ) { yield(); } // waiter must start first 26 BENCH( 27 for ( times ) { call( m1, m2 ); }, 28 result 29 ) 30 printf( "%g\n", result ); 40 31 } 41 32 42 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 33 int main( int argc, char * argv[] ) { 34 BENCH_START() 43 35 T t; 44 return wait(m1, m2);36 wait( m1, m2 ); 45 37 } 38 39 // Local Variables: // 40 // tab-width: 4 // 41 // End: // -
benchmark/schedint/cfa4.cfa
raefb247 rbdfc032 4 4 #include <stdio.h> 5 5 6 #include " bench.h"6 #include "../bench.h" 7 7 8 int argc;9 char** argv;10 8 volatile int go = 0; 11 9 12 10 condition c; 13 monitor M {}; 14 M m1, m2, m3, m4; 11 monitor M {} m1, m2, m3, m4; 15 12 16 void __attribute__((noinline)) call( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) {17 signal( c);13 void __attribute__((noinline)) call( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) { 14 signal( c ); 18 15 } 19 20 int __attribute__((noinline)) wait( M & mutex a1, M & mutex a2, M & mutex a3, M & mutex a4 ) { 16 void __attribute__((noinline)) wait( M & mutex p1, M & mutex p2, M & mutex p3, M & mutex p4 ) { 21 17 go = 1; 22 BENCH( 23 for ( i; n ) { 24 wait(c); 25 }, 26 result 27 ) 28 29 printf("%g\n", result); 30 go = 0; 31 return 0; 18 for ( times ) { 19 wait( c ); 20 } 32 21 } 33 22 34 23 thread T {}; 35 void ^?{}( T & mutex this ) {}36 24 void main( T & ) { 37 while(go == 0) { yield(); } 38 while(go == 1) { call(m1, m2, m3, m4); } 39 25 while ( go == 0 ) { yield(); } // waiter must start first 26 BENCH( 27 for ( times ) { call( m1, m2, m3, m4 ); }, 28 result 29 ) 30 printf( "%g\n", result ); 40 31 } 41 32 42 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 33 int main( int argc, char * argv[] ) { 34 BENCH_START() 43 35 T t; 44 return wait(m1, m2, m3, m4);36 wait( m1, m2, m3, m4 ); 45 37 } 38 39 // Local Variables: // 40 // tab-width: 4 // 41 // End: // -
benchmark/schedint/pthreads.c
raefb247 rbdfc032 4 4 #include "bench.h" 5 5 6 int argc;7 char** argv;8 6 volatile int go = 0; 9 7 8 pthread_mutex_t m; 10 9 pthread_cond_t c; 11 pthread_mutex_t m;12 10 13 11 void __attribute__((noinline)) call() { 14 pthread_mutex_lock( &m);15 pthread_cond_signal( &c);16 pthread_mutex_unlock( &m);12 pthread_mutex_lock( &m ); 13 pthread_cond_signal( &c ); 14 pthread_mutex_unlock( &m ); 17 15 } 18 16 19 int__attribute__((noinline)) wait() {17 void __attribute__((noinline)) wait() { 20 18 pthread_mutex_lock(&m); 21 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 22 30 BENCH( 23 for (size_t i = 0; i < n; i++) { 24 pthread_cond_wait(&c, &m); 25 }, 31 while ( go == 1 ) { call(); }, 26 32 result 27 33 ) 28 29 printf("%g\n", result); 30 go = 0; 31 pthread_mutex_unlock(&m); 32 return 0; 33 } 34 35 void* thread_main(__attribute__((unused)) void * arg ) { 36 while(go == 0) { sched_yield(); } 37 while(go == 1) { call(); } 34 printf( "%g\n", result ); 38 35 return NULL; 39 36 } 40 37 41 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 38 int main( int argc, char * argv[] ) { 39 BENCH_START() 42 40 pthread_t thread; 43 if ( pthread_create(&thread, NULL, thread_main, NULL) < 0) {41 if ( pthread_create( &thread, NULL, thread_main, NULL ) < 0 ) { 44 42 perror( "failure" ); 45 43 return 1; 46 44 } 47 45 wait(); 48 if ( pthread_join( thread, NULL) < 0) {46 if ( pthread_join( thread, NULL ) < 0 ) { 49 47 perror( "failure" ); 50 48 return 1; 51 49 } 52 return 0;53 50 } 51 52 // Local Variables: // 53 // tab-width: 4 // 54 // End: // -
benchmark/schedint/upp.cc
raefb247 rbdfc032 3 3 #include "bench.h" 4 4 5 int argc;6 char** argv;7 5 volatile int go = 0; 8 6 … … 13 11 cond.signal(); 14 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; 15 20 16 int __attribute__((noinline)) wait() { 17 go = 1; 21 _Task T { 22 void main() { 23 while ( go == 0 ) { yield(); } // waiter must start first 18 24 BENCH( 19 for ( size_t i = 0; i < n; i++) {20 cond.wait();25 for ( size_t i = 0; i < times; i++ ) { 26 m.call(); 21 27 }, 22 28 result 23 29 ) 24 25 printf("%g\n", result); 26 go = 0; 27 return 0; 30 printf( "%g\n", result ); 28 31 } 29 32 }; 30 33 31 M m; 34 int main( int argc, char * argv[] ) { 35 BENCH_START() 36 T t; 37 m.wait(); 38 } 32 39 33 _Task T { 34 void main() { 35 while(go == 0) { yield(); } 36 while(go == 1) { m.call(); } 37 38 } 39 }; 40 41 int main(__attribute__((unused)) int argc, __attribute__((unused)) char* argv[]) { 42 T t; 43 return m.wait(); 44 } 40 // Local Variables: // 41 // tab-width: 4 // 42 // End: // -
driver/cfa.cc
raefb247 rbdfc032 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/Makefile.in
raefb247 rbdfc032 425 425 am__v_CFA_0 = @echo " CFA " $@; 426 426 am__v_CFA_1 = 427 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@)428 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@)429 am__v_JAVAC_0 = @echo " JAVAC " $@;430 am__v_JAVAC_1 =431 AM_V_GOC = $(am__v_GOC_@AM_V@)432 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@)433 am__v_GOC_0 = @echo " GOC " $@;434 am__v_GOC_1 =435 427 UPPCC = u++ 436 428 UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS) … … 439 431 am__v_UPP_0 = @echo " UPP " $@; 440 432 am__v_UPP_1 = 433 AM_V_GOC = $(am__v_GOC_@AM_V@) 434 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@) 435 am__v_GOC_0 = @echo " GOC " $@; 436 am__v_GOC_1 = 437 AM_V_RUST = $(am__v_RUST_@AM_V@) 438 am__v_RUST_ = $(am__v_RUST_@AM_DEFAULT_V@) 439 am__v_RUST_0 = @echo " RUST " $@; 440 am__v_RUST_1 = 441 AM_V_NODEJS = $(am__v_NODEJS_@AM_V@) 442 am__v_NODEJS_ = $(am__v_NODEJS_@AM_DEFAULT_V@) 443 am__v_NODEJS_0 = @echo " NODEJS " $@; 444 am__v_NODEJS_1 = 445 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@) 446 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@) 447 am__v_JAVAC_0 = @echo " JAVAC " $@; 448 am__v_JAVAC_1 = 441 449 lib_LTLIBRARIES = libcfa.la libcfathread.la 442 450 gdbwaittarget = "" -
libcfa/src/bits/containers.hfa
raefb247 rbdfc032 10 10 // Created On : Tue Oct 31 16:38:50 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed J un 26 08:52:20 201913 // Update Count : 412 // Last Modified On : Wed Jan 15 07:42:35 2020 13 // Update Count : 28 14 14 15 15 #pragma once … … 44 44 45 45 forall(dtype T | sized(T)) 46 static inline T & ?[?]( __small_array(T) & this, __lock_size_t idx) {46 static inline T & ?[?]( __small_array(T) & this, __lock_size_t idx ) { 47 47 return ((typeof(this.data))this.data)[idx]; 48 48 } 49 49 50 50 forall(dtype T | sized(T)) 51 static inline T & ?[?]( const __small_array(T) & this, __lock_size_t idx) {51 static inline T & ?[?]( const __small_array(T) & this, __lock_size_t idx ) { 52 52 return ((typeof(this.data))this.data)[idx]; 53 53 } 54 54 55 forall(dtype T) 56 static inline T * begin( const __small_array(T) & this ) { 57 return ((typeof(this.data))this.data); 58 } 59 55 60 forall(dtype T | sized(T)) 56 static inline T* begin( const __small_array(T) & this ) { 57 return ((typeof(this.data))this.data); 58 } 59 60 forall(dtype T | sized(T)) 61 static inline T* end( const __small_array(T) & this ) { 61 static inline T * end( const __small_array(T) & this ) { 62 62 return ((typeof(this.data))this.data) + this.size; 63 63 } … … 70 70 #ifdef __cforall 71 71 trait is_node(dtype T) { 72 T *& get_next( T& );72 T *& get_next( T & ); 73 73 }; 74 74 #endif … … 97 97 forall(dtype T) 98 98 static inline void ?{}( __stack(T) & this ) { 99 (this.top){ NULL }; 100 } 101 102 forall(dtype T | is_node(T) | sized(T)) 103 static inline void push( __stack(T) & this, T * val ) { 104 verify( !get_next( *val ) ); 105 get_next( *val ) = this.top; 106 this.top = val; 107 } 108 109 forall(dtype T | is_node(T) | sized(T)) 110 static inline T * pop( __stack(T) & this ) { 111 T * top = this.top; 112 if( top ) { 113 this.top = get_next( *top ); 114 get_next( *top ) = NULL; 115 } 116 return top; 117 } 118 119 forall(dtype T | is_node(T)) 120 static inline int ?!=?( const __stack(T) & this, __attribute__((unused)) zero_t zero ) { 121 return this.top != 0; 99 (this.top){ 0p }; 100 } 101 102 static inline forall( dtype T | is_node(T) ) { 103 void push( __stack(T) & this, T * val ) { 104 verify( !get_next( *val ) ); 105 get_next( *val ) = this.top; 106 this.top = val; 107 } 108 109 T * pop( __stack(T) & this ) { 110 T * top = this.top; 111 if( top ) { 112 this.top = get_next( *top ); 113 get_next( *top ) = 0p; 114 } 115 return top; 116 } 117 118 int ?!=?( const __stack(T) & this, __attribute__((unused)) zero_t zero ) { 119 return this.top != 0; 120 } 122 121 } 123 122 #endif … … 145 144 146 145 #ifdef __cforall 147 148 forall(dtype T) 149 static inline void ?{}( __queue(T) & this ) with( this ) { 150 head{ NULL }; 151 tail{ &head }; 152 } 153 154 forall(dtype T | is_node(T) | sized(T)) 155 static inline void append( __queue(T) & this, T * val ) with( this ) { 156 verify(tail != NULL); 157 *tail = val; 158 tail = &get_next( *val ); 159 } 160 161 forall(dtype T | is_node(T) | sized(T)) 162 static inline T * pop_head( __queue(T) & this ) { 163 T * head = this.head; 164 if( head ) { 165 this.head = get_next( *head ); 166 if( !get_next( *head ) ) { 167 this.tail = &this.head; 168 } 169 get_next( *head ) = NULL; 170 } 171 return head; 172 } 173 174 forall(dtype T | is_node(T) | sized(T)) 175 static inline T * remove( __queue(T) & this, T ** it ) with( this ) { 176 T * val = *it; 177 verify( val ); 178 179 (*it) = get_next( *val ); 180 181 if( tail == &get_next( *val ) ) { 182 tail = it; 183 } 184 185 get_next( *val ) = NULL; 186 187 verify( (head == NULL) == (&head == tail) ); 188 verify( *tail == NULL ); 189 return val; 190 } 191 192 forall(dtype T | is_node(T)) 193 static inline int ?!=?( const __queue(T) & this, __attribute__((unused)) zero_t zero ) { 194 return this.head != 0; 146 static inline forall( dtype T | is_node(T) ) { 147 void ?{}( __queue(T) & this ) with( this ) { 148 head{ 0p }; 149 tail{ &head }; 150 } 151 152 void append( __queue(T) & this, T * val ) with( this ) { 153 verify(tail != 0p); 154 *tail = val; 155 tail = &get_next( *val ); 156 } 157 158 T * pop_head( __queue(T) & this ) { 159 T * head = this.head; 160 if( head ) { 161 this.head = get_next( *head ); 162 if( !get_next( *head ) ) { 163 this.tail = &this.head; 164 } 165 get_next( *head ) = 0p; 166 } 167 return head; 168 } 169 170 T * remove( __queue(T) & this, T ** it ) with( this ) { 171 T * val = *it; 172 verify( val ); 173 174 (*it) = get_next( *val ); 175 176 if( tail == &get_next( *val ) ) { 177 tail = it; 178 } 179 180 get_next( *val ) = 0p; 181 182 verify( (head == 0p) == (&head == tail) ); 183 verify( *tail == 0p ); 184 return val; 185 } 186 187 int ?!=?( const __queue(T) & this, __attribute__((unused)) zero_t zero ) { 188 return this.head != 0; 189 } 195 190 } 196 191 #endif … … 223 218 224 219 #ifdef __cforall 225 226 forall(dtype T | sized(T)) 220 forall(dtype T ) 227 221 static inline [void] ?{}( __dllist(T) & this, * [T * & next, T * & prev] ( T & ) __get ) { 228 this.head{ NULL};222 this.head{ 0p }; 229 223 this.__get = __get; 230 224 } … … 232 226 #define next 0 233 227 #define prev 1 234 forall(dtype T | sized(T)) 235 static inline void push_front( __dllist(T) & this, T & node ) with( this ) { 236 verify(__get); 237 if ( head ) { 238 __get( node ).next = head; 239 __get( node ).prev = __get( *head ).prev; 240 // inserted node must be consistent before it is seen 228 static inline forall(dtype T) { 229 void push_front( __dllist(T) & this, T & node ) with( this ) { 230 verify(__get); 231 if ( head ) { 232 __get( node ).next = head; 233 __get( node ).prev = __get( *head ).prev; 234 // inserted node must be consistent before it is seen 235 // prevent code movement across barrier 236 asm( "" : : : "memory" ); 237 __get( *head ).prev = &node; 238 T & _prev = *__get( node ).prev; 239 __get( _prev ).next = &node; 240 } else { 241 __get( node ).next = &node; 242 __get( node ).prev = &node; 243 } 244 241 245 // prevent code movement across barrier 242 246 asm( "" : : : "memory" ); 243 __get( *head ).prev = &node; 244 T & _prev = *__get( node ).prev; 245 __get( _prev ).next = &node; 246 } 247 else { 248 __get( node ).next = &node; 249 __get( node ).prev = &node; 250 } 251 252 // prevent code movement across barrier 253 asm( "" : : : "memory" ); 254 head = &node; 255 } 256 257 forall(dtype T | sized(T)) 258 static inline void remove( __dllist(T) & this, T & node ) with( this ) { 259 verify(__get); 260 if ( &node == head ) { 261 if ( __get( *head ).next == head ) { 262 head = NULL; 263 } 264 else { 265 head = __get( *head ).next; 266 } 267 } 268 __get( *__get( node ).next ).prev = __get( node ).prev; 269 __get( *__get( node ).prev ).next = __get( node ).next; 270 __get( node ).next = NULL; 271 __get( node ).prev = NULL; 272 } 273 274 forall(dtype T | sized(T)) 275 static inline int ?!=?( const __dllist(T) & this, __attribute__((unused)) zero_t zero ) { 276 return this.head != 0; 247 head = &node; 248 } 249 250 void remove( __dllist(T) & this, T & node ) with( this ) { 251 verify(__get); 252 if ( &node == head ) { 253 if ( __get( *head ).next == head ) { 254 head = 0p; 255 } else { 256 head = __get( *head ).next; 257 } 258 } 259 __get( *__get( node ).next ).prev = __get( node ).prev; 260 __get( *__get( node ).prev ).next = __get( node ).next; 261 __get( node ).next = 0p; 262 __get( node ).prev = 0p; 263 } 264 265 int ?!=?( const __dllist(T) & this, __attribute__((unused)) zero_t zero ) { 266 return this.head != 0; 267 } 277 268 } 278 269 #undef next … … 286 277 287 278 #endif 279 280 // Local Variables: // 281 // tab-width: 4 // 282 // End: // -
libcfa/src/bits/defs.hfa
raefb247 rbdfc032 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
raefb247 rbdfc032 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/clock.hfa
raefb247 rbdfc032 10 10 // Created On : Thu Apr 12 14:36:06 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 13 21:21:13 201913 // Update Count : 812 // Last Modified On : Mon Jan 6 12:49:58 2020 13 // Update Count : 9 14 14 // 15 15 16 16 #include <time.hfa> 17 18 17 19 18 //######################### C time ######################### … … 26 25 static inline tm * localtime_r( time_t tp, tm * result ) { return localtime_r( &tp, result ); } 27 26 28 29 27 //######################### Clock ######################### 30 28 31 29 struct Clock { // private 32 30 Duration offset; // for virtual clock: contains offset from real-time 33 int clocktype; // implementation only -1 (virtual), CLOCK_REALTIME34 31 }; 35 32 36 33 static inline { 37 void resetClock( Clock & clk ) with( clk ) {38 clocktype = CLOCK_REALTIME_COARSE;39 } // Clock::resetClock40 41 34 void resetClock( Clock & clk, Duration adj ) with( clk ) { 42 clocktype = -1;43 35 offset = adj + __timezone`s; // timezone (global) is (UTC - local time) in seconds 44 36 } // resetClock 45 37 46 void ?{}( Clock & clk ) { resetClock( clk ); }47 38 void ?{}( Clock & clk, Duration adj ) { resetClock( clk, adj ); } 48 39 … … 89 80 return ret; 90 81 } // getTime 82 83 Time getCPUTime() { 84 timespec ts; 85 clock_gettime( CLOCK_THREAD_CPUTIME_ID, &ts ); 86 return (Time){ ts }; 87 } // getCPUTime 91 88 } // distribution 92 89 -
libcfa/src/concurrency/CtxSwitch-x86_64.S
raefb247 rbdfc032 87 87 CtxInvokeStub: 88 88 movq %rbx, %rdi 89 jmp *%r12 89 movq %r12, %rsi 90 jmp *%r13 90 91 .size CtxInvokeStub, .-CtxInvokeStub 91 92 -
libcfa/src/concurrency/alarm.cfa
raefb247 rbdfc032 10 10 // Created On : Fri Jun 2 11:31:25 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 3 22:47:24 201913 // Update Count : 6 812 // Last Modified On : Sun Jan 5 08:41:36 2020 13 // Update Count : 69 14 14 // 15 15 … … 39 39 40 40 void __kernel_set_timer( Duration alarm ) { 41 verifyf(alarm >= 1`us || alarm == 0, "Setting timer to < 1us (%jins)", alarm .tv);41 verifyf(alarm >= 1`us || alarm == 0, "Setting timer to < 1us (%jins)", alarm`ns); 42 42 setitimer( ITIMER_REAL, &(itimerval){ alarm }, 0p ); 43 43 } -
libcfa/src/concurrency/coroutine.cfa
raefb247 rbdfc032 187 187 // is not inline (We can't inline Cforall in C) 188 188 extern "C" { 189 void __suspend_internal(void) { 190 suspend(); 191 } 192 193 void __leave_coroutine( coroutine_desc * src ) { 189 void __leave_coroutine( struct coroutine_desc * src ) { 194 190 coroutine_desc * starter = src->cancellation != 0 ? src->last : src->starter; 195 191 … … 207 203 CoroutineCtxSwitch( src, starter ); 208 204 } 205 206 struct coroutine_desc * __finish_coroutine(void) { 207 struct coroutine_desc * cor = kernelTLS.this_thread->curr_cor; 208 209 if(cor->state == Primed) { 210 suspend(); 211 } 212 213 cor->state = Active; 214 215 return cor; 216 } 209 217 } 210 218 -
libcfa/src/concurrency/coroutine.hfa
raefb247 rbdfc032 61 61 // Start coroutine routines 62 62 extern "C" { 63 forall(dtype T | is_coroutine(T)) 64 void CtxInvokeCoroutine(T * this); 63 void CtxInvokeCoroutine(void (*main)(void *), void * this); 65 64 66 forall(dtype T | is_coroutine(T))67 void CtxStart(T * this, void ( *invoke)(T*));65 forall(dtype T) 66 void CtxStart(void (*main)(T &), struct coroutine_desc * cor, T & this, void (*invoke)(void (*main)(void *), void *)); 68 67 69 68 extern void _CtxCoroutine_Unwind(struct _Unwind_Exception * storage, struct coroutine_desc *) __attribute__ ((__noreturn__)); … … 129 128 130 129 if( unlikely(dst->context.SP == 0p) ) { 130 TL_GET( this_thread )->curr_cor = dst; 131 131 __stack_prepare(&dst->stack, 65000); 132 CtxStart(&cor, CtxInvokeCoroutine); 132 CtxStart(main, dst, cor, CtxInvokeCoroutine); 133 TL_GET( this_thread )->curr_cor = src; 133 134 } 134 135 -
libcfa/src/concurrency/invoke.c
raefb247 rbdfc032 29 29 // Called from the kernel when starting a coroutine or task so must switch back to user mode. 30 30 31 extern void __suspend_internal(void); 32 extern void __leave_coroutine( struct coroutine_desc * ); 33 extern void __finish_creation( struct thread_desc * ); 34 extern void __leave_thread_monitor( struct thread_desc * this ); 31 extern void __leave_coroutine ( struct coroutine_desc * ); 32 extern struct coroutine_desc * __finish_coroutine(void); 33 extern void __leave_thread_monitor(); 35 34 extern void disable_interrupts() OPTIONAL_THREAD; 36 35 extern void enable_interrupts( __cfaabi_dbg_ctx_param ); … … 38 37 void CtxInvokeCoroutine( 39 38 void (*main)(void *), 40 struct coroutine_desc *(*get_coroutine)(void *),41 39 void *this 42 40 ) { 43 struct coroutine_desc* cor = get_coroutine( this ); 41 // Finish setting up the coroutine by setting its state 42 struct coroutine_desc * cor = __finish_coroutine(); 44 43 45 if(cor->state == Primed) { 46 __suspend_internal(); 47 } 48 49 cor->state = Active; 50 44 // Call the main of the coroutine 51 45 main( this ); 52 46 … … 83 77 84 78 void CtxInvokeThread( 85 void (*dtor)(void *),86 79 void (*main)(void *), 87 struct thread_desc *(*get_thread)(void *),88 80 void *this 89 81 ) { 90 // Fetch the thread handle from the user defined thread structure91 struct thread_desc* thrd = get_thread( this );92 93 // First suspend, once the thread arrives here,94 // the function pointer to main can be invalidated without risk95 __finish_creation( thrd );96 97 82 // Officially start the thread by enabling preemption 98 83 enable_interrupts( __cfaabi_dbg_ctx ); … … 108 93 // The order of these 4 operations is very important 109 94 //Final suspend, should never return 110 __leave_thread_monitor( thrd);95 __leave_thread_monitor(); 111 96 __cabi_abort( "Resumed dead thread" ); 112 97 } 113 98 114 115 99 void CtxStart( 116 100 void (*main)(void *), 117 struct coroutine_desc * (*get_coroutine)(void *),101 struct coroutine_desc * cor, 118 102 void *this, 119 103 void (*invoke)(void *) 120 104 ) { 121 struct coroutine_desc * cor = get_coroutine( this );122 105 struct __stack_t * stack = cor->stack.storage; 123 106 … … 138 121 139 122 fs->dummyReturn = NULL; 140 fs->argument[0] = this; // argument to invoke 123 fs->argument[0] = main; // argument to invoke 124 fs->argument[1] = this; // argument to invoke 141 125 fs->rturn = invoke; 142 126 … … 156 140 fs->dummyReturn = NULL; 157 141 fs->rturn = CtxInvokeStub; 158 fs->fixedRegisters[0] = this; 159 fs->fixedRegisters[1] = invoke; 142 fs->fixedRegisters[0] = main; 143 fs->fixedRegisters[1] = this; 144 fs->fixedRegisters[2] = invoke; 160 145 161 146 #elif defined( __ARM_ARCH ) 162 147 #error ARM needs to be upgrade to use to parameters like X86/X64 (A.K.A. : I broke this and do not know how to fix it) 163 148 struct FakeStack { 164 149 float fpRegs[16]; // floating point registers -
libcfa/src/concurrency/kernel.cfa
raefb247 rbdfc032 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 … … 469 469 ); 470 470 471 Abort( pthread_attr_setstack( &attr, stack, stacksize ), "pthread_attr_setstack" ); 471 Abort( pthread_attr_setstack( &attr, stack, stacksize ), "pthread_attr_setstack" ); 472 472 473 473 Abort( pthread_create( pthread, &attr, start, arg ), "pthread_create" ); … … 490 490 verify( ! kernelTLS.preemption_state.enabled ); 491 491 492 kernelTLS.this_thread->curr_cor = dst; 492 493 __stack_prepare( &dst->stack, 65000 ); 493 CtxStart( &this->runner, CtxInvokeCoroutine);494 CtxStart(main, dst, this->runner, CtxInvokeCoroutine); 494 495 495 496 verify( ! kernelTLS.preemption_state.enabled ); … … 505 506 CtxSwitch( &src->context, &dst->context ); 506 507 // when CtxSwitch returns we are back in the src coroutine 508 509 mainThread->curr_cor = &mainThread->self_cor; 507 510 508 511 // set state of new coroutine to active … … 841 844 sigemptyset( &mask ); 842 845 sigaddset( &mask, SIGALRM ); // block SIGALRM signals 843 sigsuspend( &mask ); // block the processor to prevent further damage during abort 844 _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 845 849 } 846 850 else { -
libcfa/src/concurrency/kernel_private.hfa
raefb247 rbdfc032 88 88 // Threads 89 89 extern "C" { 90 forall(dtype T | is_thread(T)) 91 void CtxInvokeThread(T * this); 90 void CtxInvokeThread(void (*main)(void *), void * this); 92 91 } 93 92 -
libcfa/src/concurrency/monitor.cfa
raefb247 rbdfc032 243 243 // last routine called by a thread. 244 244 // Should never return 245 void __leave_thread_monitor( thread_desc * thrd ) { 245 void __leave_thread_monitor() { 246 thread_desc * thrd = TL_GET( this_thread ); 246 247 monitor_desc * this = &thrd->self_mon; 247 248 -
libcfa/src/concurrency/thread.cfa
raefb247 rbdfc032 58 58 void ?{}( scoped(T)& this ) with( this ) { 59 59 handle{}; 60 __thrd_start(handle );60 __thrd_start(handle, main); 61 61 } 62 62 … … 64 64 void ?{}( scoped(T)& this, P params ) with( this ) { 65 65 handle{ params }; 66 __thrd_start(handle );66 __thrd_start(handle, main); 67 67 } 68 68 … … 75 75 // Starting and stopping threads 76 76 forall( dtype T | is_thread(T) ) 77 void __thrd_start( T & this) {77 void __thrd_start( T & this, void (*main_p)(T &) ) { 78 78 thread_desc * this_thrd = get_thread(this); 79 79 thread_desc * curr_thrd = TL_GET( this_thread ); 80 80 81 81 disable_interrupts(); 82 CtxStart(&this, CtxInvokeThread); 82 CtxStart(main_p, get_coroutine(this), this, CtxInvokeThread); 83 83 84 this_thrd->context.[SP, FP] = this_thrd->self_cor.context.[SP, FP]; 84 85 verify( this_thrd->context.SP ); 85 CtxSwitch( &curr_thrd->context, &this_thrd->context );86 // CtxSwitch( &curr_thrd->context, &this_thrd->context ); 86 87 87 88 ScheduleThread(this_thrd); 88 89 enable_interrupts( __cfaabi_dbg_ctx ); 89 }90 91 extern "C" {92 // KERNEL ONLY93 void __finish_creation(thread_desc * this) {94 // set new coroutine that the processor is executing95 // and context switch to it96 verify( kernelTLS.this_thread != this );97 verify( kernelTLS.this_thread->context.SP );98 CtxSwitch( &this->context, &kernelTLS.this_thread->context );99 }100 90 } 101 91 -
libcfa/src/concurrency/thread.hfa
raefb247 rbdfc032 54 54 55 55 forall( dtype T | is_thread(T) ) 56 void __thrd_start( T & this );56 void __thrd_start( T & this, void (*)(T &) ); 57 57 58 58 //----------------------------------------------------------------------------- -
libcfa/src/executor.cfa
raefb247 rbdfc032 8 8 #include <stdio.h> 9 9 10 forall( otype T | is_node(T) | is_monitor(T) ) {11 12 13 14 15 10 forall( dtype T ) 11 monitor Buffer { // unbounded buffer 12 __queue_t( T ) queue; // unbounded list of work requests 13 condition delay; 14 }; // Buffer 15 forall( dtype T | is_node(T) ) { 16 16 void insert( Buffer( T ) & mutex buf, T * elem ) with(buf) { 17 17 append( queue, elem ); // insert element into buffer … … 20 20 21 21 T * remove( Buffer( T ) & mutex buf ) with(buf) { 22 if ( ! queue) wait( delay ); // no request to process ? => wait23 return pop_head( queue );22 if ( queue.head != 0 ) wait( delay ); // no request to process ? => wait 23 // return pop_head( queue ); 24 24 } // remove 25 25 } // distribution -
libcfa/src/interpose.cfa
raefb247 rbdfc032 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/startup.cfa
raefb247 rbdfc032 10 10 // Created On : Tue Jul 24 16:21:57 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Nov 30 07:07:56201913 // Update Count : 1312 // Last Modified On : Fri Dec 13 13:16:45 2019 13 // Update Count : 29 14 14 // 15 15 16 #include <time.h> // tzset 16 17 #include "startup.hfa" 17 #include <time.h> // tzset18 18 19 19 extern "C" { 20 staticvoid __cfaabi_appready_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_APPREADY ) ));20 void __cfaabi_appready_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_APPREADY ) )); 21 21 void __cfaabi_appready_startup( void ) { 22 22 tzset(); // initialize time global variables … … 27 27 } // __cfaabi_appready_startup 28 28 29 staticvoid __cfaabi_appready_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_APPREADY ) ));29 void __cfaabi_appready_shutdown( void ) __attribute__(( destructor( STARTUP_PRIORITY_APPREADY ) )); 30 30 void __cfaabi_appready_shutdown( void ) { 31 31 #ifdef __CFA_DEBUG__ -
libcfa/src/stdhdr/bfdlink.h
raefb247 rbdfc032 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
raefb247 rbdfc032 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
raefb247 rbdfc032 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
raefb247 rbdfc032 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
raefb247 rbdfc032 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 -
libcfa/src/time.cfa
raefb247 rbdfc032 10 10 // Created On : Tue Mar 27 13:33:14 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S at Jul 13 08:41:55 201913 // Update Count : 6 512 // Last Modified On : Sun Jan 5 17:27:40 2020 13 // Update Count : 69 14 14 // 15 15 … … 33 33 forall( dtype ostype | ostream( ostype ) ) { 34 34 ostype & ?|?( ostype & os, Duration dur ) with( dur ) { 35 (ostype &)(os | t v/ TIMEGRAN); // print seconds36 long int ns = (t v < 0 ? -tv : tv) % TIMEGRAN; // compute nanoseconds35 (ostype &)(os | tn / TIMEGRAN); // print seconds 36 long int ns = (tn < 0 ? -tn : tn) % TIMEGRAN; // compute nanoseconds 37 37 if ( ns != 0 ) { // some ? 38 38 char buf[16]; … … 52 52 53 53 #ifdef __CFA_DEBUG__ 54 static void tabort( int year, int month, int day, int hour, int min, int sec, int nsec ) {54 static void tabort( int year, int month, int day, int hour, int min, int sec, int64_t nsec ) { 55 55 abort | "Attempt to create Time( year=" | year | "(>=1970), month=" | month | "(1-12), day=" | day | "(1-31), hour=" | hour | "(0-23), min=" | min | "(0-59), sec=" | sec 56 | "(0-60), nsec=" | nsec | "(0-999_999_999), which exceeds range 00:00:00 UTC, January 1, 1970 to 03:14:07 UTC, January 19, 2038.";56 | "(0-60), nsec=" | nsec | "(0-999_999_999), which is not in the range 00:00:00 UTC, January 1, 1970 to 03:14:07 UTC, January 19, 2038, where month and day have 1 origin."; 57 57 } // tabort 58 58 #endif // __CFA_DEBUG__ 59 59 60 void ?{}( Time & time, int year, int month, int day, int hour, int min, int sec, int nsec ) with( time ) {60 void ?{}( Time & time, int year, int month, int day, int hour, int min, int sec, int64_t nsec ) with( time ) { 61 61 tm tm; 62 62 63 tm.tm_isdst = -1; // let mktime determine if alternate timezone is in effect63 // Values can be in any range (+/-) but result must be in the epoch. 64 64 tm.tm_year = year - 1900; // mktime uses 1900 as its starting point 65 #ifdef __CFA_DEBUG__ 66 if ( month < 1 || 12 < month ) { 67 tabort( year, month, day, hour, min, sec, nsec ); 68 } // if 69 #endif // __CFA_DEBUG__ 65 // Make month in range 1-12 to match with day. 70 66 tm.tm_mon = month - 1; // mktime uses range 0-11 71 #ifdef __CFA_DEBUG__72 if ( day < 1 || 31 < day ) {73 tabort( year, month, day, hour, min, sec, nsec );74 } // if75 #endif // __CFA_DEBUG__76 67 tm.tm_mday = day; // mktime uses range 1-31 77 68 tm.tm_hour = hour; 78 69 tm.tm_min = min; 79 70 tm.tm_sec = sec; 71 tm.tm_isdst = -1; // let mktime determine if alternate timezone is in effect 80 72 time_t epochsec = mktime( &tm ); 81 73 #ifdef __CFA_DEBUG__ 82 if ( epochsec == (time_t)-1 ) {74 if ( epochsec <= (time_t)-1 ) { // MUST BE LESS THAN OR EQUAL! 83 75 tabort( year, month, day, hour, min, sec, nsec ); 84 76 } // if 85 77 #endif // __CFA_DEBUG__ 86 t v= (int64_t)(epochsec) * TIMEGRAN + nsec; // convert to nanoseconds78 tn = (int64_t)(epochsec) * TIMEGRAN + nsec; // convert to nanoseconds 87 79 #ifdef __CFA_DEBUG__ 88 if ( t v> 2147483647LL * TIMEGRAN ) { // between 00:00:00 UTC, January 1, 1970 and 03:14:07 UTC, January 19, 2038.80 if ( tn > 2147483647LL * TIMEGRAN ) { // between 00:00:00 UTC, January 1, 1970 and 03:14:07 UTC, January 19, 2038. 89 81 tabort( year, month, day, hour, min, sec, nsec ); 90 82 } // if … … 93 85 94 86 char * yy_mm_dd( Time time, char * buf ) with( time ) { 95 time_t s = t v/ TIMEGRAN;87 time_t s = tn / TIMEGRAN; 96 88 tm tm; 97 89 gmtime_r( &s, &tm ); // tm_mon <= 11, tm_mday <= 31 … … 108 100 109 101 char * mm_dd_yy( Time time, char * buf ) with( time ) { 110 time_t s = t v/ TIMEGRAN;102 time_t s = tn / TIMEGRAN; 111 103 tm tm; 112 104 gmtime_r( &s, &tm ); // tm_mon <= 11, tm_mday <= 31 … … 123 115 124 116 char * dd_mm_yy( Time time, char * buf ) with( time ) { 125 time_t s = t v/ TIMEGRAN;117 time_t s = tn / TIMEGRAN; 126 118 tm tm; 127 119 gmtime_r( &s, &tm ); // tm_mon <= 11, tm_mday <= 31 … … 138 130 139 131 size_t strftime( char * buf, size_t size, const char * fmt, Time time ) with( time ) { 140 time_t s = t v/ TIMEGRAN;132 time_t s = tn / TIMEGRAN; 141 133 tm tm; 142 134 gmtime_r( &s, &tm ); … … 147 139 ostype & ?|?( ostype & os, Time time ) with( time ) { 148 140 char buf[32]; // at least 26 149 time_t s = t v/ TIMEGRAN;141 time_t s = tn / TIMEGRAN; 150 142 ctime_r( &s, (char *)&buf ); // 26 characters: "Wed Jun 30 21:49:08 1993\n" 151 143 buf[24] = '\0'; // remove trailing '\n' 152 long int ns = (t v < 0 ? -tv : tv) % TIMEGRAN; // compute nanoseconds144 long int ns = (tn < 0 ? -tn : tn) % TIMEGRAN; // compute nanoseconds 153 145 if ( ns == 0 ) { // none ? 154 146 (ostype &)(os | buf); // print date/time/year -
libcfa/src/time.hfa
raefb247 rbdfc032 10 10 // Created On : Wed Mar 14 23:18:57 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Sep 22 12:25:34 201813 // Update Count : 6 4312 // Last Modified On : Mon Jan 6 12:50:16 2020 13 // Update Count : 653 14 14 // 15 15 … … 32 32 Duration ?=?( Duration & dur, __attribute__((unused)) zero_t ) { return dur{ 0 }; } 33 33 34 Duration +?( Duration rhs ) with( rhs ) { return (Duration)@{ +tv}; }35 Duration ?+?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.t v + rhs.tv}; }34 Duration +?( Duration rhs ) with( rhs ) { return (Duration)@{ +tn }; } 35 Duration ?+?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.tn + rhs.tn }; } 36 36 Duration ?+=?( Duration & lhs, Duration rhs ) { lhs = lhs + rhs; return lhs; } 37 37 38 Duration -?( Duration rhs ) with( rhs ) { return (Duration)@{ -t v}; }39 Duration ?-?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.t v - rhs.tv}; }38 Duration -?( Duration rhs ) with( rhs ) { return (Duration)@{ -tn }; } 39 Duration ?-?( Duration & lhs, Duration rhs ) { return (Duration)@{ lhs.tn - rhs.tn }; } 40 40 Duration ?-=?( Duration & lhs, Duration rhs ) { lhs = lhs - rhs; return lhs; } 41 41 42 Duration ?*?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.t v* rhs }; }43 Duration ?*?( int64_t lhs, Duration rhs ) { return (Duration)@{ lhs * rhs.t v}; }42 Duration ?*?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.tn * rhs }; } 43 Duration ?*?( int64_t lhs, Duration rhs ) { return (Duration)@{ lhs * rhs.tn }; } 44 44 Duration ?*=?( Duration & lhs, int64_t rhs ) { lhs = lhs * rhs; return lhs; } 45 45 46 int64_t ?/?( Duration lhs, Duration rhs ) { return lhs.t v / rhs.tv; }47 Duration ?/?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.t v/ rhs }; }46 int64_t ?/?( Duration lhs, Duration rhs ) { return lhs.tn / rhs.tn; } 47 Duration ?/?( Duration lhs, int64_t rhs ) { return (Duration)@{ lhs.tn / rhs }; } 48 48 Duration ?/=?( Duration & lhs, int64_t rhs ) { lhs = lhs / rhs; return lhs; } 49 double div( Duration lhs, Duration rhs ) { return (double)lhs.t v / (double)rhs.tv; }50 51 Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.t v % rhs.tv}; }49 double div( Duration lhs, Duration rhs ) { return (double)lhs.tn / (double)rhs.tn; } 50 51 Duration ?%?( Duration lhs, Duration rhs ) { return (Duration)@{ lhs.tn % rhs.tn }; } 52 52 Duration ?%=?( Duration & lhs, Duration rhs ) { lhs = lhs % rhs; return lhs; } 53 53 54 bool ?==?( Duration lhs, Duration rhs ) { return lhs.t v == rhs.tv; }55 bool ?!=?( Duration lhs, Duration rhs ) { return lhs.t v != rhs.tv; }56 bool ?<? ( Duration lhs, Duration rhs ) { return lhs.t v < rhs.tv; }57 bool ?<=?( Duration lhs, Duration rhs ) { return lhs.t v <= rhs.tv; }58 bool ?>? ( Duration lhs, Duration rhs ) { return lhs.t v > rhs.tv; }59 bool ?>=?( Duration lhs, Duration rhs ) { return lhs.t v >= rhs.tv; }60 61 bool ?==?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v== 0; }62 bool ?!=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v!= 0; }63 bool ?<? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v< 0; }64 bool ?<=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v<= 0; }65 bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v> 0; }66 bool ?>=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.t v>= 0; }67 68 Duration abs( Duration rhs ) { return rhs.t v>= 0 ? rhs : -rhs; }54 bool ?==?( Duration lhs, Duration rhs ) { return lhs.tn == rhs.tn; } 55 bool ?!=?( Duration lhs, Duration rhs ) { return lhs.tn != rhs.tn; } 56 bool ?<? ( Duration lhs, Duration rhs ) { return lhs.tn < rhs.tn; } 57 bool ?<=?( Duration lhs, Duration rhs ) { return lhs.tn <= rhs.tn; } 58 bool ?>? ( Duration lhs, Duration rhs ) { return lhs.tn > rhs.tn; } 59 bool ?>=?( Duration lhs, Duration rhs ) { return lhs.tn >= rhs.tn; } 60 61 bool ?==?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn == 0; } 62 bool ?!=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn != 0; } 63 bool ?<? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn < 0; } 64 bool ?<=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn <= 0; } 65 bool ?>? ( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn > 0; } 66 bool ?>=?( Duration lhs, __attribute__((unused)) zero_t ) { return lhs.tn >= 0; } 67 68 Duration abs( Duration rhs ) { return rhs.tn >= 0 ? rhs : -rhs; } 69 69 70 70 Duration ?`ns( int64_t nsec ) { return (Duration)@{ nsec }; } … … 82 82 Duration ?`w( double weeks ) { return (Duration)@{ weeks * (7LL * 24LL * 60LL * 60LL * TIMEGRAN) }; } 83 83 84 int64_t ?`ns( Duration dur ) { return dur.t v; }85 int64_t ?`us( Duration dur ) { return dur.t v/ (TIMEGRAN / 1_000_000LL); }86 int64_t ?`ms( Duration dur ) { return dur.t v/ (TIMEGRAN / 1_000LL); }87 int64_t ?`s( Duration dur ) { return dur.t v/ TIMEGRAN; }88 int64_t ?`m( Duration dur ) { return dur.t v/ (60LL * TIMEGRAN); }89 int64_t ?`h( Duration dur ) { return dur.t v/ (60LL * 60LL * TIMEGRAN); }90 int64_t ?`d( Duration dur ) { return dur.t v/ (24LL * 60LL * 60LL * TIMEGRAN); }91 int64_t ?`w( Duration dur ) { return dur.t v/ (7LL * 24LL * 60LL * 60LL * TIMEGRAN); }92 93 Duration max( Duration lhs, Duration rhs ) { return (lhs.t v < rhs.tv) ? rhs : lhs;}94 Duration min( Duration lhs, Duration rhs ) { return !(rhs.t v < lhs.tv) ? lhs : rhs;}84 int64_t ?`ns( Duration dur ) { return dur.tn; } 85 int64_t ?`us( Duration dur ) { return dur.tn / (TIMEGRAN / 1_000_000LL); } 86 int64_t ?`ms( Duration dur ) { return dur.tn / (TIMEGRAN / 1_000LL); } 87 int64_t ?`s( Duration dur ) { return dur.tn / TIMEGRAN; } 88 int64_t ?`m( Duration dur ) { return dur.tn / (60LL * TIMEGRAN); } 89 int64_t ?`h( Duration dur ) { return dur.tn / (60LL * 60LL * TIMEGRAN); } 90 int64_t ?`d( Duration dur ) { return dur.tn / (24LL * 60LL * 60LL * TIMEGRAN); } 91 int64_t ?`w( Duration dur ) { return dur.tn / (7LL * 24LL * 60LL * 60LL * TIMEGRAN); } 92 93 Duration max( Duration lhs, Duration rhs ) { return (lhs.tn < rhs.tn) ? rhs : lhs;} 94 Duration min( Duration lhs, Duration rhs ) { return !(rhs.tn < lhs.tn) ? lhs : rhs;} 95 95 } // distribution 96 96 … … 143 143 //######################### Time ######################### 144 144 145 void ?{}( Time & time, int year, int month = 0, int day = 0, int hour = 0, int min = 0, int sec = 0, int nsec = 0 );145 void ?{}( Time & time, int year, int month = 1, int day = 1, int hour = 0, int min = 0, int sec = 0, int64_t nsec = 0 ); 146 146 static inline { 147 147 Time ?=?( Time & time, __attribute__((unused)) zero_t ) { return time{ 0 }; } 148 148 149 void ?{}( Time & time, timeval t ) with( time ) { t v= (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; }149 void ?{}( Time & time, timeval t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * 1000; } 150 150 Time ?=?( Time & time, timeval t ) with( time ) { 151 t v= (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL);151 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_usec * (TIMEGRAN / 1_000_000LL); 152 152 return time; 153 153 } // ?=? 154 154 155 void ?{}( Time & time, timespec t ) with( time ) { t v= (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; }155 void ?{}( Time & time, timespec t ) with( time ) { tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; } 156 156 Time ?=?( Time & time, timespec t ) with( time ) { 157 t v= (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec;157 tn = (int64_t)t.tv_sec * TIMEGRAN + t.tv_nsec; 158 158 return time; 159 159 } // ?=? 160 160 161 Time ?+?( Time & lhs, Duration rhs ) { return (Time)@{ lhs.t v + rhs.tv}; }161 Time ?+?( Time & lhs, Duration rhs ) { return (Time)@{ lhs.tn + rhs.tn }; } 162 162 Time ?+?( Duration lhs, Time rhs ) { return rhs + lhs; } 163 163 Time ?+=?( Time & lhs, Duration rhs ) { lhs = lhs + rhs; return lhs; } 164 164 165 Duration ?-?( Time lhs, Time rhs ) { return (Duration)@{ lhs.t v - rhs.tv}; }166 Time ?-?( Time lhs, Duration rhs ) { return (Time)@{ lhs.t v - rhs.tv}; }165 Duration ?-?( Time lhs, Time rhs ) { return (Duration)@{ lhs.tn - rhs.tn }; } 166 Time ?-?( Time lhs, Duration rhs ) { return (Time)@{ lhs.tn - rhs.tn }; } 167 167 Time ?-=?( Time & lhs, Duration rhs ) { lhs = lhs - rhs; return lhs; } 168 bool ?==?( Time lhs, Time rhs ) { return lhs.tv == rhs.tv; } 169 bool ?!=?( Time lhs, Time rhs ) { return lhs.tv != rhs.tv; } 170 bool ?<?( Time lhs, Time rhs ) { return lhs.tv < rhs.tv; } 171 bool ?<=?( Time lhs, Time rhs ) { return lhs.tv <= rhs.tv; } 172 bool ?>?( Time lhs, Time rhs ) { return lhs.tv > rhs.tv; } 173 bool ?>=?( Time lhs, Time rhs ) { return lhs.tv >= rhs.tv; } 168 bool ?==?( Time lhs, Time rhs ) { return lhs.tn == rhs.tn; } 169 bool ?!=?( Time lhs, Time rhs ) { return lhs.tn != rhs.tn; } 170 bool ?<?( Time lhs, Time rhs ) { return lhs.tn < rhs.tn; } 171 bool ?<=?( Time lhs, Time rhs ) { return lhs.tn <= rhs.tn; } 172 bool ?>?( Time lhs, Time rhs ) { return lhs.tn > rhs.tn; } 173 bool ?>=?( Time lhs, Time rhs ) { return lhs.tn >= rhs.tn; } 174 175 int64_t ?`ns( Time t ) { return t.tn; } 174 176 } // distribution 175 177 … … 194 196 195 197 static inline void ?{}( timeval & t, Time time ) with( t, time ) { 196 tv_sec = t v/ TIMEGRAN; // seconds197 tv_usec = t v% TIMEGRAN / (TIMEGRAN / 1_000_000LL); // microseconds198 tv_sec = tn / TIMEGRAN; // seconds 199 tv_usec = tn % TIMEGRAN / (TIMEGRAN / 1_000_000LL); // microseconds 198 200 } // ?{} 199 201 … … 201 203 202 204 static inline void ?{}( timespec & t, Time time ) with( t, time ) { 203 tv_sec = t v/ TIMEGRAN; // seconds204 tv_nsec = t v% TIMEGRAN; // nanoseconds205 tv_sec = tn / TIMEGRAN; // seconds 206 tv_nsec = tn % TIMEGRAN; // nanoseconds 205 207 } // ?{} 206 208 -
libcfa/src/time_t.hfa
raefb247 rbdfc032 10 10 // Created On : Tue Apr 10 14:42:03 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Apr 13 07:51:47 201813 // Update Count : 612 // Last Modified On : Sun Jan 5 08:22:46 2020 13 // Update Count : 7 14 14 // 15 15 … … 20 20 21 21 struct Duration { // private 22 int64_t t v; // nanoseconds22 int64_t tn; // nanoseconds 23 23 }; // Duration 24 24 25 static inline void ?{}( Duration & dur ) with( dur ) { t v= 0; }26 static inline void ?{}( Duration & dur, __attribute__((unused)) zero_t ) with( dur ) { t v= 0; }25 static inline void ?{}( Duration & dur ) with( dur ) { tn = 0; } 26 static inline void ?{}( Duration & dur, __attribute__((unused)) zero_t ) with( dur ) { tn = 0; } 27 27 28 28 … … 30 30 31 31 struct Time { // private 32 uint64_t t v; // nanoseconds since UNIX epoch32 uint64_t tn; // nanoseconds since UNIX epoch 33 33 }; // Time 34 34 35 static inline void ?{}( Time & time ) with( time ) { t v= 0; }36 static inline void ?{}( Time & time, __attribute__((unused)) zero_t ) with( time ) { t v= 0; }35 static inline void ?{}( Time & time ) with( time ) { tn = 0; } 36 static inline void ?{}( Time & time, __attribute__((unused)) zero_t ) with( time ) { tn = 0; } 37 37 38 38 // Local Variables: // -
longrun_tests/Makefile.in
raefb247 rbdfc032 492 492 am__v_CFA_0 = @echo " CFA " $@; 493 493 am__v_CFA_1 = 494 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@)495 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@)496 am__v_JAVAC_0 = @echo " JAVAC " $@;497 am__v_JAVAC_1 =498 AM_V_GOC = $(am__v_GOC_@AM_V@)499 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@)500 am__v_GOC_0 = @echo " GOC " $@;501 am__v_GOC_1 =502 494 UPPCC = u++ 503 495 UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS) … … 506 498 am__v_UPP_0 = @echo " UPP " $@; 507 499 am__v_UPP_1 = 500 AM_V_GOC = $(am__v_GOC_@AM_V@) 501 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@) 502 am__v_GOC_0 = @echo " GOC " $@; 503 am__v_GOC_1 = 504 AM_V_RUST = $(am__v_RUST_@AM_V@) 505 am__v_RUST_ = $(am__v_RUST_@AM_DEFAULT_V@) 506 am__v_RUST_0 = @echo " RUST " $@; 507 am__v_RUST_1 = 508 AM_V_NODEJS = $(am__v_NODEJS_@AM_V@) 509 am__v_NODEJS_ = $(am__v_NODEJS_@AM_DEFAULT_V@) 510 am__v_NODEJS_0 = @echo " NODEJS " $@; 511 am__v_NODEJS_1 = 512 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@) 513 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@) 514 am__v_JAVAC_0 = @echo " JAVAC " $@; 515 am__v_JAVAC_1 = 508 516 repeats = 10 509 517 max_time = 600 -
src/Common/Stats/Time.h
raefb247 rbdfc032 9 9 // Author : Thierry Delisle 10 10 // Created On : Fri Mar 01 15:14:11 2019 11 // Last Modified By : 11 // Last Modified By : Andrew Beach 12 12 // Last Modified On : 13 13 // Update Count : … … 41 41 f(); 42 42 } 43 44 template<typename ret_t = void, typename func_t, typename... arg_t> 45 inline ret_t TimeCall( 46 const char *, func_t func, arg_t&&... arg) { 47 return func(std::forward<arg_t>(arg)...); 48 } 43 49 # else 44 50 void StartGlobal(); … … 59 65 func(); 60 66 } 67 68 template<typename ret_t = void, typename func_t, typename... arg_t> 69 inline ret_t TimeCall( 70 const char * name, func_t func, arg_t&&... arg) { 71 BlockGuard guard(name); 72 return func(std::forward<arg_t>(arg)...); 73 } 61 74 # endif 62 75 } -
src/Concurrency/Keywords.cc
raefb247 rbdfc032 716 716 new UntypedExpr( 717 717 new NameExpr( "__thrd_start" ), 718 { new VariableExpr( param ) }718 { new VariableExpr( param ), new NameExpr("main") } 719 719 ) 720 720 ) -
src/Concurrency/Waitfor.cc
raefb247 rbdfc032 11 11 // Last Modified By : 12 12 // Last Modified On : 13 // Update Count : 1 113 // Update Count : 12 14 14 // 15 15 … … 42 42 void foo() { 43 43 while( true ) { 44 when( a < 1 ) waitfor( f ,a ) { bar(); }44 when( a < 1 ) waitfor( f : a ) { bar(); } 45 45 or timeout( swagl() ); 46 or waitfor( g ,a ) { baz(); }47 or waitfor( ^?{} ,a ) { break; }46 or waitfor( g : a ) { baz(); } 47 or waitfor( ^?{} : a ) { break; } 48 48 or waitfor( ^?{} ) { break; } 49 49 } -
src/ControlStruct/LabelFixer.cc
raefb247 rbdfc032 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Mon Mar 11 22:26:02 201913 // Update Count : 1 5911 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Jan 21 10:32:00 2020 13 // Update Count : 160 14 14 // 15 15 … … 21 21 #include "ControlStruct/LabelGenerator.h" // for LabelGenerator 22 22 #include "LabelFixer.h" 23 #include "MLEMutator.h" // for M LEMutator23 #include "MLEMutator.h" // for MultiLevelExitMutator 24 24 #include "SynTree/Declaration.h" // for FunctionDecl 25 25 #include "SynTree/Expression.h" // for NameExpr, Expression, Unty... … … 44 44 45 45 void LabelFixer::postvisit( FunctionDecl * functionDecl ) { 46 PassVisitor<MLEMutator> mlemut( resolveJumps(), generator ); 47 functionDecl->acceptMutator( mlemut ); 46 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 ); 48 49 } 49 50 … … 75 76 76 77 77 // sets the definition of the labelTable entry to be the provided statement for every label in the list78 // parameter. Happens for every kind of statement78 // Sets the definition of the labelTable entry to be the provided statement for every label in 79 // the list parameter. Happens for every kind of statement. 79 80 Label LabelFixer::setLabelsDef( std::list< Label > & llabel, Statement * definition ) { 80 81 assert( definition != 0 ); 81 82 assert( llabel.size() > 0 ); 82 83 Entry * e = new Entry( definition );84 83 85 84 for ( std::list< Label >::iterator i = llabel.begin(); i != llabel.end(); i++ ) { … … 87 86 l.set_statement( definition ); // attach statement to the label to be used later 88 87 if ( labelTable.find( l ) == labelTable.end() ) { 89 // all labels on this statement need to use the same entry, so this should only be created once 88 // All labels on this statement need to use the same entry, 89 // so this should only be created once. 90 90 // undefined and unused until now, add an entry 91 labelTable[ l ] = e;91 labelTable[ l ] = new Entry( definition ); 92 92 } else if ( labelTable[ l ]->defined() ) { 93 93 // defined twice, error 94 SemanticError( l.get_statement()->location, "Duplicate definition of label: " + l.get_name() ); 95 } else { 94 SemanticError( l.get_statement()->location, 95 "Duplicate definition of label: " + l.get_name() ); 96 } else { 96 97 // used previously, but undefined until now -> link with this entry 98 // Question: Is changing objects important? 97 99 delete labelTable[ l ]; 98 labelTable[ l ] = e;100 labelTable[ l ] = new Entry( definition ); 99 101 } // if 100 102 } // for 101 103 102 // produce one of the labels attached to this statement to be temporarily used as the canonical label 104 // Produce one of the labels attached to this statement to be temporarily used as the 105 // canonical label. 103 106 return labelTable[ llabel.front() ]->get_label(); 104 107 } -
src/ControlStruct/MLEMutator.cc
raefb247 rbdfc032 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Tue Oct 22 17:22:44 201913 // Update Count : 22 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jan 22 11:50:00 2020 13 // Update Count : 223 14 14 // 15 15 … … 33 33 34 34 namespace ControlStruct { 35 M LEMutator::~MLEMutator() {35 MultiLevelExitMutator::~MultiLevelExitMutator() { 36 36 delete targetTable; 37 37 targetTable = 0; 38 38 } 39 39 namespace { 40 bool isLoop( const MLEMutator::Entry & e ) { return dynamic_cast< WhileStmt * >( e.get_controlStructure() ) || dynamic_cast< ForStmt * >( e.get_controlStructure() ); } 41 bool isSwitch( const MLEMutator::Entry & e ) { return dynamic_cast< SwitchStmt *>( e.get_controlStructure() ); } 42 43 bool isBreakTarget( const MLEMutator::Entry & e ) { return isLoop( e ) || isSwitch( e ) || dynamic_cast< CompoundStmt *>( e.get_controlStructure() ); } 44 bool isContinueTarget( const MLEMutator::Entry & e ) { return isLoop( e ); } 45 bool isFallthroughTarget( const MLEMutator::Entry & e ) { return dynamic_cast< CaseStmt *>( e.get_controlStructure() );; } 46 bool isFallthroughDefaultTarget( const MLEMutator::Entry & e ) { return isSwitch( e ); } 40 bool isLoop( const MultiLevelExitMutator::Entry & e ) { 41 return dynamic_cast< WhileStmt * >( e.get_controlStructure() ) 42 || dynamic_cast< ForStmt * >( e.get_controlStructure() ); 43 } 44 bool isSwitch( const MultiLevelExitMutator::Entry & e ) { 45 return dynamic_cast< SwitchStmt *>( e.get_controlStructure() ); 46 } 47 48 bool isBreakTarget( const MultiLevelExitMutator::Entry & e ) { 49 return isLoop( e ) || isSwitch( e ) 50 || dynamic_cast< CompoundStmt *>( e.get_controlStructure() ); 51 } 52 bool isContinueTarget( const MultiLevelExitMutator::Entry & e ) { 53 return isLoop( e ); 54 } 55 bool isFallthroughTarget( const MultiLevelExitMutator::Entry & e ) { 56 return dynamic_cast< CaseStmt *>( e.get_controlStructure() ); 57 } 58 bool isFallthroughDefaultTarget( const MultiLevelExitMutator::Entry & e ) { 59 return isSwitch( e ); 60 } 47 61 } // namespace 62 63 void MultiLevelExitMutator::premutate( FunctionDecl * ) { 64 visit_children = false; 65 } 48 66 49 67 // break labels have to come after the statement they break out of, so mutate a statement, then if they inform us 50 68 // through the breakLabel field tha they need a place to jump to on a break statement, add the break label to the 51 69 // body of statements 52 void M LEMutator::fixBlock( std::list< Statement * > &kids, bool caseClause ) {70 void MultiLevelExitMutator::fixBlock( std::list< Statement * > &kids, bool caseClause ) { 53 71 SemanticErrorException errors; 54 72 … … 81 99 } 82 100 83 void M LEMutator::premutate( CompoundStmt *cmpndStmt ) {101 void MultiLevelExitMutator::premutate( CompoundStmt *cmpndStmt ) { 84 102 visit_children = false; 85 103 bool labeledBlock = !(cmpndStmt->labels.empty()); … … 118 136 } 119 137 } 120 assertf( false, "Could not find label '%s' on statement %s", originalTarget.get_name().c_str(), toString( stmt ).c_str() ); 121 } 122 123 124 Statement *MLEMutator::postmutate( BranchStmt *branchStmt ) throw ( SemanticErrorException ) { 138 assertf( false, "Could not find label '%s' on statement %s", 139 originalTarget.get_name().c_str(), toString( stmt ).c_str() ); 140 } 141 142 143 Statement *MultiLevelExitMutator::postmutate( BranchStmt *branchStmt ) 144 throw ( SemanticErrorException ) { 125 145 std::string originalTarget = branchStmt->originalTarget; 126 146 … … 230 250 } 231 251 232 Statement *M LEMutator::mutateLoop( Statement *bodyLoop, Entry &e ) {252 Statement *MultiLevelExitMutator::mutateLoop( Statement *bodyLoop, Entry &e ) { 233 253 // only generate these when needed 234 254 if( !e.isContUsed() && !e.isBreakUsed() ) return bodyLoop; … … 253 273 254 274 template< typename LoopClass > 255 void M LEMutator::prehandleLoopStmt( LoopClass * loopStmt ) {275 void MultiLevelExitMutator::prehandleLoopStmt( LoopClass * loopStmt ) { 256 276 // remember this as the most recent enclosing loop, then mutate the body of the loop -- this will determine 257 277 // whether brkLabel and contLabel are used with branch statements and will recursively do the same to nested … … 264 284 265 285 template< typename LoopClass > 266 Statement * M LEMutator::posthandleLoopStmt( LoopClass * loopStmt ) {286 Statement * MultiLevelExitMutator::posthandleLoopStmt( LoopClass * loopStmt ) { 267 287 assert( ! enclosingControlStructures.empty() ); 268 288 Entry &e = enclosingControlStructures.back(); … … 275 295 } 276 296 277 void M LEMutator::premutate( WhileStmt * whileStmt ) {297 void MultiLevelExitMutator::premutate( WhileStmt * whileStmt ) { 278 298 return prehandleLoopStmt( whileStmt ); 279 299 } 280 300 281 void M LEMutator::premutate( ForStmt * forStmt ) {301 void MultiLevelExitMutator::premutate( ForStmt * forStmt ) { 282 302 return prehandleLoopStmt( forStmt ); 283 303 } 284 304 285 Statement * M LEMutator::postmutate( WhileStmt * whileStmt ) {305 Statement * MultiLevelExitMutator::postmutate( WhileStmt * whileStmt ) { 286 306 return posthandleLoopStmt( whileStmt ); 287 307 } 288 308 289 Statement * M LEMutator::postmutate( ForStmt * forStmt ) {309 Statement * MultiLevelExitMutator::postmutate( ForStmt * forStmt ) { 290 310 return posthandleLoopStmt( forStmt ); 291 311 } 292 312 293 void M LEMutator::premutate( IfStmt * ifStmt ) {313 void MultiLevelExitMutator::premutate( IfStmt * ifStmt ) { 294 314 // generate a label for breaking out of a labeled if 295 315 bool labeledBlock = !(ifStmt->get_labels().empty()); … … 301 321 } 302 322 303 Statement * M LEMutator::postmutate( IfStmt * ifStmt ) {323 Statement * MultiLevelExitMutator::postmutate( IfStmt * ifStmt ) { 304 324 bool labeledBlock = !(ifStmt->get_labels().empty()); 305 325 if ( labeledBlock ) { … … 311 331 } 312 332 313 void M LEMutator::premutate( TryStmt * tryStmt ) {333 void MultiLevelExitMutator::premutate( TryStmt * tryStmt ) { 314 334 // generate a label for breaking out of a labeled if 315 335 bool labeledBlock = !(tryStmt->get_labels().empty()); … … 321 341 } 322 342 323 Statement * M LEMutator::postmutate( TryStmt * tryStmt ) {343 Statement * MultiLevelExitMutator::postmutate( TryStmt * tryStmt ) { 324 344 bool labeledBlock = !(tryStmt->get_labels().empty()); 325 345 if ( labeledBlock ) { … … 331 351 } 332 352 333 void MLEMutator::premutate( CaseStmt *caseStmt ) { 353 void MultiLevelExitMutator::premutate( FinallyStmt * ) { 354 GuardAction([this, old = std::move(enclosingControlStructures)]() { 355 enclosingControlStructures = std::move(old); 356 }); 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 } 366 } 367 368 void MultiLevelExitMutator::premutate( CaseStmt *caseStmt ) { 334 369 visit_children = false; 335 370 … … 370 405 } 371 406 372 void M LEMutator::premutate( SwitchStmt *switchStmt ) {407 void MultiLevelExitMutator::premutate( SwitchStmt *switchStmt ) { 373 408 // generate a label for breaking out of a labeled switch 374 409 Label brkLabel = generator->newLabel("switchBreak", switchStmt); … … 396 431 } 397 432 398 Statement * M LEMutator::postmutate( SwitchStmt * switchStmt ) {433 Statement * MultiLevelExitMutator::postmutate( SwitchStmt * switchStmt ) { 399 434 Entry &e = enclosingControlStructures.back(); 400 435 assert ( e == switchStmt ); -
src/ControlStruct/MLEMutator.h
raefb247 rbdfc032 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Tue Oct 22 17:22:47 201913 // Update Count : 4 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jan 22 11:50:00 2020 13 // Update Count : 48 14 14 // 15 15 … … 30 30 class LabelGenerator; 31 31 32 class MLEMutator : public WithVisitorRef<MLEMutator>, public WithShortCircuiting, public WithGuards { 32 class MultiLevelExitMutator : public WithVisitorRef<MultiLevelExitMutator>, 33 public WithShortCircuiting, public WithGuards { 33 34 public: 34 35 class Entry; 35 MLEMutator( std::map<Label, Statement *> *t, LabelGenerator *gen = 0 ) : targetTable( t ), breakLabel(std::string("")), generator( gen ) {} 36 ~MLEMutator(); 36 MultiLevelExitMutator( std::map<Label, Statement *> *t, LabelGenerator *gen = 0 ) : 37 targetTable( t ), breakLabel(std::string("")), generator( gen ) {} 38 ~MultiLevelExitMutator(); 39 40 void premutate( FunctionDecl * ); 37 41 38 42 void premutate( CompoundStmt *cmpndStmt ); … … 47 51 void premutate( SwitchStmt *switchStmt ); 48 52 Statement * postmutate( SwitchStmt *switchStmt ); 53 void premutate( ReturnStmt *returnStmt ); 49 54 void premutate( TryStmt *tryStmt ); 50 55 Statement * postmutate( TryStmt *tryStmt ); 56 void premutate( FinallyStmt *finallyStmt ); 51 57 52 58 Statement *mutateLoop( Statement *bodyLoop, Entry &e ); … … 110 116 Label breakLabel; 111 117 LabelGenerator *generator; 118 bool inFinally = false; 112 119 113 120 template< typename LoopClass > -
src/Parser/lex.ll
raefb247 rbdfc032 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: remov