From 1e4537de49cd433e1b32974f0869076fe51271fb Mon Sep 17 00:00:00 2001 From: Florian Schmaus <flow@cs.fau.de> Date: Thu, 27 Apr 2017 17:09:10 +0200 Subject: [PATCH] Align Context to cache line --- emper/Context.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/emper/Context.hpp b/emper/Context.hpp index 210b1ec3..99485fe6 100644 --- a/emper/Context.hpp +++ b/emper/Context.hpp @@ -18,14 +18,14 @@ extern "C" [[noreturn]] void switch_and_load_context(void** toTos); extern "C" void save_and_switch_context(void** toTos, void** fromTos); extern "C" [[noreturn]] void switch_context(void** toTos); -class Context : Logger<LogSubsystem::C> { +class ALIGN_TO_CACHE_LINE Context : Logger<LogSubsystem::C> { private: static const unsigned int CONTEXT_SIZE = 0xffff; // 1024 * 1024 * 4; static thread_local Context* currentContext; - char context[CONTEXT_SIZE]; void* const tos; + // unsigned valgrindStackId; void* savedStackpointer; @@ -35,6 +35,10 @@ private: func_t preMainHook; + // Allign the stack to a cache line, so that it isn't shared with + // the other members of this class. + ALIGN_TO_CACHE_LINE char context[CONTEXT_SIZE]; + friend std::ostream& operator<<(std::ostream&, const Context&); /** -- GitLab