common: fiber: Use VirtualBuffer for stack memory.
- This will be aligned by default, and helps memory usage.
This commit is contained in:
parent
c2ad1243ba
commit
24cae76d16
|
@ -5,6 +5,7 @@
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/fiber.h"
|
#include "common/fiber.h"
|
||||||
#include "common/spin_lock.h"
|
#include "common/spin_lock.h"
|
||||||
|
#include "common/virtual_buffer.h"
|
||||||
|
|
||||||
#include <boost/context/detail/fcontext.hpp>
|
#include <boost/context/detail/fcontext.hpp>
|
||||||
|
|
||||||
|
@ -13,8 +14,10 @@ namespace Common {
|
||||||
constexpr std::size_t default_stack_size = 256 * 1024;
|
constexpr std::size_t default_stack_size = 256 * 1024;
|
||||||
|
|
||||||
struct Fiber::FiberImpl {
|
struct Fiber::FiberImpl {
|
||||||
alignas(64) std::array<u8, default_stack_size> stack;
|
FiberImpl() : stack{default_stack_size}, rewind_stack{default_stack_size} {}
|
||||||
alignas(64) std::array<u8, default_stack_size> rewind_stack;
|
|
||||||
|
VirtualBuffer<u8> stack;
|
||||||
|
VirtualBuffer<u8> rewind_stack;
|
||||||
|
|
||||||
SpinLock guard{};
|
SpinLock guard{};
|
||||||
std::function<void(void*)> entry_point;
|
std::function<void(void*)> entry_point;
|
||||||
|
|
Loading…
Reference in New Issue