diff options
| author | bunnei <bunneidev@gmail.com> | 2020-11-15 00:36:26 -0800 |
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2020-11-29 01:31:52 -0800 |
| commit | 05ff3e467ec4ae473da3a61f61ffb15657761238 (patch) | |
| tree | 8b50b723fdba9f8060813db9476295cdac4dcba9 /src/common/fiber.cpp | |
| parent | b2de57e93e28a0f42304b14783893a1400200953 (diff) | |
common: fiber: Use VirtualBuffer for stack memory.
- This will be aligned by default, and helps memory usage.
Diffstat (limited to 'src/common/fiber.cpp')
| -rw-r--r-- | src/common/fiber.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp index 3978c86240..3c1eefcb7d 100644 --- a/src/common/fiber.cpp +++ b/src/common/fiber.cpp @@ -5,6 +5,7 @@ #include "common/assert.h" #include "common/fiber.h" #include "common/spin_lock.h" +#include "common/virtual_buffer.h" #include <boost/context/detail/fcontext.hpp> @@ -13,8 +14,10 @@ namespace Common { constexpr std::size_t default_stack_size = 256 * 1024; struct Fiber::FiberImpl { - alignas(64) std::array<u8, default_stack_size> stack; - alignas(64) std::array<u8, default_stack_size> rewind_stack; + FiberImpl() : stack{default_stack_size}, rewind_stack{default_stack_size} {} + + VirtualBuffer<u8> stack; + VirtualBuffer<u8> rewind_stack; SpinLock guard{}; std::function<void(void*)> entry_point; |
