summaryrefslogtreecommitdiff
path: root/src/common/fiber.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2020-11-15 00:36:26 -0800
committerGravatar bunnei2020-11-29 01:31:52 -0800
commit24cae76d16d7344154c1a507889e33793b369be7 (patch)
tree8b50b723fdba9f8060813db9476295cdac4dcba9 /src/common/fiber.cpp
parenthle: kernel: thread: Remove unused "Running" state. (diff)
downloadyuzu-24cae76d16d7344154c1a507889e33793b369be7.tar.gz
yuzu-24cae76d16d7344154c1a507889e33793b369be7.tar.xz
yuzu-24cae76d16d7344154c1a507889e33793b369be7.zip
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.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp
index 3978c8624..3c1eefcb7 100644
--- a/src/common/fiber.cpp
+++ b/src/common/fiber.cpp
@@ -5,6 +5,7 @@
5#include "common/assert.h" 5#include "common/assert.h"
6#include "common/fiber.h" 6#include "common/fiber.h"
7#include "common/spin_lock.h" 7#include "common/spin_lock.h"
8#include "common/virtual_buffer.h"
8 9
9#include <boost/context/detail/fcontext.hpp> 10#include <boost/context/detail/fcontext.hpp>
10 11
@@ -13,8 +14,10 @@ namespace Common {
13constexpr std::size_t default_stack_size = 256 * 1024; 14constexpr std::size_t default_stack_size = 256 * 1024;
14 15
15struct Fiber::FiberImpl { 16struct Fiber::FiberImpl {
16 alignas(64) std::array<u8, default_stack_size> stack; 17 FiberImpl() : stack{default_stack_size}, rewind_stack{default_stack_size} {}
17 alignas(64) std::array<u8, default_stack_size> rewind_stack; 18
19 VirtualBuffer<u8> stack;
20 VirtualBuffer<u8> rewind_stack;
18 21
19 SpinLock guard{}; 22 SpinLock guard{};
20 std::function<void(void*)> entry_point; 23 std::function<void(void*)> entry_point;