Changes in / [3d560060:dd9b59e]
- Location:
- src
- Files:
-
- 5 added
- 3 deleted
- 23 edited
-
ControlStruct/ExceptTranslate.cc (modified) (10 diffs)
-
ResolvExpr/Resolver.cc (modified) (1 diff)
-
driver/cfa.cc (modified) (1 diff)
-
libcfa/Makefile.am (modified) (2 diffs)
-
libcfa/Makefile.in (modified) (16 diffs)
-
libcfa/assert.c (modified) (3 diffs)
-
libcfa/bits/align.h (deleted)
-
libcfa/bits/containers.h (modified) (1 diff)
-
libcfa/bits/debug.c (deleted)
-
libcfa/bits/debug.h (deleted)
-
libcfa/bits/defs.h (modified) (1 diff)
-
libcfa/bits/locks.h (modified) (5 diffs)
-
libcfa/concurrency/alarm.c (modified) (5 diffs)
-
libcfa/concurrency/coroutine.c (modified) (4 diffs)
-
libcfa/concurrency/invoke.c (modified) (4 diffs)
-
libcfa/concurrency/kernel.c (modified) (27 diffs)
-
libcfa/concurrency/kernel_private.h (modified) (3 diffs)
-
libcfa/concurrency/monitor.c (modified) (37 diffs)
-
libcfa/concurrency/preemption.c (modified) (16 diffs)
-
libcfa/concurrency/thread.c (modified) (3 diffs)
-
libcfa/exception.c (modified) (22 diffs)
-
libcfa/exception.h (modified) (2 diffs)
-
libcfa/interpose.c (modified) (3 diffs)
-
libcfa/libhdr.h (added)
-
libcfa/libhdr/libalign.h (added)
-
libcfa/libhdr/libdebug.c (added)
-
libcfa/libhdr/libdebug.h (added)
-
libcfa/libhdr/libtools.h (added)
-
libcfa/stdhdr/assert.h (modified) (1 diff)
-
prelude/builtins.c (modified) (2 diffs)
-
tests/except-mac.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/ExceptTranslate.cc
r3d560060 rdd9b59e 211 211 ThrowStmt *throwStmt ) { 212 212 // __throw_terminate( `throwStmt->get_name()` ); } 213 return create_given_throw( "__cfa abi_ehm__throw_terminate", throwStmt );213 return create_given_throw( "__cfaehm__throw_terminate", throwStmt ); 214 214 } 215 215 … … 232 232 result->push_back( new ExprStmt( 233 233 noLabels, 234 new UntypedExpr( new NameExpr( "__cfa abi_ehm__rethrow_terminate" ) )234 new UntypedExpr( new NameExpr( "__cfaehm__rethrow_terminate" ) ) 235 235 ) ); 236 236 delete throwStmt; … … 241 241 ThrowStmt *throwStmt ) { 242 242 // __throw_resume( `throwStmt->get_name` ); 243 return create_given_throw( "__cfa abi_ehm__throw_resume", throwStmt );243 return create_given_throw( "__cfaehm__throw_resume", throwStmt ); 244 244 } 245 245 … … 309 309 local_except->get_attributes().push_back( new Attribute( 310 310 "cleanup", 311 { new NameExpr( "__cfa abi_ehm__cleanup_terminate" ) }311 { new NameExpr( "__cfaehm__cleanup_terminate" ) } 312 312 ) ); 313 313 … … 432 432 FunctionDecl * terminate_catch, 433 433 FunctionDecl * terminate_match ) { 434 // { __cfa abi_ehm__try_terminate(`try`, `catch`, `match`); }434 // { __cfaehm__try_terminate(`try`, `catch`, `match`); } 435 435 436 436 UntypedExpr * caller = new UntypedExpr( new NameExpr( 437 "__cfa abi_ehm__try_terminate" ) );437 "__cfaehm__try_terminate" ) ); 438 438 std::list<Expression *>& args = caller->get_args(); 439 439 args.push_back( nameOf( try_wrapper ) ); … … 489 489 490 490 // struct __try_resume_node __resume_node 491 // __attribute__((cleanup( __cfa abi_ehm__try_resume_cleanup )));491 // __attribute__((cleanup( __cfaehm__try_resume_cleanup ))); 492 492 // ** unwinding of the stack here could cause problems ** 493 493 // ** however I don't think that can happen currently ** 494 // __cfa abi_ehm__try_resume_setup( &__resume_node, resume_handler );494 // __cfaehm__try_resume_setup( &__resume_node, resume_handler ); 495 495 496 496 std::list< Attribute * > attributes; … … 498 498 std::list< Expression * > attr_params; 499 499 attr_params.push_back( new NameExpr( 500 "__cfa abi_ehm__try_resume_cleanup" ) );500 "__cfaehm__try_resume_cleanup" ) ); 501 501 attributes.push_back( new Attribute( "cleanup", attr_params ) ); 502 502 } … … 517 517 518 518 UntypedExpr *setup = new UntypedExpr( new NameExpr( 519 "__cfa abi_ehm__try_resume_setup" ) );519 "__cfaehm__try_resume_setup" ) ); 520 520 setup->get_args().push_back( new AddressExpr( nameOf( obj ) ) ); 521 521 setup->get_args().push_back( nameOf( resume_handler ) ); … … 542 542 ObjectDecl * ExceptionMutatorCore::create_finally_hook( 543 543 FunctionDecl * finally_wrapper ) { 544 // struct __cfa abi_ehm__cleanup_hook __finally_hook544 // struct __cfaehm__cleanup_hook __finally_hook 545 545 // __attribute__((cleanup( finally_wrapper ))); 546 546 … … 596 596 // Skip children? 597 597 return; 598 } else if ( structDecl->get_name() == "__cfa abi_ehm__base_exception_t" ) {598 } else if ( structDecl->get_name() == "__cfaehm__base_exception_t" ) { 599 599 assert( nullptr == except_decl ); 600 600 except_decl = structDecl; 601 601 init_func_types(); 602 } else if ( structDecl->get_name() == "__cfa abi_ehm__try_resume_node" ) {602 } else if ( structDecl->get_name() == "__cfaehm__try_resume_node" ) { 603 603 assert( nullptr == node_decl ); 604 604 node_decl = structDecl; 605 } else if ( structDecl->get_name() == "__cfa abi_ehm__cleanup_hook" ) {605 } else if ( structDecl->get_name() == "__cfaehm__cleanup_hook" ) { 606 606 assert( nullptr == hook_decl ); 607 607 hook_decl = structDecl; -
src/ResolvExpr/Resolver.cc
r3d560060 rdd9b59e 369 369 if ( throwStmt->get_expr() ) { 370 370 StructDecl * exception_decl = 371 indexer.lookupStruct( "__cfa abi_ehm__base_exception_t" );371 indexer.lookupStruct( "__cfaehm__base_exception_t" ); 372 372 assert( exception_decl ); 373 373 Type * exceptType = new PointerType( noQualifiers, new StructInstType( noQualifiers, exception_decl ) ); -
src/driver/cfa.cc
r3d560060 rdd9b59e 275 275 args[nargs] = "-Xlinker"; 276 276 nargs += 1; 277 args[nargs] = "--undefined=__ cfaabi_dbg_bits_write";277 args[nargs] = "--undefined=__lib_debug_write"; 278 278 nargs += 1; 279 279 -
src/libcfa/Makefile.am
r3d560060 rdd9b59e 55 55 56 56 libobjs = ${headers:=.o} 57 libsrc = libcfa-prelude.c interpose.c bits/debug.c ${headers:=.c} \57 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \ 58 58 assert.c exception.c virtual.c 59 59 … … 100 100 math \ 101 101 gmp \ 102 bits/align.h \103 102 bits/containers.h \ 104 103 bits/defs.h \ 105 bits/debug.h \106 104 bits/locks.h \ 107 concurrency/invoke.h 105 concurrency/invoke.h \ 106 libhdr.h \ 107 libhdr/libalign.h \ 108 libhdr/libdebug.h \ 109 libhdr/libtools.h 108 110 109 111 CLEANFILES = libcfa-prelude.c -
src/libcfa/Makefile.in
r3d560060 rdd9b59e 149 149 libcfa_d_a_LIBADD = 150 150 am__libcfa_d_a_SOURCES_DIST = libcfa-prelude.c interpose.c \ 151 bits/debug.c fstream.c iostream.c iterator.c limits.c \151 libhdr/libdebug.c fstream.c iostream.c iterator.c limits.c \ 152 152 rational.c stdlib.c containers/maybe.c containers/pair.c \ 153 153 containers/result.c containers/vector.c \ … … 175 175 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_d_a-preemption.$(OBJEXT) 176 176 am__objects_4 = libcfa_d_a-libcfa-prelude.$(OBJEXT) \ 177 libcfa_d_a-interpose.$(OBJEXT) bits/libcfa_d_a-debug.$(OBJEXT)\178 $(am__objects_2) libcfa_d_a-assert.$(OBJEXT) \179 libcfa_d_a- exception.$(OBJEXT) libcfa_d_a-virtual.$(OBJEXT) \180 $(am__objects_3)177 libcfa_d_a-interpose.$(OBJEXT) \ 178 libhdr/libcfa_d_a-libdebug.$(OBJEXT) $(am__objects_2) \ 179 libcfa_d_a-assert.$(OBJEXT) libcfa_d_a-exception.$(OBJEXT) \ 180 libcfa_d_a-virtual.$(OBJEXT) $(am__objects_3) 181 181 am_libcfa_d_a_OBJECTS = $(am__objects_4) 182 182 libcfa_d_a_OBJECTS = $(am_libcfa_d_a_OBJECTS) 183 183 libcfa_a_AR = $(AR) $(ARFLAGS) 184 184 libcfa_a_LIBADD = 185 am__libcfa_a_SOURCES_DIST = libcfa-prelude.c interpose.c bits/debug.c \ 186 fstream.c iostream.c iterator.c limits.c rational.c stdlib.c \ 187 containers/maybe.c containers/pair.c containers/result.c \ 188 containers/vector.c concurrency/coroutine.c \ 189 concurrency/thread.c concurrency/kernel.c \ 190 concurrency/monitor.c assert.c exception.c virtual.c \ 191 concurrency/CtxSwitch-@MACHINE_TYPE@.S concurrency/alarm.c \ 192 concurrency/invoke.c concurrency/preemption.c 185 am__libcfa_a_SOURCES_DIST = libcfa-prelude.c interpose.c \ 186 libhdr/libdebug.c fstream.c iostream.c iterator.c limits.c \ 187 rational.c stdlib.c containers/maybe.c containers/pair.c \ 188 containers/result.c containers/vector.c \ 189 concurrency/coroutine.c concurrency/thread.c \ 190 concurrency/kernel.c concurrency/monitor.c assert.c \ 191 exception.c virtual.c concurrency/CtxSwitch-@MACHINE_TYPE@.S \ 192 concurrency/alarm.c concurrency/invoke.c \ 193 concurrency/preemption.c 193 194 @BUILD_CONCURRENCY_TRUE@am__objects_5 = concurrency/libcfa_a-coroutine.$(OBJEXT) \ 194 195 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-thread.$(OBJEXT) \ … … 207 208 @BUILD_CONCURRENCY_TRUE@ concurrency/libcfa_a-preemption.$(OBJEXT) 208 209 am__objects_8 = libcfa_a-libcfa-prelude.$(OBJEXT) \ 209 libcfa_a-interpose.$(OBJEXT) bits/libcfa_a-debug.$(OBJEXT)\210 $(am__objects_6) libcfa_a-assert.$(OBJEXT) \211 libcfa_a- exception.$(OBJEXT) libcfa_a-virtual.$(OBJEXT) \212 $(am__objects_7)210 libcfa_a-interpose.$(OBJEXT) \ 211 libhdr/libcfa_a-libdebug.$(OBJEXT) $(am__objects_6) \ 212 libcfa_a-assert.$(OBJEXT) libcfa_a-exception.$(OBJEXT) \ 213 libcfa_a-virtual.$(OBJEXT) $(am__objects_7) 213 214 am_libcfa_a_OBJECTS = $(am__objects_8) 214 215 libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS) … … 263 264 containers/result containers/vector concurrency/coroutine \ 264 265 concurrency/thread concurrency/kernel concurrency/monitor \ 265 ${shell echo stdhdr/*} math gmp bits/align.h bits/containers.h \ 266 bits/defs.h bits/debug.h bits/locks.h concurrency/invoke.h 266 ${shell echo stdhdr/*} math gmp bits/containers.h bits/defs.h \ 267 bits/locks.h concurrency/invoke.h libhdr.h libhdr/libalign.h \ 268 libhdr/libdebug.h libhdr/libtools.h 267 269 HEADERS = $(nobase_cfa_include_HEADERS) 268 270 am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) … … 422 424 containers/vector $(am__append_3) 423 425 libobjs = ${headers:=.o} 424 libsrc = libcfa-prelude.c interpose.c bits/debug.c ${headers:=.c} \426 libsrc = libcfa-prelude.c interpose.c libhdr/libdebug.c ${headers:=.c} \ 425 427 assert.c exception.c virtual.c $(am__append_4) 426 428 libcfa_a_SOURCES = ${libsrc} … … 435 437 math \ 436 438 gmp \ 437 bits/align.h \438 439 bits/containers.h \ 439 440 bits/defs.h \ 440 bits/debug.h \441 441 bits/locks.h \ 442 concurrency/invoke.h 442 concurrency/invoke.h \ 443 libhdr.h \ 444 libhdr/libalign.h \ 445 libhdr/libdebug.h \ 446 libhdr/libtools.h 443 447 444 448 CLEANFILES = libcfa-prelude.c … … 507 511 clean-libLIBRARIES: 508 512 -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES) 509 bits/$(am__dirstamp):510 @$(MKDIR_P) bits511 @: > bits/$(am__dirstamp)512 bits/$(DEPDIR)/$(am__dirstamp):513 @$(MKDIR_P) bits/$(DEPDIR)514 @: > bits/$(DEPDIR)/$(am__dirstamp)515 bits/libcfa_d_a-debug.$(OBJEXT): bits/$(am__dirstamp) \516 bits/$(DEPDIR)/$(am__dirstamp)513 libhdr/$(am__dirstamp): 514 @$(MKDIR_P) libhdr 515 @: > libhdr/$(am__dirstamp) 516 libhdr/$(DEPDIR)/$(am__dirstamp): 517 @$(MKDIR_P) libhdr/$(DEPDIR) 518 @: > libhdr/$(DEPDIR)/$(am__dirstamp) 519 libhdr/libcfa_d_a-libdebug.$(OBJEXT): libhdr/$(am__dirstamp) \ 520 libhdr/$(DEPDIR)/$(am__dirstamp) 517 521 containers/$(am__dirstamp): 518 522 @$(MKDIR_P) containers … … 559 563 $(AM_V_AR)$(libcfa_d_a_AR) libcfa-d.a $(libcfa_d_a_OBJECTS) $(libcfa_d_a_LIBADD) 560 564 $(AM_V_at)$(RANLIB) libcfa-d.a 561 bits/libcfa_a-debug.$(OBJEXT): bits/$(am__dirstamp) \562 bits/$(DEPDIR)/$(am__dirstamp)565 libhdr/libcfa_a-libdebug.$(OBJEXT): libhdr/$(am__dirstamp) \ 566 libhdr/$(DEPDIR)/$(am__dirstamp) 563 567 containers/libcfa_a-maybe.$(OBJEXT): containers/$(am__dirstamp) \ 564 568 containers/$(DEPDIR)/$(am__dirstamp) … … 592 596 mostlyclean-compile: 593 597 -rm -f *.$(OBJEXT) 594 -rm -f bits/*.$(OBJEXT)595 598 -rm -f concurrency/*.$(OBJEXT) 596 599 -rm -f containers/*.$(OBJEXT) 600 -rm -f libhdr/*.$(OBJEXT) 597 601 598 602 distclean-compile: … … 621 625 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-stdlib.Po@am__quote@ 622 626 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa_d_a-virtual.Po@am__quote@ 623 @AMDEP_TRUE@@am__include@ @am__quote@bits/$(DEPDIR)/libcfa_a-debug.Po@am__quote@624 @AMDEP_TRUE@@am__include@ @am__quote@bits/$(DEPDIR)/libcfa_d_a-debug.Po@am__quote@625 627 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/CtxSwitch-@MACHINE_TYPE@.Po@am__quote@ 626 628 @AMDEP_TRUE@@am__include@ @am__quote@concurrency/$(DEPDIR)/libcfa_a-alarm.Po@am__quote@ … … 646 648 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-result.Po@am__quote@ 647 649 @AMDEP_TRUE@@am__include@ @am__quote@containers/$(DEPDIR)/libcfa_d_a-vector.Po@am__quote@ 650 @AMDEP_TRUE@@am__include@ @am__quote@libhdr/$(DEPDIR)/libcfa_a-libdebug.Po@am__quote@ 651 @AMDEP_TRUE@@am__include@ @am__quote@libhdr/$(DEPDIR)/libcfa_d_a-libdebug.Po@am__quote@ 648 652 649 653 .S.o: … … 700 704 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libcfa_d_a-interpose.obj `if test -f 'interpose.c'; then $(CYGPATH_W) 'interpose.c'; else $(CYGPATH_W) '$(srcdir)/interpose.c'; fi` 701 705 702 bits/libcfa_d_a-debug.o: bits/debug.c703 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT bits/libcfa_d_a-debug.o -MD -MP -MF bits/$(DEPDIR)/libcfa_d_a-debug.Tpo -c -o bits/libcfa_d_a-debug.o `test -f 'bits/debug.c' || echo '$(srcdir)/'`bits/debug.c704 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) bits/$(DEPDIR)/libcfa_d_a-debug.Tpo bits/$(DEPDIR)/libcfa_d_a-debug.Po705 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source=' bits/debug.c' object='bits/libcfa_d_a-debug.o' libtool=no @AMDEPBACKSLASH@706 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 707 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o bits/libcfa_d_a-debug.o `test -f 'bits/debug.c' || echo '$(srcdir)/'`bits/debug.c708 709 bits/libcfa_d_a-debug.obj: bits/debug.c710 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT bits/libcfa_d_a-debug.obj -MD -MP -MF bits/$(DEPDIR)/libcfa_d_a-debug.Tpo -c -o bits/libcfa_d_a-debug.obj `if test -f 'bits/debug.c'; then $(CYGPATH_W) 'bits/debug.c'; else $(CYGPATH_W) '$(srcdir)/bits/debug.c'; fi`711 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) bits/$(DEPDIR)/libcfa_d_a-debug.Tpo bits/$(DEPDIR)/libcfa_d_a-debug.Po712 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source=' bits/debug.c' object='bits/libcfa_d_a-debug.obj' libtool=no @AMDEPBACKSLASH@713 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 714 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o bits/libcfa_d_a-debug.obj `if test -f 'bits/debug.c'; then $(CYGPATH_W) 'bits/debug.c'; else $(CYGPATH_W) '$(srcdir)/bits/debug.c'; fi`706 libhdr/libcfa_d_a-libdebug.o: libhdr/libdebug.c 707 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libhdr/libcfa_d_a-libdebug.o -MD -MP -MF libhdr/$(DEPDIR)/libcfa_d_a-libdebug.Tpo -c -o libhdr/libcfa_d_a-libdebug.o `test -f 'libhdr/libdebug.c' || echo '$(srcdir)/'`libhdr/libdebug.c 708 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libhdr/$(DEPDIR)/libcfa_d_a-libdebug.Tpo libhdr/$(DEPDIR)/libcfa_d_a-libdebug.Po 709 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libhdr/libdebug.c' object='libhdr/libcfa_d_a-libdebug.o' libtool=no @AMDEPBACKSLASH@ 710 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 711 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libhdr/libcfa_d_a-libdebug.o `test -f 'libhdr/libdebug.c' || echo '$(srcdir)/'`libhdr/libdebug.c 712 713 libhdr/libcfa_d_a-libdebug.obj: libhdr/libdebug.c 714 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -MT libhdr/libcfa_d_a-libdebug.obj -MD -MP -MF libhdr/$(DEPDIR)/libcfa_d_a-libdebug.Tpo -c -o libhdr/libcfa_d_a-libdebug.obj `if test -f 'libhdr/libdebug.c'; then $(CYGPATH_W) 'libhdr/libdebug.c'; else $(CYGPATH_W) '$(srcdir)/libhdr/libdebug.c'; fi` 715 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libhdr/$(DEPDIR)/libcfa_d_a-libdebug.Tpo libhdr/$(DEPDIR)/libcfa_d_a-libdebug.Po 716 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libhdr/libdebug.c' object='libhdr/libcfa_d_a-libdebug.obj' libtool=no @AMDEPBACKSLASH@ 717 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 718 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_d_a_CFLAGS) $(CFLAGS) -c -o libhdr/libcfa_d_a-libdebug.obj `if test -f 'libhdr/libdebug.c'; then $(CYGPATH_W) 'libhdr/libdebug.c'; else $(CYGPATH_W) '$(srcdir)/libhdr/libdebug.c'; fi` 715 719 716 720 libcfa_d_a-fstream.o: fstream.c … … 994 998 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libcfa_a-interpose.obj `if test -f 'interpose.c'; then $(CYGPATH_W) 'interpose.c'; else $(CYGPATH_W) '$(srcdir)/interpose.c'; fi` 995 999 996 bits/libcfa_a-debug.o: bits/debug.c997 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT bits/libcfa_a-debug.o -MD -MP -MF bits/$(DEPDIR)/libcfa_a-debug.Tpo -c -o bits/libcfa_a-debug.o `test -f 'bits/debug.c' || echo '$(srcdir)/'`bits/debug.c998 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) bits/$(DEPDIR)/libcfa_a-debug.Tpo bits/$(DEPDIR)/libcfa_a-debug.Po999 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source=' bits/debug.c' object='bits/libcfa_a-debug.o' libtool=no @AMDEPBACKSLASH@1000 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1001 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o bits/libcfa_a-debug.o `test -f 'bits/debug.c' || echo '$(srcdir)/'`bits/debug.c1002 1003 bits/libcfa_a-debug.obj: bits/debug.c1004 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT bits/libcfa_a-debug.obj -MD -MP -MF bits/$(DEPDIR)/libcfa_a-debug.Tpo -c -o bits/libcfa_a-debug.obj `if test -f 'bits/debug.c'; then $(CYGPATH_W) 'bits/debug.c'; else $(CYGPATH_W) '$(srcdir)/bits/debug.c'; fi`1005 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) bits/$(DEPDIR)/libcfa_a-debug.Tpo bits/$(DEPDIR)/libcfa_a-debug.Po1006 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source=' bits/debug.c' object='bits/libcfa_a-debug.obj' libtool=no @AMDEPBACKSLASH@1007 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1008 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o bits/libcfa_a-debug.obj `if test -f 'bits/debug.c'; then $(CYGPATH_W) 'bits/debug.c'; else $(CYGPATH_W) '$(srcdir)/bits/debug.c'; fi`1000 libhdr/libcfa_a-libdebug.o: libhdr/libdebug.c 1001 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libhdr/libcfa_a-libdebug.o -MD -MP -MF libhdr/$(DEPDIR)/libcfa_a-libdebug.Tpo -c -o libhdr/libcfa_a-libdebug.o `test -f 'libhdr/libdebug.c' || echo '$(srcdir)/'`libhdr/libdebug.c 1002 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libhdr/$(DEPDIR)/libcfa_a-libdebug.Tpo libhdr/$(DEPDIR)/libcfa_a-libdebug.Po 1003 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libhdr/libdebug.c' object='libhdr/libcfa_a-libdebug.o' libtool=no @AMDEPBACKSLASH@ 1004 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1005 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libhdr/libcfa_a-libdebug.o `test -f 'libhdr/libdebug.c' || echo '$(srcdir)/'`libhdr/libdebug.c 1006 1007 libhdr/libcfa_a-libdebug.obj: libhdr/libdebug.c 1008 @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -MT libhdr/libcfa_a-libdebug.obj -MD -MP -MF libhdr/$(DEPDIR)/libcfa_a-libdebug.Tpo -c -o libhdr/libcfa_a-libdebug.obj `if test -f 'libhdr/libdebug.c'; then $(CYGPATH_W) 'libhdr/libdebug.c'; else $(CYGPATH_W) '$(srcdir)/libhdr/libdebug.c'; fi` 1009 @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libhdr/$(DEPDIR)/libcfa_a-libdebug.Tpo libhdr/$(DEPDIR)/libcfa_a-libdebug.Po 1010 @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libhdr/libdebug.c' object='libhdr/libcfa_a-libdebug.obj' libtool=no @AMDEPBACKSLASH@ 1011 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1012 @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcfa_a_CFLAGS) $(CFLAGS) -c -o libhdr/libcfa_a-libdebug.obj `if test -f 'libhdr/libdebug.c'; then $(CYGPATH_W) 'libhdr/libdebug.c'; else $(CYGPATH_W) '$(srcdir)/libhdr/libdebug.c'; fi` 1009 1013 1010 1014 libcfa_a-fstream.o: fstream.c … … 1407 1411 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 1408 1412 -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 1409 -rm -f bits/$(DEPDIR)/$(am__dirstamp)1410 -rm -f bits/$(am__dirstamp)1411 1413 -rm -f concurrency/$(DEPDIR)/$(am__dirstamp) 1412 1414 -rm -f concurrency/$(am__dirstamp) 1413 1415 -rm -f containers/$(DEPDIR)/$(am__dirstamp) 1414 1416 -rm -f containers/$(am__dirstamp) 1417 -rm -f libhdr/$(DEPDIR)/$(am__dirstamp) 1418 -rm -f libhdr/$(am__dirstamp) 1415 1419 1416 1420 maintainer-clean-generic: … … 1422 1426 1423 1427 distclean: distclean-am 1424 -rm -rf ./$(DEPDIR) bits/$(DEPDIR) concurrency/$(DEPDIR) containers/$(DEPDIR)1428 -rm -rf ./$(DEPDIR) concurrency/$(DEPDIR) containers/$(DEPDIR) libhdr/$(DEPDIR) 1425 1429 -rm -f Makefile 1426 1430 distclean-am: clean-am distclean-compile distclean-generic \ … … 1468 1472 1469 1473 maintainer-clean: maintainer-clean-am 1470 -rm -rf ./$(DEPDIR) bits/$(DEPDIR) concurrency/$(DEPDIR) containers/$(DEPDIR)1474 -rm -rf ./$(DEPDIR) concurrency/$(DEPDIR) containers/$(DEPDIR) libhdr/$(DEPDIR) 1471 1475 -rm -f Makefile 1472 1476 maintainer-clean-am: distclean-am maintainer-clean-generic \ -
src/libcfa/assert.c
r3d560060 rdd9b59e 17 17 #include <stdarg.h> // varargs 18 18 #include <stdio.h> // fprintf 19 #include " bits/debug.h"19 #include "libhdr/libdebug.h" 20 20 21 21 extern "C" { … … 26 26 // called by macro assert in assert.h 27 27 void __assert_fail( const char *assertion, const char *file, unsigned int line, const char *function ) { 28 __ cfaabi_dbg_bits_print_safe( CFA_ASSERT_FMT ".\n", __progname, function, line, file );28 __lib_debug_print_safe( CFA_ASSERT_FMT ".\n", __progname, function, line, file ); 29 29 abort(); 30 30 } … … 32 32 // called by macro assertf 33 33 void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) { 34 __ cfaabi_dbg_bits_acquire();35 __ cfaabi_dbg_bits_print_nolock( CFA_ASSERT_FMT ": ", __progname, function, line, file );34 __lib_debug_acquire(); 35 __lib_debug_print_nolock( CFA_ASSERT_FMT ": ", __progname, function, line, file ); 36 36 37 37 va_list args; 38 38 va_start( args, fmt ); 39 __ cfaabi_dbg_bits_print_vararg( fmt, args );39 __lib_debug_print_vararg( fmt, args ); 40 40 va_end( args ); 41 41 42 __ cfaabi_dbg_bits_print_nolock( "\n" );43 __ cfaabi_dbg_bits_release();42 __lib_debug_print_nolock( "\n" ); 43 __lib_debug_release(); 44 44 abort(); 45 45 } -
src/libcfa/bits/containers.h
r3d560060 rdd9b59e 15 15 #pragma once 16 16 17 #include "bits/align.h"18 17 #include "bits/defs.h" 18 #include "libhdr.h" 19 19 20 20 //----------------------------------------------------------------------------- -
src/libcfa/bits/defs.h
r3d560060 rdd9b59e 32 32 #define __cfa_anonymous_object __cfa_anonymous_object 33 33 #endif 34 35 #ifdef __cforall36 extern "C" {37 #endif38 void abortf( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__));39 #ifdef __cforall40 }41 #endif -
src/libcfa/bits/locks.h
r3d560060 rdd9b59e 16 16 #pragma once 17 17 18 #include "bits/debug.h"19 18 #include "bits/defs.h" 19 20 #include "libhdr.h" 20 21 21 22 // pause to prevent excess processor bus usage … … 64 65 65 66 // Lock the spinlock, return false if already acquired 66 static inline _Bool try_lock ( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {67 static inline _Bool try_lock ( __spinlock_t & this DEBUG_CTX_PARAM2 ) { 67 68 _Bool result = __lock_test_and_test_and_set( this.lock ); 68 __cfaabi_dbg_debug_do(69 LIB_DEBUG_DO( 69 70 if( result ) { 70 71 this.prev_name = caller; … … 76 77 77 78 // Lock the spinlock, spin if already acquired 78 static inline void lock( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {79 static inline void lock( __spinlock_t & this DEBUG_CTX_PARAM2 ) { 79 80 #ifndef NOEXPBACK 80 81 enum { SPIN_START = 4, SPIN_END = 64 * 1024, }; … … 97 98 #endif 98 99 } 99 __cfaabi_dbg_debug_do(100 LIB_DEBUG_DO( 100 101 this.prev_name = caller; 101 102 this.prev_thrd = this_thread; … … 104 105 105 106 // Lock the spinlock, spin if already acquired 106 static inline void lock_yield( __spinlock_t & this __cfaabi_dbg_ctx_param2 ) {107 static inline void lock_yield( __spinlock_t & this DEBUG_CTX_PARAM2 ) { 107 108 for ( unsigned int i = 1;; i += 1 ) { 108 109 if ( __lock_test_and_test_and_set( this.lock ) ) break; 109 110 yield( i ); 110 111 } 111 __cfaabi_dbg_debug_do(112 LIB_DEBUG_DO( 112 113 this.prev_name = caller; 113 114 this.prev_thrd = this_thread; -
src/libcfa/concurrency/alarm.c
r3d560060 rdd9b59e 23 23 } 24 24 25 #include "libhdr.h" 26 25 27 #include "alarm.h" 26 28 #include "kernel_private.h" … … 108 110 } 109 111 110 __cfaabi_dbg_debug_do( bool validate( alarm_list_t * this ) {112 LIB_DEBUG_DO( bool validate( alarm_list_t * this ) { 111 113 alarm_node_t ** it = &this->head; 112 114 while( (*it) ) { … … 184 186 185 187 disable_interrupts(); 186 lock( event_kernel->lock __cfaabi_dbg_ctx2 );188 lock( event_kernel->lock DEBUG_CTX2 ); 187 189 { 188 190 verify( validate( alarms ) ); … … 196 198 unlock( event_kernel->lock ); 197 199 this->set = true; 198 enable_interrupts( __cfaabi_dbg_ctx);200 enable_interrupts( DEBUG_CTX ); 199 201 } 200 202 201 203 void unregister_self( alarm_node_t * this ) { 202 204 disable_interrupts(); 203 lock( event_kernel->lock __cfaabi_dbg_ctx2 );205 lock( event_kernel->lock DEBUG_CTX2 ); 204 206 { 205 207 verify( validate( &event_kernel->alarms ) ); … … 207 209 } 208 210 unlock( event_kernel->lock ); 209 enable_interrupts( __cfaabi_dbg_ctx);211 enable_interrupts( DEBUG_CTX ); 210 212 this->set = false; 211 213 } -
src/libcfa/concurrency/coroutine.c
r3d560060 rdd9b59e 29 29 #define __CFA_INVOKE_PRIVATE__ 30 30 #include "invoke.h" 31 31 32 32 33 //----------------------------------------------------------------------------- … … 75 76 void ^?{}(coStack_t & this) { 76 77 if ( ! this.userStack && this.storage ) { 77 __cfaabi_dbg_debug_do(78 LIB_DEBUG_DO( 78 79 if ( mprotect( this.storage, pageSize, PROT_READ | PROT_WRITE ) == -1 ) { 79 80 abortf( "(coStack_t *)%p.^?{}() : internal error, mprotect failure, error(%d) %s.", &this, errno, strerror( errno ) ); … … 130 131 131 132 // assume malloc has 8 byte alignment so add 8 to allow rounding up to 16 byte alignment 132 __cfaabi_dbg_debug_do( this->storage = memalign( pageSize, cxtSize + this->size + pageSize ) );133 __cfaabi_dbg_no_debug_do( this->storage = malloc( cxtSize + this->size + 8 ) );133 LIB_DEBUG_DO( this->storage = memalign( pageSize, cxtSize + this->size + pageSize ) ); 134 LIB_NO_DEBUG_DO( this->storage = malloc( cxtSize + this->size + 8 ) ); 134 135 135 __cfaabi_dbg_debug_do(136 LIB_DEBUG_DO( 136 137 if ( mprotect( this->storage, pageSize, PROT_NONE ) == -1 ) { 137 138 abortf( "(uMachContext &)%p.createContext() : internal error, mprotect failure, error(%d) %s.", this, (int)errno, strerror( (int)errno ) ); … … 143 144 } // if 144 145 145 __cfaabi_dbg_debug_do( this->limit = (char *)this->storage + pageSize );146 __cfaabi_dbg_no_debug_do( this->limit = (char *)libCeiling( (unsigned long)this->storage, 16 ) ); // minimum alignment146 LIB_DEBUG_DO( this->limit = (char *)this->storage + pageSize ); 147 LIB_NO_DEBUG_DO( this->limit = (char *)libCeiling( (unsigned long)this->storage, 16 ) ); // minimum alignment 147 148 148 149 } else { -
src/libcfa/concurrency/invoke.c
r3d560060 rdd9b59e 18 18 #include <stdio.h> 19 19 20 #include "libhdr.h" 20 21 #include "invoke.h" 21 22 … … 30 31 extern void __leave_thread_monitor( struct thread_desc * this ); 31 32 extern void disable_interrupts(); 32 extern void enable_interrupts( __cfaabi_dbg_ctx_param);33 extern void enable_interrupts( DEBUG_CTX_PARAM ); 33 34 34 35 void CtxInvokeCoroutine( 35 void (*main)(void *),36 struct coroutine_desc *(*get_coroutine)(void *),37 void *this36 void (*main)(void *), 37 struct coroutine_desc *(*get_coroutine)(void *), 38 void *this 38 39 ) { 39 struct coroutine_desc* cor = get_coroutine( this);40 // LIB_DEBUG_PRINTF("Invoke Coroutine : Received %p (main %p, get_c %p)\n", this, main, get_coroutine); 40 41 41 if(cor->state == Primed) { 42 __suspend_internal(); 43 } 42 struct coroutine_desc* cor = get_coroutine( this ); 44 43 45 cor->state = Active; 44 if(cor->state == Primed) { 45 __suspend_internal(); 46 } 46 47 47 main( this );48 cor->state = Active; 48 49 49 cor->state = Halted;50 main( this ); 50 51 51 //Final suspend, should never return 52 __leave_coroutine(); 53 abortf("Resumed dead coroutine"); 52 cor->state = Halted; 53 54 //Final suspend, should never return 55 __leave_coroutine(); 56 abortf("Resumed dead coroutine"); 54 57 } 55 58 56 59 void CtxInvokeThread( 57 void (*dtor)(void *),58 void (*main)(void *),59 struct thread_desc *(*get_thread)(void *),60 void *this60 void (*dtor)(void *), 61 void (*main)(void *), 62 struct thread_desc *(*get_thread)(void *), 63 void *this 61 64 ) { 62 // First suspend, once the thread arrives here,63 // the function pointer to main can be invalidated without risk64 __suspend_internal();65 // First suspend, once the thread arrives here, 66 // the function pointer to main can be invalidated without risk 67 __suspend_internal(); 65 68 66 // Fetch the thread handle from the user defined thread structure67 struct thread_desc* thrd = get_thread( this );69 // Fetch the thread handle from the user defined thread structure 70 struct thread_desc* thrd = get_thread( this ); 68 71 69 // Officially start the thread by enabling preemption70 enable_interrupts( __cfaabi_dbg_ctx);72 // Officially start the thread by enabling preemption 73 enable_interrupts( DEBUG_CTX ); 71 74 72 // Call the main of the thread73 main( this );75 // Call the main of the thread 76 main( this ); 74 77 75 // To exit a thread we must :76 // 1 - Mark it as halted77 // 2 - Leave its monitor78 // 3 - Disable the interupts79 // 4 - Final suspend80 // The order of these 4 operations is very important81 //Final suspend, should never return82 __leave_thread_monitor( thrd );83 abortf("Resumed dead thread");78 // To exit a thread we must : 79 // 1 - Mark it as halted 80 // 2 - Leave its monitor 81 // 3 - Disable the interupts 82 // 4 - Final suspend 83 // The order of these 4 operations is very important 84 //Final suspend, should never return 85 __leave_thread_monitor( thrd ); 86 abortf("Resumed dead thread"); 84 87 } 85 88 86 89 87 90 void CtxStart( 88 void (*main)(void *),89 struct coroutine_desc *(*get_coroutine)(void *),90 void *this,91 void (*invoke)(void *)91 void (*main)(void *), 92 struct coroutine_desc *(*get_coroutine)(void *), 93 void *this, 94 void (*invoke)(void *) 92 95 ) { 93 struct coStack_t* stack = &get_coroutine( this )->stack; 96 // LIB_DEBUG_PRINTF("StartCoroutine : Passing in %p (main %p) to invoke (%p) from start (%p)\n", this, main, invoke, CtxStart); 97 98 struct coStack_t* stack = &get_coroutine( this )->stack; 94 99 95 100 #if defined( __i386__ ) … … 98 103 void *fixedRegisters[3]; // fixed registers ebx, edi, esi (popped on 1st uSwitch, values unimportant) 99 104 uint32_t mxcr; // SSE Status and Control bits (control bits are preserved across function calls) 100 uint16_t fcw; // X97 FPU control word (preserved across function calls)105 uint16_t fcw; // X97 FPU control word (preserved across function calls) 101 106 void *rturn; // where to go on return from uSwitch 102 107 void *dummyReturn; // fake return compiler would have pushed on call to uInvoke … … 111 116 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->argument[0] = this; // argument to invoke 112 117 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->rturn = invoke; 113 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->mxcr = 0x1F80; //Vol. 2A 3-520114 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F; //Vol. 1 8-7118 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->mxcr = 0x1F80; //Vol. 2A 3-520 119 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F; //Vol. 1 8-7 115 120 116 121 #elif defined( __x86_64__ ) 117 122 118 struct FakeStack {119 void *fixedRegisters[5]; // fixed registers rbx, r12, r13, r14, r15120 uint32_t mxcr; // SSE Status and Control bits (control bits are preserved across function calls)121 uint16_t fcw; // X97 FPU control word (preserved across function calls)122 void *rturn; // where to go on return from uSwitch123 void *dummyReturn; // NULL return address to provide proper alignment124 };123 struct FakeStack { 124 void *fixedRegisters[5]; // fixed registers rbx, r12, r13, r14, r15 125 uint32_t mxcr; // SSE Status and Control bits (control bits are preserved across function calls) 126 uint16_t fcw; // X97 FPU control word (preserved across function calls) 127 void *rturn; // where to go on return from uSwitch 128 void *dummyReturn; // NULL return address to provide proper alignment 129 }; 125 130 126 ((struct machine_context_t *)stack->context)->SP = (char *)stack->base - sizeof( struct FakeStack );127 ((struct machine_context_t *)stack->context)->FP = NULL; // terminate stack with NULL fp131 ((struct machine_context_t *)stack->context)->SP = (char *)stack->base - sizeof( struct FakeStack ); 132 ((struct machine_context_t *)stack->context)->FP = NULL; // terminate stack with NULL fp 128 133 129 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->dummyReturn = NULL;130 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->rturn = CtxInvokeStub;131 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fixedRegisters[0] = this;132 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fixedRegisters[1] = invoke;133 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->mxcr = 0x1F80; //Vol. 2A 3-520134 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F; //Vol. 1 8-7134 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->dummyReturn = NULL; 135 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->rturn = CtxInvokeStub; 136 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fixedRegisters[0] = this; 137 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fixedRegisters[1] = invoke; 138 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->mxcr = 0x1F80; //Vol. 2A 3-520 139 ((struct FakeStack *)(((struct machine_context_t *)stack->context)->SP))->fcw = 0x037F; //Vol. 1 8-7 135 140 #else 136 #error Only __i386__ and __x86_64__ is supported for threads in cfa141 #error Only __i386__ and __x86_64__ is supported for threads in cfa 137 142 #endif 138 143 } -
src/libcfa/concurrency/kernel.c
r3d560060 rdd9b59e 14 14 // 15 15 16 #include "libhdr.h" 17 16 18 //C Includes 17 19 #include <stddef.h> … … 148 150 149 151 this.runner = &runner; 150 __cfaabi_dbg_print_safe("Kernel : constructing main processor context %p\n", &runner);152 LIB_DEBUG_PRINT_SAFE("Kernel : constructing main processor context %p\n", &runner); 151 153 runner{ &this }; 152 154 } … … 154 156 void ^?{}(processor & this) { 155 157 if( ! this.do_terminate ) { 156 __cfaabi_dbg_print_safe("Kernel : core %p signaling termination\n", &this);158 LIB_DEBUG_PRINT_SAFE("Kernel : core %p signaling termination\n", &this); 157 159 this.do_terminate = true; 158 160 P( this.terminated ); … … 179 181 processor * this = runner.proc; 180 182 181 __cfaabi_dbg_print_safe("Kernel : core %p starting\n", this);183 LIB_DEBUG_PRINT_SAFE("Kernel : core %p starting\n", this); 182 184 183 185 { … … 185 187 preemption_scope scope = { this }; 186 188 187 __cfaabi_dbg_print_safe("Kernel : core %p started\n", this);189 LIB_DEBUG_PRINT_SAFE("Kernel : core %p started\n", this); 188 190 189 191 thread_desc * readyThread = NULL; … … 211 213 } 212 214 213 __cfaabi_dbg_print_safe("Kernel : core %p stopping\n", this);215 LIB_DEBUG_PRINT_SAFE("Kernel : core %p stopping\n", this); 214 216 } 215 217 216 218 V( this->terminated ); 217 219 218 __cfaabi_dbg_print_safe("Kernel : core %p terminated\n", this);220 LIB_DEBUG_PRINT_SAFE("Kernel : core %p terminated\n", this); 219 221 } 220 222 … … 290 292 processorCtx_t proc_cor_storage = { proc, &info }; 291 293 292 __cfaabi_dbg_print_safe("Coroutine : created stack %p\n", proc_cor_storage.__cor.stack.base);294 LIB_DEBUG_PRINT_SAFE("Coroutine : created stack %p\n", proc_cor_storage.__cor.stack.base); 293 295 294 296 //Set global state … … 297 299 298 300 //We now have a proper context from which to schedule threads 299 __cfaabi_dbg_print_safe("Kernel : core %p created (%p, %p)\n", proc, proc->runner, &ctx);301 LIB_DEBUG_PRINT_SAFE("Kernel : core %p created (%p, %p)\n", proc, proc->runner, &ctx); 300 302 301 303 // SKULLDUGGERY: Since the coroutine doesn't have its own stack, we can't … … 308 310 309 311 // Main routine of the core returned, the core is now fully terminated 310 __cfaabi_dbg_print_safe("Kernel : core %p main ended (%p)\n", proc, proc->runner);312 LIB_DEBUG_PRINT_SAFE("Kernel : core %p main ended (%p)\n", proc, proc->runner); 311 313 312 314 return NULL; … … 314 316 315 317 void start(processor * this) { 316 __cfaabi_dbg_print_safe("Kernel : Starting core %p\n", this);318 LIB_DEBUG_PRINT_SAFE("Kernel : Starting core %p\n", this); 317 319 318 320 pthread_create( &this->kernel_thread, NULL, CtxInvokeProcessor, (void*)this ); 319 321 320 __cfaabi_dbg_print_safe("Kernel : core %p started\n", this);322 LIB_DEBUG_PRINT_SAFE("Kernel : core %p started\n", this); 321 323 } 322 324 … … 332 334 verifyf( thrd->next == NULL, "Expected null got %p", thrd->next ); 333 335 334 lock( this_processor->cltr->ready_queue_lock __cfaabi_dbg_ctx2 );336 lock( this_processor->cltr->ready_queue_lock DEBUG_CTX2 ); 335 337 append( this_processor->cltr->ready_queue, thrd ); 336 338 unlock( this_processor->cltr->ready_queue_lock ); … … 341 343 thread_desc * nextThread(cluster * this) { 342 344 verify( disable_preempt_count > 0 ); 343 lock( this->ready_queue_lock __cfaabi_dbg_ctx2 );345 lock( this->ready_queue_lock DEBUG_CTX2 ); 344 346 thread_desc * head = pop_head( this->ready_queue ); 345 347 unlock( this->ready_queue_lock ); … … 353 355 suspend(); 354 356 verify( disable_preempt_count > 0 ); 355 enable_interrupts( __cfaabi_dbg_ctx);357 enable_interrupts( DEBUG_CTX ); 356 358 } 357 359 … … 365 367 verify( disable_preempt_count > 0 ); 366 368 367 enable_interrupts( __cfaabi_dbg_ctx);369 enable_interrupts( DEBUG_CTX ); 368 370 } 369 371 … … 379 381 verify( disable_preempt_count > 0 ); 380 382 381 enable_interrupts( __cfaabi_dbg_ctx);383 enable_interrupts( DEBUG_CTX ); 382 384 } 383 385 … … 393 395 verify( disable_preempt_count > 0 ); 394 396 395 enable_interrupts( __cfaabi_dbg_ctx);397 enable_interrupts( DEBUG_CTX ); 396 398 } 397 399 … … 406 408 verify( disable_preempt_count > 0 ); 407 409 408 enable_interrupts( __cfaabi_dbg_ctx);410 enable_interrupts( DEBUG_CTX ); 409 411 } 410 412 … … 421 423 verify( disable_preempt_count > 0 ); 422 424 423 enable_interrupts( __cfaabi_dbg_ctx);425 enable_interrupts( DEBUG_CTX ); 424 426 } 425 427 … … 439 441 // Kernel boot procedures 440 442 void kernel_startup(void) { 441 __cfaabi_dbg_print_safe("Kernel : Starting\n");443 LIB_DEBUG_PRINT_SAFE("Kernel : Starting\n"); 442 444 443 445 // Start by initializing the main thread … … 448 450 (*mainThread){ &info }; 449 451 450 __cfaabi_dbg_print_safe("Kernel : Main thread ready\n");452 LIB_DEBUG_PRINT_SAFE("Kernel : Main thread ready\n"); 451 453 452 454 // Initialize the main cluster … … 454 456 (*mainCluster){}; 455 457 456 __cfaabi_dbg_print_safe("Kernel : main cluster ready\n");458 LIB_DEBUG_PRINT_SAFE("Kernel : main cluster ready\n"); 457 459 458 460 // Initialize the main processor and the main processor ctx … … 481 483 482 484 // THE SYSTEM IS NOW COMPLETELY RUNNING 483 __cfaabi_dbg_print_safe("Kernel : Started\n--------------------------------------------------\n\n");484 485 enable_interrupts( __cfaabi_dbg_ctx);485 LIB_DEBUG_PRINT_SAFE("Kernel : Started\n--------------------------------------------------\n\n"); 486 487 enable_interrupts( DEBUG_CTX ); 486 488 } 487 489 488 490 void kernel_shutdown(void) { 489 __cfaabi_dbg_print_safe("\n--------------------------------------------------\nKernel : Shutting down\n");491 LIB_DEBUG_PRINT_SAFE("\n--------------------------------------------------\nKernel : Shutting down\n"); 490 492 491 493 disable_interrupts(); … … 511 513 ^(mainThread){}; 512 514 513 __cfaabi_dbg_print_safe("Kernel : Shutdown complete\n");515 LIB_DEBUG_PRINT_SAFE("Kernel : Shutdown complete\n"); 514 516 } 515 517 … … 521 523 // abort cannot be recursively entered by the same or different processors because all signal handlers return when 522 524 // the globalAbort flag is true. 523 lock( kernel_abort_lock __cfaabi_dbg_ctx2 );525 lock( kernel_abort_lock DEBUG_CTX2 ); 524 526 525 527 // first task to abort ? … … 546 548 547 549 int len = snprintf( abort_text, abort_text_size, "Error occurred while executing task %.256s (%p)", thrd->self_cor.name, thrd ); 548 __ cfaabi_dbg_bits_write( abort_text, len );550 __lib_debug_write( abort_text, len ); 549 551 550 552 if ( thrd != this_coroutine ) { 551 553 len = snprintf( abort_text, abort_text_size, " in coroutine %.256s (%p).\n", this_coroutine->name, this_coroutine ); 552 __ cfaabi_dbg_bits_write( abort_text, len );554 __lib_debug_write( abort_text, len ); 553 555 } 554 556 else { 555 __ cfaabi_dbg_bits_write( ".\n", 2 );557 __lib_debug_write( ".\n", 2 ); 556 558 } 557 559 } 558 560 559 561 extern "C" { 560 void __ cfaabi_dbg_bits_acquire() {561 lock( kernel_debug_lock __cfaabi_dbg_ctx2 );562 } 563 564 void __ cfaabi_dbg_bits_release() {562 void __lib_debug_acquire() { 563 lock( kernel_debug_lock DEBUG_CTX2 ); 564 } 565 566 void __lib_debug_release() { 565 567 unlock( kernel_debug_lock ); 566 568 } … … 580 582 581 583 void P(semaphore & this) { 582 lock( this.lock __cfaabi_dbg_ctx2 );584 lock( this.lock DEBUG_CTX2 ); 583 585 this.count -= 1; 584 586 if ( this.count < 0 ) { … … 596 598 void V(semaphore & this) { 597 599 thread_desc * thrd = NULL; 598 lock( this.lock __cfaabi_dbg_ctx2 );600 lock( this.lock DEBUG_CTX2 ); 599 601 this.count += 1; 600 602 if ( this.count <= 0 ) { -
src/libcfa/concurrency/kernel_private.h
r3d560060 rdd9b59e 16 16 #pragma once 17 17 18 #include "libhdr.h" 19 18 20 #include "kernel" 19 21 #include "thread" … … 28 30 void disable_interrupts(); 29 31 void enable_interrupts_noPoll(); 30 void enable_interrupts( __cfaabi_dbg_ctx_param);32 void enable_interrupts( DEBUG_CTX_PARAM ); 31 33 } 32 34 … … 37 39 disable_interrupts(); 38 40 ScheduleThread( thrd ); 39 enable_interrupts( __cfaabi_dbg_ctx);41 enable_interrupts( DEBUG_CTX ); 40 42 } 41 43 thread_desc * nextThread(cluster * this); -
src/libcfa/concurrency/monitor.c
r3d560060 rdd9b59e 19 19 #include <inttypes.h> 20 20 21 #include "libhdr.h" 21 22 #include "kernel_private.h" 22 23 … … 90 91 static void __enter_monitor_desc( monitor_desc * this, const __monitor_group_t & group ) { 91 92 // Lock the monitor spinlock 92 DO_LOCK( this->lock __cfaabi_dbg_ctx2 );93 DO_LOCK( this->lock DEBUG_CTX2 ); 93 94 thread_desc * thrd = this_thread; 94 95 95 __cfaabi_dbg_print_safe("Kernel : %10p Entering mon %p (%p)\n", thrd, this, this->owner);96 LIB_DEBUG_PRINT_SAFE("Kernel : %10p Entering mon %p (%p)\n", thrd, this, this->owner); 96 97 97 98 if( !this->owner ) { … … 99 100 set_owner( this, thrd ); 100 101 101 __cfaabi_dbg_print_safe("Kernel : mon is free \n");102 LIB_DEBUG_PRINT_SAFE("Kernel : mon is free \n"); 102 103 } 103 104 else if( this->owner == thrd) { … … 105 106 this->recursion += 1; 106 107 107 __cfaabi_dbg_print_safe("Kernel : mon already owned \n");108 LIB_DEBUG_PRINT_SAFE("Kernel : mon already owned \n"); 108 109 } 109 110 else if( is_accepted( this, group) ) { … … 114 115 reset_mask( this ); 115 116 116 __cfaabi_dbg_print_safe("Kernel : mon accepts \n");117 LIB_DEBUG_PRINT_SAFE("Kernel : mon accepts \n"); 117 118 } 118 119 else { 119 __cfaabi_dbg_print_safe("Kernel : blocking \n");120 LIB_DEBUG_PRINT_SAFE("Kernel : blocking \n"); 120 121 121 122 // Some one else has the monitor, wait in line for it … … 123 124 BlockInternal( &this->lock ); 124 125 125 __cfaabi_dbg_print_safe("Kernel : %10p Entered mon %p\n", thrd, this);126 LIB_DEBUG_PRINT_SAFE("Kernel : %10p Entered mon %p\n", thrd, this); 126 127 127 128 // BlockInternal will unlock spinlock, no need to unlock ourselves … … 129 130 } 130 131 131 __cfaabi_dbg_print_safe("Kernel : %10p Entered mon %p\n", thrd, this);132 LIB_DEBUG_PRINT_SAFE("Kernel : %10p Entered mon %p\n", thrd, this); 132 133 133 134 // Release the lock and leave … … 138 139 static void __enter_monitor_dtor( monitor_desc * this, fptr_t func ) { 139 140 // Lock the monitor spinlock 140 DO_LOCK( this->lock __cfaabi_dbg_ctx2 );141 DO_LOCK( this->lock DEBUG_CTX2 ); 141 142 thread_desc * thrd = this_thread; 142 143 143 __cfaabi_dbg_print_safe("Kernel : %10p Entering dtor for mon %p (%p)\n", thrd, this, this->owner);144 LIB_DEBUG_PRINT_SAFE("Kernel : %10p Entering dtor for mon %p (%p)\n", thrd, this, this->owner); 144 145 145 146 146 147 if( !this->owner ) { 147 __cfaabi_dbg_print_safe("Kernel : Destroying free mon %p\n", this);148 LIB_DEBUG_PRINT_SAFE("Kernel : Destroying free mon %p\n", this); 148 149 149 150 // No one has the monitor, just take it … … 163 164 __monitor_group_t group = { &this, 1, func }; 164 165 if( is_accepted( this, group) ) { 165 __cfaabi_dbg_print_safe("Kernel : mon accepts dtor, block and signal it \n");166 LIB_DEBUG_PRINT_SAFE("Kernel : mon accepts dtor, block and signal it \n"); 166 167 167 168 // Wake the thread that is waiting for this … … 182 183 } 183 184 else { 184 __cfaabi_dbg_print_safe("Kernel : blocking \n");185 LIB_DEBUG_PRINT_SAFE("Kernel : blocking \n"); 185 186 186 187 wait_ctx( this_thread, 0 ) … … 195 196 } 196 197 197 __cfaabi_dbg_print_safe("Kernel : Destroying %p\n", this);198 LIB_DEBUG_PRINT_SAFE("Kernel : Destroying %p\n", this); 198 199 199 200 } … … 202 203 void __leave_monitor_desc( monitor_desc * this ) { 203 204 // Lock the monitor spinlock, DO_LOCK to reduce contention 204 DO_LOCK( this->lock __cfaabi_dbg_ctx2 );205 206 __cfaabi_dbg_print_safe("Kernel : %10p Leaving mon %p (%p)\n", this_thread, this, this->owner);205 DO_LOCK( this->lock DEBUG_CTX2 ); 206 207 LIB_DEBUG_PRINT_SAFE("Kernel : %10p Leaving mon %p (%p)\n", this_thread, this, this->owner); 207 208 208 209 verifyf( this_thread == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", this_thread, this->owner, this->recursion, this ); … … 214 215 // it means we don't need to do anything 215 216 if( this->recursion != 0) { 216 __cfaabi_dbg_print_safe("Kernel : recursion still %d\n", this->recursion);217 LIB_DEBUG_PRINT_SAFE("Kernel : recursion still %d\n", this->recursion); 217 218 unlock( this->lock ); 218 219 return; … … 231 232 // Leave single monitor for the last time 232 233 void __leave_dtor_monitor_desc( monitor_desc * this ) { 233 __cfaabi_dbg_debug_do(234 LIB_DEBUG_DO( 234 235 if( this_thread != this->owner ) { 235 236 abortf("Destroyed monitor %p has inconsistent owner, expected %p got %p.\n", this, this_thread, this->owner); … … 248 249 249 250 // Lock the monitor now 250 DO_LOCK( this->lock __cfaabi_dbg_ctx2 );251 DO_LOCK( this->lock DEBUG_CTX2 ); 251 252 252 253 disable_interrupts(); … … 307 308 (this_thread->monitors){m, count, func}; 308 309 309 // __cfaabi_dbg_print_safe("MGUARD : enter %d\n", count);310 // LIB_DEBUG_PRINT_SAFE("MGUARD : enter %d\n", count); 310 311 311 312 // Enter the monitors in order … … 313 314 enter( group ); 314 315 315 // __cfaabi_dbg_print_safe("MGUARD : entered\n");316 // LIB_DEBUG_PRINT_SAFE("MGUARD : entered\n"); 316 317 } 317 318 … … 319 320 // Dtor for monitor guard 320 321 void ^?{}( monitor_guard_t & this ) { 321 // __cfaabi_dbg_print_safe("MGUARD : leaving %d\n", this.count);322 // LIB_DEBUG_PRINT_SAFE("MGUARD : leaving %d\n", this.count); 322 323 323 324 // Leave the monitors in order 324 325 leave( this.m, this.count ); 325 326 326 // __cfaabi_dbg_print_safe("MGUARD : left\n");327 // LIB_DEBUG_PRINT_SAFE("MGUARD : left\n"); 327 328 328 329 // Restore thread context … … 429 430 430 431 //Some more checking in debug 431 __cfaabi_dbg_debug_do(432 LIB_DEBUG_DO( 432 433 thread_desc * this_thrd = this_thread; 433 434 if ( this.monitor_count != this_thrd->monitors.size ) { … … 486 487 set_owner( monitors, count, signallee ); 487 488 488 __cfaabi_dbg_print_buffer_decl( "Kernel : signal_block condition %p (s: %p)\n", &this, signallee );489 LIB_DEBUG_PRINT_BUFFER_DECL( "Kernel : signal_block condition %p (s: %p)\n", &this, signallee ); 489 490 490 491 //Everything is ready to go to sleep … … 495 496 496 497 497 __cfaabi_dbg_print_buffer_local( "Kernel : signal_block returned\n" );498 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : signal_block returned\n" ); 498 499 499 500 //We are back, restore the masks and recursions … … 534 535 __lock_size_t actual_count = aggregate( mon_storage, mask ); 535 536 536 __cfaabi_dbg_print_buffer_decl( "Kernel : waitfor %d (s: %d, m: %d)\n", actual_count, mask.size, (__lock_size_t)max);537 LIB_DEBUG_PRINT_BUFFER_DECL( "Kernel : waitfor %d (s: %d, m: %d)\n", actual_count, mask.size, (__lock_size_t)max); 537 538 538 539 if(actual_count == 0) return; 539 540 540 __cfaabi_dbg_print_buffer_local( "Kernel : waitfor internal proceeding\n");541 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : waitfor internal proceeding\n"); 541 542 542 543 // Create storage for monitor context … … 555 556 __acceptable_t& accepted = mask[index]; 556 557 if( accepted.is_dtor ) { 557 __cfaabi_dbg_print_buffer_local( "Kernel : dtor already there\n");558 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : dtor already there\n"); 558 559 verifyf( accepted.size == 1, "ERROR: Accepted dtor has more than 1 mutex parameter." ); 559 560 … … 567 568 } 568 569 else { 569 __cfaabi_dbg_print_buffer_local( "Kernel : thread present, baton-passing\n");570 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : thread present, baton-passing\n"); 570 571 571 572 // Create the node specific to this wait operation … … 575 576 monitor_save; 576 577 577 __cfaabi_dbg_print_buffer_local( "Kernel : baton of %d monitors : ", count );578 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : baton of %d monitors : ", count ); 578 579 #ifdef __CFA_DEBUG_PRINT__ 579 580 for( int i = 0; i < count; i++) { 580 __cfaabi_dbg_print_buffer_local( "%p %p ", monitors[i], monitors[i]->signal_stack.top );581 LIB_DEBUG_PRINT_BUFFER_LOCAL( "%p %p ", monitors[i], monitors[i]->signal_stack.top ); 581 582 } 582 583 #endif 583 __cfaabi_dbg_print_buffer_local( "\n");584 LIB_DEBUG_PRINT_BUFFER_LOCAL( "\n"); 584 585 585 586 // Set the owners to be the next thread … … 592 593 monitor_restore; 593 594 594 __cfaabi_dbg_print_buffer_local( "Kernel : thread present, returned\n");595 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : thread present, returned\n"); 595 596 } 596 597 597 __cfaabi_dbg_print_buffer_local( "Kernel : accepted %d\n", *mask.accepted);598 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : accepted %d\n", *mask.accepted); 598 599 return; 599 600 } … … 602 603 603 604 if( duration == 0 ) { 604 __cfaabi_dbg_print_buffer_local( "Kernel : non-blocking, exiting\n");605 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : non-blocking, exiting\n"); 605 606 606 607 unlock_all( locks, count ); 607 608 608 __cfaabi_dbg_print_buffer_local( "Kernel : accepted %d\n", *mask.accepted);609 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : accepted %d\n", *mask.accepted); 609 610 return; 610 611 } … … 613 614 verifyf( duration < 0, "Timeout on waitfor statments not supported yet."); 614 615 615 __cfaabi_dbg_print_buffer_local( "Kernel : blocking waitfor\n");616 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : blocking waitfor\n"); 616 617 617 618 // Create the node specific to this wait operation … … 635 636 monitor_restore; 636 637 637 __cfaabi_dbg_print_buffer_local( "Kernel : exiting\n");638 639 __cfaabi_dbg_print_buffer_local( "Kernel : accepted %d\n", *mask.accepted);638 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : exiting\n"); 639 640 LIB_DEBUG_PRINT_BUFFER_LOCAL( "Kernel : accepted %d\n", *mask.accepted); 640 641 } 641 642 … … 644 645 645 646 static inline void set_owner( monitor_desc * this, thread_desc * owner ) { 646 // __cfaabi_dbg_print_safe("Kernal : Setting owner of %p to %p ( was %p)\n", this, owner, this->owner );647 // LIB_DEBUG_PRINT_SAFE("Kernal : Setting owner of %p to %p ( was %p)\n", this, owner, this->owner ); 647 648 648 649 //Pass the monitor appropriately … … 676 677 static inline thread_desc * next_thread( monitor_desc * this ) { 677 678 //Check the signaller stack 678 __cfaabi_dbg_print_safe("Kernel : mon %p AS-stack top %p\n", this, this->signal_stack.top);679 LIB_DEBUG_PRINT_SAFE("Kernel : mon %p AS-stack top %p\n", this, this->signal_stack.top); 679 680 __condition_criterion_t * urgent = pop( this->signal_stack ); 680 681 if( urgent ) { … … 728 729 for( __lock_size_t i = 0; i < count; i++) { 729 730 (criteria[i]){ monitors[i], waiter }; 730 __cfaabi_dbg_print_safe( "Kernel : target %p = %p\n", criteria[i].target, &criteria[i] );731 LIB_DEBUG_PRINT_SAFE( "Kernel : target %p = %p\n", criteria[i].target, &criteria[i] ); 731 732 push( criteria[i].target->signal_stack, &criteria[i] ); 732 733 } … … 737 738 static inline void lock_all( __spinlock_t * locks [], __lock_size_t count ) { 738 739 for( __lock_size_t i = 0; i < count; i++ ) { 739 DO_LOCK( *locks[i] __cfaabi_dbg_ctx2 );740 DO_LOCK( *locks[i] DEBUG_CTX2 ); 740 741 } 741 742 } … … 744 745 for( __lock_size_t i = 0; i < count; i++ ) { 745 746 __spinlock_t * l = &source[i]->lock; 746 DO_LOCK( *l __cfaabi_dbg_ctx2 );747 DO_LOCK( *l DEBUG_CTX2 ); 747 748 if(locks) locks[i] = l; 748 749 } … … 802 803 for( int i = 0; i < count; i++ ) { 803 804 804 // __cfaabi_dbg_print_safe( "Checking %p for %p\n", &criteria[i], target );805 // LIB_DEBUG_PRINT_SAFE( "Checking %p for %p\n", &criteria[i], target ); 805 806 if( &criteria[i] == target ) { 806 807 criteria[i].ready = true; 807 // __cfaabi_dbg_print_safe( "True\n" );808 // LIB_DEBUG_PRINT_SAFE( "True\n" ); 808 809 } 809 810 … … 811 812 } 812 813 813 __cfaabi_dbg_print_safe( "Kernel : Runing %i (%p)\n", ready2run, ready2run ? node->waiting_thread : NULL );814 LIB_DEBUG_PRINT_SAFE( "Kernel : Runing %i (%p)\n", ready2run, ready2run ? node->waiting_thread : NULL ); 814 815 return ready2run ? node->waiting_thread : NULL; 815 816 } … … 818 819 thread_desc * thrd = this_thread; 819 820 if( !this.monitors ) { 820 // __cfaabi_dbg_print_safe("Branding\n");821 // LIB_DEBUG_PRINT_SAFE("Branding\n"); 821 822 assertf( thrd->monitors.data != NULL, "No current monitor to brand condition %p", thrd->monitors.data ); 822 823 this.monitor_count = thrd->monitors.size; -
src/libcfa/concurrency/preemption.c
r3d560060 rdd9b59e 14 14 // 15 15 16 #include "libhdr.h" 16 17 #include "preemption.h" 17 18 … … 147 148 //============================================================================================= 148 149 149 __cfaabi_dbg_debug_do( static thread_local void * last_interrupt = 0; )150 LIB_DEBUG_DO( static thread_local void * last_interrupt = 0; ) 150 151 151 152 extern "C" { … … 158 159 // Enable interrupts by decrementing the counter 159 160 // If counter reaches 0, execute any pending CtxSwitch 160 void enable_interrupts( __cfaabi_dbg_ctx_param) {161 void enable_interrupts( DEBUG_CTX_PARAM ) { 161 162 processor * proc = this_processor; // Cache the processor now since interrupts can start happening after the atomic add 162 163 thread_desc * thrd = this_thread; // Cache the thread now since interrupts can start happening after the atomic add … … 172 173 173 174 // For debugging purposes : keep track of the last person to enable the interrupts 174 __cfaabi_dbg_debug_do( proc->last_enable = caller; )175 LIB_DEBUG_DO( proc->last_enable = caller; ) 175 176 } 176 177 … … 232 233 // Called from kernel_startup 233 234 void kernel_start_preemption() { 234 __cfaabi_dbg_print_safe("Kernel : Starting preemption\n");235 LIB_DEBUG_PRINT_SAFE("Kernel : Starting preemption\n"); 235 236 236 237 // Start with preemption disabled until ready … … 254 255 // Called from kernel_shutdown 255 256 void kernel_stop_preemption() { 256 __cfaabi_dbg_print_safe("Kernel : Preemption stopping\n");257 LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopping\n"); 257 258 258 259 // Block all signals since we are already shutting down … … 270 271 // Preemption is now fully stopped 271 272 272 __cfaabi_dbg_print_safe("Kernel : Preemption stopped\n");273 LIB_DEBUG_PRINT_SAFE("Kernel : Preemption stopped\n"); 273 274 } 274 275 … … 296 297 // Receives SIGUSR1 signal and causes the current thread to yield 297 298 void sigHandler_ctxSwitch( __CFA_SIGPARMS__ ) { 298 __cfaabi_dbg_debug_do( last_interrupt = (void *)(cxt->uc_mcontext.gregs[CFA_REG_IP]); )299 LIB_DEBUG_DO( last_interrupt = (void *)(cxt->uc_mcontext.gregs[CFA_REG_IP]); ) 299 300 300 301 // Check if it is safe to preempt here … … 345 346 assertf(sig == SIGALRM, "Kernel Internal Error, sigwait: Unexpected signal %d (%d : %d)\n", sig, info.si_code, info.si_value.sival_int); 346 347 347 // __cfaabi_dbg_print_safe("Kernel : Caught alarm from %d with %d\n", info.si_code, info.si_value.sival_int );348 // LIB_DEBUG_PRINT_SAFE("Kernel : Caught alarm from %d with %d\n", info.si_code, info.si_value.sival_int ); 348 349 // Switch on the code (a.k.a. the sender) to 349 350 switch( info.si_code ) … … 353 354 case SI_TIMER: 354 355 case SI_KERNEL: 355 // __cfaabi_dbg_print_safe("Kernel : Preemption thread tick\n");356 lock( event_kernel->lock __cfaabi_dbg_ctx2 );356 // LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread tick\n"); 357 lock( event_kernel->lock DEBUG_CTX2 ); 357 358 tick_preemption(); 358 359 unlock( event_kernel->lock ); … … 367 368 368 369 EXIT: 369 __cfaabi_dbg_print_safe("Kernel : Preemption thread stopping\n");370 LIB_DEBUG_PRINT_SAFE("Kernel : Preemption thread stopping\n"); 370 371 return NULL; 371 372 } … … 379 380 380 381 if ( sigaction( sig, &act, NULL ) == -1 ) { 381 __cfaabi_dbg_print_buffer_decl(382 LIB_DEBUG_PRINT_BUFFER_DECL( 382 383 " __kernel_sigaction( sig:%d, handler:%p, flags:%d ), problem installing signal handler, error(%d) %s.\n", 383 384 sig, handler, flags, errno, strerror( errno ) … … 396 397 397 398 if ( sigaction( sig, &act, NULL ) == -1 ) { 398 __cfaabi_dbg_print_buffer_decl(399 LIB_DEBUG_PRINT_BUFFER_DECL( 399 400 " __kernel_sigdefault( sig:%d ), problem reseting signal handler, error(%d) %s.\n", 400 401 sig, errno, strerror( errno ) … … 408 409 //============================================================================================= 409 410 410 __cfaabi_dbg_debug_do(411 LIB_DEBUG_DO( 411 412 static void __kernel_backtrace( int start ) { 412 413 // skip first N stack frames … … 475 476 476 477 // void sigHandler_segv( __CFA_SIGPARMS__ ) { 477 // __cfaabi_dbg_debug_do(478 // LIB_DEBUG_DO( 478 479 // #ifdef __USE_STREAM__ 479 480 // serr | "*CFA runtime error* program cfa-cpp terminated with" … … 492 493 // void sigHandler_abort( __CFA_SIGPARMS__ ) { 493 494 // // skip first 6 stack frames 494 // __cfaabi_dbg_debug_do( __kernel_backtrace( 6 ); )495 // LIB_DEBUG_DO( __kernel_backtrace( 6 ); ) 495 496 496 497 // // reset default signal handler -
src/libcfa/concurrency/thread.c
r3d560060 rdd9b59e 17 17 18 18 #include "kernel_private.h" 19 #include "libhdr.h" 19 20 20 21 #define __CFA_INVOKE_PRIVATE__ … … 71 72 thrd_c->last = this_coroutine; 72 73 73 // __cfaabi_dbg_print_safe("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);74 // LIB_DEBUG_PRINT_SAFE("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h); 74 75 75 76 disable_interrupts(); … … 81 82 82 83 ScheduleThread(thrd_h); 83 enable_interrupts( __cfaabi_dbg_ctx);84 enable_interrupts( DEBUG_CTX ); 84 85 } 85 86 -
src/libcfa/exception.c
r3d560060 rdd9b59e 23 23 #include <stdio.h> 24 24 #include <unwind.h> 25 #include < bits/debug.h>25 #include <libhdr/libdebug.h> 26 26 27 27 // FIX ME: temporary hack to keep ARM build working … … 37 37 38 38 // Base exception vtable is abstract, you should not have base exceptions. 39 struct __cfa abi_ehm__base_exception_t_vtable40 ___cfa abi_ehm__base_exception_t_vtable_instance = {39 struct __cfaehm__base_exception_t_vtable 40 ___cfaehm__base_exception_t_vtable_instance = { 41 41 .parent = NULL, 42 42 .size = 0, … … 49 49 // Temperary global exception context. Does not work with concurency. 50 50 struct exception_context_t { 51 struct __cfa abi_ehm__try_resume_node * top_resume;52 struct __cfa abi_ehm__try_resume_node * current_resume;51 struct __cfaehm__try_resume_node * top_resume; 52 struct __cfaehm__try_resume_node * current_resume; 53 53 54 54 exception * current_exception; … … 78 78 // RESUMPTION ================================================================ 79 79 80 void __cfa abi_ehm__throw_resume(exception * except) {81 82 __cfaabi_dbg_print_safe("Throwing resumption exception\n");83 84 struct __cfa abi_ehm__try_resume_node * original_head = shared_stack.current_resume;85 struct __cfa abi_ehm__try_resume_node * current =80 void __cfaehm__throw_resume(exception * except) { 81 82 LIB_DEBUG_PRINT_SAFE("Throwing resumption exception\n"); 83 84 struct __cfaehm__try_resume_node * original_head = shared_stack.current_resume; 85 struct __cfaehm__try_resume_node * current = 86 86 (original_head) ? original_head->next : shared_stack.top_resume; 87 87 … … 94 94 } 95 95 96 __cfaabi_dbg_print_safe("Unhandled exception\n");96 LIB_DEBUG_PRINT_SAFE("Unhandled exception\n"); 97 97 shared_stack.current_resume = original_head; 98 98 99 99 // Fall back to termination: 100 __cfa abi_ehm__throw_terminate(except);100 __cfaehm__throw_terminate(except); 101 101 // TODO: Default handler for resumption. 102 102 } … … 105 105 // hook has to be added after the node is built but before it is made the top node. 106 106 107 void __cfa abi_ehm__try_resume_setup(struct __cfaabi_ehm__try_resume_node * node,107 void __cfaehm__try_resume_setup(struct __cfaehm__try_resume_node * node, 108 108 _Bool (*handler)(exception * except)) { 109 109 node->next = shared_stack.top_resume; … … 112 112 } 113 113 114 void __cfa abi_ehm__try_resume_cleanup(struct __cfaabi_ehm__try_resume_node * node) {114 void __cfaehm__try_resume_cleanup(struct __cfaehm__try_resume_node * node) { 115 115 shared_stack.top_resume = node->next; 116 116 } … … 122 122 // May have to move to cfa for constructors and destructors (references). 123 123 124 struct __cfa abi_ehm__node {125 struct __cfa abi_ehm__node * next;124 struct __cfaehm__node { 125 struct __cfaehm__node * next; 126 126 }; 127 127 128 128 #define NODE_TO_EXCEPT(node) ((exception *)(1 + (node))) 129 #define EXCEPT_TO_NODE(except) ((struct __cfa abi_ehm__node *)(except) - 1)129 #define EXCEPT_TO_NODE(except) ((struct __cfaehm__node *)(except) - 1) 130 130 131 131 // Creates a copy of the indicated exception and sets current_exception to it. 132 static void __cfa abi_ehm__allocate_exception( exception * except ) {132 static void __cfaehm__allocate_exception( exception * except ) { 133 133 struct exception_context_t * context = this_exception_context(); 134 134 135 135 // Allocate memory for the exception. 136 struct __cfa abi_ehm__node * store = malloc(137 sizeof( struct __cfa abi_ehm__node ) + except->virtual_table->size );136 struct __cfaehm__node * store = malloc( 137 sizeof( struct __cfaehm__node ) + except->virtual_table->size ); 138 138 139 139 if ( ! store ) { … … 151 151 152 152 // Delete the provided exception, unsetting current_exception if relivant. 153 static void __cfa abi_ehm__delete_exception( exception * except ) {153 static void __cfaehm__delete_exception( exception * except ) { 154 154 struct exception_context_t * context = this_exception_context(); 155 155 156 __cfaabi_dbg_print_safe("Deleting Exception\n");156 LIB_DEBUG_PRINT_SAFE("Deleting Exception\n"); 157 157 158 158 // Remove the exception from the list. 159 struct __cfa abi_ehm__node * to_free = EXCEPT_TO_NODE(except);160 struct __cfa abi_ehm__node * node;159 struct __cfaehm__node * to_free = EXCEPT_TO_NODE(except); 160 struct __cfaehm__node * node; 161 161 162 162 if ( context->current_exception == except ) { … … 178 178 179 179 // If this isn't a rethrow (*except==0), delete the provided exception. 180 void __cfa abi_ehm__cleanup_terminate( void * except ) {181 if ( *(void**)except ) __cfa abi_ehm__delete_exception( *(exception**)except );180 void __cfaehm__cleanup_terminate( void * except ) { 181 if ( *(void**)except ) __cfaehm__delete_exception( *(exception**)except ); 182 182 } 183 183 … … 202 202 203 203 // The exception that is being thrown must already be stored. 204 __attribute__((noreturn)) void __cfa abi_ehm__begin_unwind(void) {204 __attribute__((noreturn)) void __cfaehm__begin_unwind(void) { 205 205 if ( ! this_exception_context()->current_exception ) { 206 206 printf("UNWIND ERROR missing exception in begin unwind\n"); … … 233 233 } 234 234 235 void __cfa abi_ehm__throw_terminate( exception * val ) {236 __cfaabi_dbg_print_safe("Throwing termination exception\n");237 238 __cfa abi_ehm__allocate_exception( val );239 __cfa abi_ehm__begin_unwind();240 } 241 242 void __cfa abi_ehm__rethrow_terminate(void) {243 __cfaabi_dbg_print_safe("Rethrowing termination exception\n");244 245 __cfa abi_ehm__begin_unwind();235 void __cfaehm__throw_terminate( exception * val ) { 236 LIB_DEBUG_PRINT_SAFE("Throwing termination exception\n"); 237 238 __cfaehm__allocate_exception( val ); 239 __cfaehm__begin_unwind(); 240 } 241 242 void __cfaehm__rethrow_terminate(void) { 243 LIB_DEBUG_PRINT_SAFE("Rethrowing termination exception\n"); 244 245 __cfaehm__begin_unwind(); 246 246 } 247 247 … … 254 254 { 255 255 256 // __cfaabi_dbg_print_safe("CFA: 0x%lx\n", _Unwind_GetCFA(context));257 __cfaabi_dbg_print_safe("Personality function (%d, %x, %llu, %p, %p):", version, actions, exceptionClass, unwind_exception, context);256 //LIB_DEBUG_PRINT_SAFE("CFA: 0x%lx\n", _Unwind_GetCFA(context)); 257 LIB_DEBUG_PRINT_SAFE("Personality function (%d, %x, %llu, %p, %p):", version, actions, exceptionClass, unwind_exception, context); 258 258 259 259 // If we've reached the end of the stack then there is nothing much we can do... … … 261 261 262 262 if (actions & _UA_SEARCH_PHASE) { 263 __cfaabi_dbg_print_safe(" lookup phase");263 LIB_DEBUG_PRINT_SAFE(" lookup phase"); 264 264 } 265 265 else if (actions & _UA_CLEANUP_PHASE) { 266 __cfaabi_dbg_print_safe(" cleanup phase");266 LIB_DEBUG_PRINT_SAFE(" cleanup phase"); 267 267 } 268 268 // Just in case, probably can't actually happen … … 307 307 void * ep = (void*)lsd_info.Start + callsite_start + callsite_len; 308 308 void * ip = (void*)instruction_ptr; 309 __cfaabi_dbg_print_safe("\nfound %p - %p (%p, %p, %p), looking for %p\n", bp, ep, ls, cs, cl, ip);309 LIB_DEBUG_PRINT_SAFE("\nfound %p - %p (%p, %p, %p), looking for %p\n", bp, ep, ls, cs, cl, ip); 310 310 #endif // __CFA_DEBUG_PRINT__ 311 311 continue; … … 346 346 347 347 // Get a function pointer from the relative offset and call it 348 // _Unwind_Reason_Code (*matcher)() = (_Unwind_Reason_Code (*)())lsd_info.LPStart + imatcher; 348 // _Unwind_Reason_Code (*matcher)() = (_Unwind_Reason_Code (*)())lsd_info.LPStart + imatcher; 349 349 350 350 _Unwind_Reason_Code (*matcher)(exception *) = … … 357 357 // Based on the return value, check if we matched the exception 358 358 if( ret == _URC_HANDLER_FOUND) { 359 __cfaabi_dbg_print_safe(" handler found\n");359 LIB_DEBUG_PRINT_SAFE(" handler found\n"); 360 360 } else { 361 __cfaabi_dbg_print_safe(" no handler\n");361 LIB_DEBUG_PRINT_SAFE(" no handler\n"); 362 362 } 363 363 return ret; … … 365 365 366 366 // This is only a cleanup handler, ignore it 367 __cfaabi_dbg_print_safe(" no action");367 LIB_DEBUG_PRINT_SAFE(" no action"); 368 368 } 369 369 else if (actions & _UA_CLEANUP_PHASE) { … … 385 385 _Unwind_SetIP( context, ((lsd_info.LPStart) + (callsite_landing_pad)) ); 386 386 387 __cfaabi_dbg_print_safe(" action\n");387 LIB_DEBUG_PRINT_SAFE(" action\n"); 388 388 389 389 // Return have some action to run … … 393 393 394 394 // Nothing to do, move along 395 __cfaabi_dbg_print_safe(" no landing pad");395 LIB_DEBUG_PRINT_SAFE(" no landing pad"); 396 396 } 397 397 // No handling found 398 __cfaabi_dbg_print_safe(" table end reached\n");398 LIB_DEBUG_PRINT_SAFE(" table end reached\n"); 399 399 400 400 UNWIND: 401 __cfaabi_dbg_print_safe(" unwind\n");401 LIB_DEBUG_PRINT_SAFE(" unwind\n"); 402 402 403 403 // Keep unwinding the stack … … 408 408 // libcfa but there is one problem left, see the exception table for details 409 409 __attribute__((noinline)) 410 void __cfa abi_ehm__try_terminate(void (*try_block)(),410 void __cfaehm__try_terminate(void (*try_block)(), 411 411 void (*catch_block)(int index, exception * except), 412 412 __attribute__((unused)) int (*match_block)(exception * except)) { … … 466 466 // Body uses language specific data and therefore could be modified arbitrarily 467 467 ".LLSDACSBCFA2:\n" // BODY start 468 " .uleb128 .TRYSTART-__cfa abi_ehm__try_terminate\n" // Handled area start (relative to start of function)468 " .uleb128 .TRYSTART-__cfaehm__try_terminate\n" // Handled area start (relative to start of function) 469 469 " .uleb128 .TRYEND-.TRYSTART\n" // Handled area length 470 " .uleb128 .CATCH-__cfa abi_ehm__try_terminate\n" // Hanlder landing pad adress (relative to start of function)470 " .uleb128 .CATCH-__cfaehm__try_terminate\n" // Hanlder landing pad adress (relative to start of function) 471 471 " .uleb128 1\n" // Action code, gcc seems to use always 0 472 472 ".LLSDACSECFA2:\n" // BODY end 473 473 " .text\n" // TABLE footer 474 " .size __cfa abi_ehm__try_terminate, .-__cfaabi_ehm__try_terminate\n"474 " .size __cfaehm__try_terminate, .-__cfaehm__try_terminate\n" 475 475 " .ident \"GCC: (Ubuntu 6.2.0-3ubuntu11~16.04) 6.2.0 20160901\"\n" 476 476 // " .section .note.GNU-stack,\"x\",@progbits\n" -
src/libcfa/exception.h
r3d560060 rdd9b59e 21 21 #endif 22 22 23 struct __cfa abi_ehm__base_exception_t;24 typedef struct __cfa abi_ehm__base_exception_t exception;25 struct __cfa abi_ehm__base_exception_t_vtable {26 const struct __cfa abi_ehm__base_exception_t_vtable * parent;23 struct __cfaehm__base_exception_t; 24 typedef struct __cfaehm__base_exception_t exception; 25 struct __cfaehm__base_exception_t_vtable { 26 const struct __cfaehm__base_exception_t_vtable * parent; 27 27 size_t size; 28 void (*copy)(struct __cfa abi_ehm__base_exception_t *this,29 struct __cfa abi_ehm__base_exception_t * other);30 void (*free)(struct __cfa abi_ehm__base_exception_t *this);31 const char * (*msg)(struct __cfa abi_ehm__base_exception_t *this);28 void (*copy)(struct __cfaehm__base_exception_t *this, 29 struct __cfaehm__base_exception_t * other); 30 void (*free)(struct __cfaehm__base_exception_t *this); 31 const char * (*msg)(struct __cfaehm__base_exception_t *this); 32 32 }; 33 struct __cfa abi_ehm__base_exception_t {34 struct __cfa abi_ehm__base_exception_t_vtable const * virtual_table;33 struct __cfaehm__base_exception_t { 34 struct __cfaehm__base_exception_t_vtable const * virtual_table; 35 35 }; 36 extern struct __cfa abi_ehm__base_exception_t_vtable37 ___cfa abi_ehm__base_exception_t_vtable_instance;36 extern struct __cfaehm__base_exception_t_vtable 37 ___cfaehm__base_exception_t_vtable_instance; 38 38 39 39 40 40 // Used in throw statement translation. 41 void __cfa abi_ehm__throw_terminate(exception * except) __attribute__((noreturn));42 void __cfa abi_ehm__rethrow_terminate() __attribute__((noreturn));43 void __cfa abi_ehm__throw_resume(exception * except);41 void __cfaehm__throw_terminate(exception * except) __attribute__((noreturn)); 42 void __cfaehm__rethrow_terminate() __attribute__((noreturn)); 43 void __cfaehm__throw_resume(exception * except); 44 44 45 45 // Function catches termination exceptions. 46 void __cfa abi_ehm__try_terminate(46 void __cfaehm__try_terminate( 47 47 void (*try_block)(), 48 48 void (*catch_block)(int index, exception * except), … … 50 50 51 51 // Clean-up the exception in catch blocks. 52 void __cfa abi_ehm__cleanup_terminate(void * except);52 void __cfaehm__cleanup_terminate(void * except); 53 53 54 54 // Data structure creates a list of resume handlers. 55 struct __cfa abi_ehm__try_resume_node {56 struct __cfa abi_ehm__try_resume_node * next;55 struct __cfaehm__try_resume_node { 56 struct __cfaehm__try_resume_node * next; 57 57 _Bool (*handler)(exception * except); 58 58 }; 59 59 60 60 // These act as constructor and destructor for the resume node. 61 void __cfa abi_ehm__try_resume_setup(62 struct __cfa abi_ehm__try_resume_node * node,61 void __cfaehm__try_resume_setup( 62 struct __cfaehm__try_resume_node * node, 63 63 _Bool (*handler)(exception * except)); 64 void __cfa abi_ehm__try_resume_cleanup(65 struct __cfa abi_ehm__try_resume_node * node);64 void __cfaehm__try_resume_cleanup( 65 struct __cfaehm__try_resume_node * node); 66 66 67 67 // Check for a standard way to call fake deconstructors. 68 struct __cfa abi_ehm__cleanup_hook {};68 struct __cfaehm__cleanup_hook {}; 69 69 70 70 #ifdef __cforall -
src/libcfa/interpose.c
r3d560060 rdd9b59e 24 24 } 25 25 26 #include " bits/debug.h"27 #include " bits/defs.h"26 #include "libhdr/libdebug.h" 27 #include "libhdr/libtools.h" 28 28 #include "startup.h" 29 29 … … 69 69 __typeof__( exit ) libc_exit __attribute__(( noreturn )); 70 70 __typeof__( abort ) libc_abort __attribute__(( noreturn )); 71 72 // #define INIT_REALRTN( x, ver ) libc_##x = (__typeof__(libc_##x))interpose_symbol( #x, ver ) 71 73 72 74 forall(dtype T) … … 125 127 va_end( args ); 126 128 127 __ cfaabi_dbg_bits_write( abort_text, len );128 __ cfaabi_dbg_bits_write( "\n", 1 );129 __lib_debug_write( abort_text, len ); 130 __lib_debug_write( "\n", 1 ); 129 131 } 130 132 131 133 len = snprintf( abort_text, abort_text_size, "Cforall Runtime error (UNIX pid:%ld)\n", (long int)getpid() ); // use UNIX pid (versus getPid) 132 __ cfaabi_dbg_bits_write( abort_text, len );134 __lib_debug_write( abort_text, len ); 133 135 134 136 -
src/libcfa/stdhdr/assert.h
r3d560060 rdd9b59e 30 30 #endif 31 31 32 #if !defined(NDEBUG) && (defined(__CFA_DEBUG__) || defined(__CFA_VERIFY__))33 #define verify(x) assert(x)34 #define verifyf(x, ...) assertf(x, __VA_ARGS__)35 #else36 #define verify(x)37 #define verifyf(x, ...)38 #endif39 40 32 #ifdef __cforall 41 33 } // extern "C" -
src/prelude/builtins.c
r3d560060 rdd9b59e 16 16 // exception implementation 17 17 18 typedef unsigned long long __cfaabi_ abi_exception_type_t;18 typedef unsigned long long __cfaabi_exception_type_t; 19 19 20 20 #include "../libcfa/virtual.h" … … 80 80 } // ?\? 81 81 82 // FIXME (x \ (unsigned long int)y) relies on X ?\?(T, unsigned long) a function that is neither 83 // defined, nor passed as an assertion parameter. Without user-defined conversions, cannot specify 84 // X as a type that casts to double, yet it doesn't make sense to write functions with that type 82 // FIXME (x \ (unsigned long int)y) relies on X ?\?(T, unsigned long) a function that is neither 83 // defined, nor passed as an assertion parameter. Without user-defined conversions, cannot specify 84 // X as a type that casts to double, yet it doesn't make sense to write functions with that type 85 85 // signature where X is double. 86 86 -
src/tests/except-mac.h
r3d560060 rdd9b59e 7 7 8 8 // The fully (perhaps overly) qualified name of the base exception type: 9 #define BASE_EXCEPT __cfa abi_ehm__base_exception_t9 #define BASE_EXCEPT __cfaehm__base_exception_t 10 10 11 11 // Get the name of the vtable type and vtable instance for an exception type:
Note:
See TracChangeset
for help on using the changeset viewer.