Commit 0d25f80d authored by Florian Schmaus's avatar Florian Schmaus
Browse files

[ContextManager] Remove the put/get free context cycle

The put/get free context cycle in ContextManager::start() (if
continuation stealing is enabled) became unnecessary with
c66551bf ("[Context] Use 'jmp' instead of 'ret' to kickoff the
parent e4042ad4
Pipeline #83538 failed with stages
in 14 minutes and 49 seconds
......@@ -73,34 +73,15 @@ void ContextManager::start() {
Context* freeContext = nullptr;
if constexpr (emper::CONTINUATION_STEALING) {
// The code below only needs to be executed if we did a long jmp
// before. But optimizing for it is not worth it. If we longjmp
// and can not resume the Fibril and we where not on the initial
// context of the Fibril, then we need to take care to recycle the
// context.
Context* currentContext = Context::getCurrentContext();
if (currentContext) {
// If we would simply call currentContext->start() here, then we
// would jump to an invalid address. The reason is that as soon as
// the Context::kickoff() is executed, the alpha function address,
// which was just popped of the stack, will be potentially
// overriden by a stack push operation. And such operations are
// very likely. Instead we simply free the current context here,
// so that it is re-initialized later on.
// TODO: Adjust the assembly to not use 'ret' to reach the
// kickoff function, but instead jmp. This would not destroy the
// kickoff's function pointer on the stack, and we could call
// currentContext->start() here. This would print a small
// performance gain.
freeContext = Context::getCurrentContext();
Context* freeContext = getFreeContext();
if (!freeContext) freeContext = getFreeContext();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment