-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enclave connections and enclave coordination in the C++ target #1665
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far just left a couple of questions
org.lflang/src/org/lflang/generator/cpp/CppConnectionGenerator.kt
Outdated
Show resolved
Hide resolved
this simplifies the connection procedure. Instead of generating different code for normal, enclaved, or just delayed connections, we use the same code for all and insert a lambda that is called to instantiate the concrete connection.
a25e609
to
f2d73f1
Compare
f2d73f1
to
1e0dd75
Compare
1e0dd75
to
aae5cae
Compare
| std::unique_ptr<$reactorType> __lf_instance{nullptr}; | ||
| | ||
| $enclaveWrapperClassName(const std::string& name, reactor::Reactor* container, $reactorType::Parameters&& params) { | ||
| if (__lf_env == nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
general question the code generator generates c++ code in a totally different style like what is currently standard in reactor-cpp. __lf_env
compared it would be probably be named lf_env_
in the style of reactor-cpp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use the __lf_
prefix for some variables to avoid name clashes. It is unlikely, but if someone would name their state variable or some other reactor component lf_env_
, we would see compile errors. __
is kind of a protected namespace in C/C++ that is not supposed to be used by users.
reaction(in) {= | ||
received = true; | ||
auto value = *in.get(); | ||
reactor::log::Info() << "Received " << value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this that we now have native logging. Maybe we just need some alias for more handier use.
9ff7169
to
48898a2
Compare
This PR extends the C++ target with support for connections between enclave. Most of the functionality is added in lf-lang/reactor-cpp#44 which most importantly introduces three new connection types:
EnclaveConnection
,DelayedEnclaveConnection
, andPhysicalEnclaveConnection
. This PR mostly updates the code generator such that the corresponding enclave connection type is inserted into the generated code if an enclave is involved in the connection. This PR also pulls in lf-lang/reactor-cpp#45 which prevents a race condition between staring enclaves.There remain open issues which will be covered in feature PRs: