├── benchmarks ├── deretta-coroutine │ ├── boost │ │ └── coroutine │ │ │ ├── tags │ │ │ ├── detail │ │ │ ├── arg_max.hpp │ │ │ ├── swap_context.hpp │ │ │ ├── index.hpp │ │ │ ├── yield_result_type.hpp │ │ │ ├── fix_result.hpp │ │ │ ├── noreturn.hpp │ │ │ ├── signal.hpp │ │ │ ├── is_callable.hpp │ │ │ ├── signature.hpp │ │ │ ├── has_swap.hpp │ │ │ ├── make_tuple_traits.hpp │ │ │ ├── coroutine_traits.hpp │ │ │ ├── coroutine_accessor.hpp │ │ │ ├── argument_packer.hpp │ │ │ ├── wait_impl.hpp │ │ │ ├── future_impl.hpp │ │ │ ├── call_impl.hpp │ │ │ └── posix_utility.hpp │ │ │ ├── shared_coroutine.hpp │ │ │ └── exception.hpp │ └── libs │ │ └── coroutine │ │ ├── benchmark │ │ ├── make.sh │ │ ├── Jamfile │ │ └── out_of_line.cpp │ │ ├── src │ │ ├── coroutine.cpp │ │ ├── swapcontext.s │ │ └── swapcontext.cpp │ │ ├── test │ │ ├── test_invoke.cpp │ │ ├── test_optional.cpp │ │ ├── test_yield.cpp │ │ ├── test_yield_to2.cpp │ │ ├── test_yield_to.cpp │ │ ├── test_reference.cpp │ │ ├── test_meta.cpp │ │ ├── Jamfile.v2 │ │ ├── test_non_default_constructible.cpp │ │ ├── test_any.cpp │ │ ├── test_move.cpp │ │ ├── test_generator.cpp │ │ ├── test_call.cpp │ │ └── test_create.cpp │ │ ├── build │ │ └── Jamfile.v2 │ │ ├── example │ │ ├── factorial.cpp │ │ ├── switch_fsm.cpp │ │ ├── consumer_producer_b.cpp │ │ ├── matcher.cpp │ │ ├── scheduler.cpp │ │ ├── Jamfile.v2 │ │ ├── coroutine_fsm_regexp.cpp │ │ ├── consumer_producer_a.cpp │ │ ├── banana.cpp │ │ ├── consumer_producer_c.cpp │ │ └── scheduler_wait.cpp │ │ └── doc │ │ └── Jamfile.v2 ├── posixContext.cpp ├── oslinuxContext.cpp ├── oslinuxContextLoop.cpp ├── posixContextLoop.cpp ├── include │ ├── benchmark │ │ ├── clock.hpp │ │ ├── details │ │ │ └── posix.hpp │ │ └── timer.hpp │ └── benchmark.hpp ├── stack.cpp ├── virtcall.cpp ├── coroutine.cpp ├── CMakeLists.txt ├── context.cpp.inc ├── context_loop.cpp.inc └── stats.py ├── tests ├── stack │ ├── CMakeLists.txt │ └── stack.cpp ├── context │ ├── posixContext.cpp │ ├── CMakeLists.txt │ ├── oslinuxContext.cpp │ ├── oslinuxABIcheck.cpp │ └── context.cpp.inc ├── coroutine │ ├── CMakeLists.txt │ ├── builder.cpp │ ├── yielder.cpp │ ├── exception.cpp │ └── coroutine.cpp ├── include │ └── test.hpp └── CMakeLists.txt ├── README ├── include └── coroutine │ ├── impl │ ├── stack_static.hpp │ ├── context_linux.hpp │ ├── stack_dynamic.hpp │ ├── context_posix.hpp │ └── context_linux_x86_32.hpp │ ├── best_context.hpp │ ├── context.hpp │ ├── stack.hpp │ └── yielder.hpp └── CMakeLists.txt /benchmarks/deretta-coroutine/boost/coroutine/tags: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bombela/CxxCoroutine/HEAD/benchmarks/deretta-coroutine/boost/coroutine/tags -------------------------------------------------------------------------------- /benchmarks/deretta-coroutine/libs/coroutine/benchmark/make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | BOOST_ROOT=~/src/boost bjam -sBUILD="speed on" -d2 3 | -------------------------------------------------------------------------------- /tests/stack/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # CMakeLists.txt 3 | # Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | # 5 | # 6 | 7 | set(TEST_SRCS 8 | stack.cpp 9 | ) 10 | 11 | foreach(f ${TEST_SRCS}) 12 | coroutine_add_test(${f}) 13 | endforeach() 14 | -------------------------------------------------------------------------------- /tests/context/posixContext.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * posixContext.cpp 3 | * Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | typedef coroutine::context::posix context_tag; 11 | 12 | #include "context.cpp.inc" 13 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Need cmake and boost to build. 2 | 3 | configure: 4 | mkdir build 5 | cd build 6 | cmake -DCMAKE_BUILD_TYPE=Release .. 7 | 8 | build: 9 | make 10 | 11 | run test: 12 | make test 13 | 14 | run benchmarks: 15 | make bench 16 | 17 | show nice benchmarks stats (need python and plotlib for python): 18 | make stat 19 | -------------------------------------------------------------------------------- /tests/context/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # CMakeLists.txt 3 | # Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | # 5 | # 6 | 7 | set(TEST_SRCS 8 | posixContext.cpp 9 | oslinuxContext.cpp 10 | oslinuxABIcheck.cpp 11 | ) 12 | 13 | foreach(f ${TEST_SRCS}) 14 | coroutine_add_test(${f}) 15 | endforeach() 16 | -------------------------------------------------------------------------------- /tests/context/oslinuxContext.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * oslinuxContext.cpp 3 | * Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | typedef coroutine::context::linux context_tag; 11 | 12 | #include "context.cpp.inc" 13 | -------------------------------------------------------------------------------- /tests/coroutine/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # 2 | # CMakeLists.txt 3 | # Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | # 5 | # 6 | 7 | set(TEST_SRCS 8 | yielder.cpp 9 | builder.cpp 10 | coroutine.cpp 11 | exception.cpp 12 | ) 13 | 14 | foreach(f ${TEST_SRCS}) 15 | coroutine_add_test(${f}) 16 | endforeach() 17 | -------------------------------------------------------------------------------- /benchmarks/posixContext.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * posixContext.cpp 3 | * Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | typedef coroutine::context::posix context_tag; 11 | 12 | #define BENCH_ARCH posix 13 | #include "context.cpp.inc" 14 | 15 | BENCH_MAIN(fullbench) 16 | -------------------------------------------------------------------------------- /benchmarks/oslinuxContext.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * oslinuxContext.cpp 3 | * Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | typedef coroutine::context::linux context_tag; 11 | 12 | #define BENCH_ARCH oslinux 13 | #include "context.cpp.inc" 14 | 15 | BENCH_MAIN(fullbench) 16 | -------------------------------------------------------------------------------- /benchmarks/oslinuxContextLoop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * oslinuxContext.cpp 3 | * Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | typedef coroutine::context::linux context_tag; 11 | 12 | #define BENCH_ARCH oslinux 13 | #include "context_loop.cpp.inc" 14 | 15 | BENCH_MAIN(loope) 16 | -------------------------------------------------------------------------------- /tests/include/test.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * test.hpp 3 | * Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | * 5 | */ 6 | 7 | #pragma once 8 | #ifndef TEST_H 9 | #define TEST_H 10 | 11 | #define BOOST_TEST_MODULE coroutine 12 | #include 13 | 14 | #define UNUSED __attribute__ ((unused)) 15 | #define NOINLINE __attribute__ ((noinline)) 16 | 17 | #endif /* TEST_H */ 18 | -------------------------------------------------------------------------------- /benchmarks/posixContextLoop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * posixContext.cpp 3 | * Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | typedef coroutine::context::posix context_tag; 11 | 12 | #define BENCH_ARCH posix 13 | #define BENCH_ARCH_POSIX 14 | #include "context_loop.cpp.inc" 15 | 16 | BENCH_MAIN(loop) 17 | -------------------------------------------------------------------------------- /benchmarks/include/benchmark/clock.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * clock.hpp 3 | * Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | * 5 | */ 6 | 7 | #pragma once 8 | #ifndef CLOCK_H 9 | #define CLOCK_H 10 | 11 | #include 12 | 13 | #ifdef __USE_POSIX 14 | # include 15 | namespace benchmark { 16 | namespace clock = benchmark::details::clock::posix; 17 | } // namespace benchmark 18 | #else 19 | # error Non posix system not yet supported! 20 | #endif 21 | 22 | #endif /* CLOCK_H */ 23 | -------------------------------------------------------------------------------- /benchmarks/stack.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * stack.cpp 3 | * Copyright © 2010 François-Xavier 'Bombela' Bourlet 4 | * 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace coroutine; 13 | 14 | BENCH(createStack_static, 23) 15 | { 16 | UNUSED stack::stack stack; 17 | } 18 | 19 | BENCH(createStack_dynamic, 23) 20 | { 21 | UNUSED stack::stack stack; 22 | } 23 | 24 | BENCH_MAIN(fullbench) 25 | -------------------------------------------------------------------------------- /benchmarks/deretta-coroutine/libs/coroutine/benchmark/Jamfile: -------------------------------------------------------------------------------- 1 | subproject libs/coroutine/benchmark ; 2 | 3 | project boost : $(BOOST_ROOT) ; 4 | 5 | flags gcc CFLAGS speed: -finline ; 6 | 7 | template example 8 | : ../build/boost_coroutine 9 | : ../../.. 10 | ; 11 | 12 | exe call_overhead : call_overhead.cpp out_of_line.cpp