Skip to content
Snippets Groups Projects
Commit 69e73b98 authored by Florian Fischer's avatar Florian Fischer
Browse files

[CallerEnvironment] Add a new OWNER caller environment

The OWNER caller environment can be used when the executed algorithm
should be different if the current worker owns the objects it touches.
For example a worker reaping completions on a foreign IoContext may
use the EMPER callerEnvironment and the worker of the IoContext OWNER.

Also implement the stream operator to print caller environments.
parent e677b305
Branches
Tags
1 merge request!260[RFC] IO-stealing analogue to work-stealing
// SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright © 2021 Florian Fischer
#include "CallerEnvironment.hpp"
#include <iostream>
#include "Common.hpp"
auto operator<<(std::ostream& os, const CallerEnvironment& callerEnvironment) -> std::ostream& {
switch (callerEnvironment) {
case OWNER:
return os << "OWNER";
case EMPER:
return os << "EMPER";
case ANYWHERE:
return os << "ANYWHERE";
default:
DIE_MSG("Unknown CallerEnvironment");
}
}
// SPDX-License-Identifier: LGPL-3.0-or-later // SPDX-License-Identifier: LGPL-3.0-or-later
// Copyright © 2020 Florian Schmaus // Copyright © 2020-2021 Florian Schmaus, Florian Fischer
#pragma once #pragma once
#include <iostream>
/*! Enum representing the different environments where code can be executed */
enum CallerEnvironment { enum CallerEnvironment {
EMPER, OWNER, /*!< indicate code executed by the worker owning the object */
ANYWHERE, EMPER, /*!< indicate code executed by any worker */
ANYWHERE, /*!< indicate code executed outside of any worker */
}; };
auto operator<<(std::ostream& os, const CallerEnvironment& callerEnvironment) -> std::ostream&;
...@@ -13,6 +13,7 @@ nasm_gen = generator(nasm, ...@@ -13,6 +13,7 @@ nasm_gen = generator(nasm,
emper_asm_objects = nasm_gen.process(emper_asm_sources) emper_asm_objects = nasm_gen.process(emper_asm_sources)
emper_cpp_sources = [ emper_cpp_sources = [
'CallerEnvironment.cpp',
'Runtime.cpp', 'Runtime.cpp',
'Emper.cpp', 'Emper.cpp',
'Fiber.cpp', 'Fiber.cpp',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment