feat/support_fiber #2

Merged
tqcq merged 57 commits from feat/support_fiber into master 2024-06-21 10:33:52 +08:00
3 changed files with 7 additions and 3 deletions
Showing only changes of commit 70aa82c37c - Show all commits

View File

@ -27,7 +27,9 @@ endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static") set(CMAKE_C_FLAGS # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static") set(CMAKE_C_FLAGS
# "${CMAKE_CXX_FLAGS} -static") # "${CMAKE_CXX_FLAGS} -static") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}
# -fsanitize=address ") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address
# ")
set(WHOLE_ARCHIVE_PREFIX "-Wl,-force_load") set(WHOLE_ARCHIVE_PREFIX "-Wl,-force_load")
# set(NO_WHOLE_ARCHIVE_PREFIX "") # set(NO_WHOLE_ARCHIVE_PREFIX "")

View File

@ -50,7 +50,8 @@
// x1: to // x1: to
.text .text
.global TILE_ASM_SYMBOL(tile_ucontext_swap) .global TILE_ASM_SYMBOL(tile_ucontext_swap)
.balign 16 // .balign 16
.align 8
TILE_ASM_SYMBOL(tile_ucontext_swap): TILE_ASM_SYMBOL(tile_ucontext_swap):
// Save context 'from' // Save context 'from'

View File

@ -44,7 +44,8 @@ std::unique_ptr<Fiber> Fiber::Create(std::function<void()> proc) noexcept {
Fiber::Fiber(std::function<void()> proc) Fiber::Fiber(std::function<void()> proc)
: ctx_(object_pool::Get<FiberContext>().Leak()), proc_(std::move(proc)) { : ctx_(object_pool::Get<FiberContext>().Leak()), proc_(std::move(proc)) {
memset(&ctx_->uctx, 0, sizeof(tile_ucontext_t)); // memset(&ctx_->uctx, 0, sizeof(tile_ucontext_t));
// memset(&ctx_->stack, 0, kStackSize);
if (proc_) { if (proc_) {
tile_ucontext_set_target(&ctx_->uctx, &ctx_->stack, kStackSize, RunProc, tile_ucontext_set_target(&ctx_->uctx, &ctx_->stack, kStackSize, RunProc,
&proc_); &proc_);