diff options
| author | 2020-11-15 00:36:26 -0800 | |
|---|---|---|
| committer | 2020-11-29 01:31:52 -0800 | |
| commit | 24cae76d16d7344154c1a507889e33793b369be7 (patch) | |
| tree | 8b50b723fdba9f8060813db9476295cdac4dcba9 /src/common/fiber.cpp | |
| parent | hle: kernel: thread: Remove unused "Running" state. (diff) | |
| download | yuzu-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.cpp | 7 |
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 { | |||
| 13 | constexpr std::size_t default_stack_size = 256 * 1024; | 14 | constexpr std::size_t default_stack_size = 256 * 1024; |
| 14 | 15 | ||
| 15 | struct Fiber::FiberImpl { | 16 | struct 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; |