From 2247f084ef81cc77af51b9ff2f96e86806225752 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sun, 4 Jan 2026 09:50:02 +0000 Subject: [PATCH] [common/fiber] use std::vector<> for allocating stack instead of virtualBuffer<> Signed-off-by: lizzie --- src/common/fiber.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp index 4f0f2b6430..e9a5dce3f4 100644 --- a/src/common/fiber.cpp +++ b/src/common/fiber.cpp @@ -17,10 +17,10 @@ namespace Common { constexpr std::size_t default_stack_size = 512 * 1024; struct Fiber::FiberImpl { - FiberImpl() : stack{default_stack_size}, rewind_stack{default_stack_size} {} + FiberImpl() : stack(default_stack_size), rewind_stack(default_stack_size) {} - VirtualBuffer stack; - VirtualBuffer rewind_stack; + std::vector stack; + std::vector rewind_stack; std::mutex guard; std::function entry_point; @@ -105,8 +105,7 @@ void Fiber::Rewind() { ASSERT(impl->rewind_point); ASSERT(impl->rewind_context == nullptr); u8* stack_base = impl->rewind_stack_limit + default_stack_size; - impl->rewind_context = - boost::context::detail::make_fcontext(stack_base, impl->stack.size(), RewindStartFunc); + impl->rewind_context = boost::context::detail::make_fcontext(stack_base, impl->stack.size(), RewindStartFunc); boost::context::detail::jump_fcontext(impl->rewind_context, this); } @@ -119,7 +118,7 @@ void Fiber::YieldTo(std::weak_ptr weak_from, Fiber& to) { // "from" might no longer be valid if the thread was killed if (auto from = weak_from.lock()) { if (from->impl->previous_fiber == nullptr) { - ASSERT_MSG(false, "previous_fiber is nullptr!"); + ASSERT(false && "previous_fiber is nullptr!"); return; } from->impl->previous_fiber->impl->context = transfer.fctx;