-
Notifications
You must be signed in to change notification settings - Fork 64
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
Use of delayed and physical connections as provided by the C++ runtime #1583
Conversation
This reverts commit 1bd0fa4.
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 dont see any big mistakes
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.
Didn't check carefully, but LGTM!
@petervdonovan Could you take a look at the failing LSP tests? If you have any tips on where I can start looking myself in the future (I already struggle with finding the actual error in the log), I would appreciate that. Or even better: it would be great if we could have some instructions on how to handle the LSP tests in the developer docs. |
The LSP tests appear to be passing
I will try to do this tomorrow or the day after tomorrow |
Oh, then I guess it was just one of the regular C++ tests also causing the LSP test failures.
That would be great! Thanks! |
91ab496
to
4cb0758
Compare
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 to me!
org.lflang/src/org/lflang/generator/cpp/CppConnectionGenerator.kt
Outdated
Show resolved
Hide resolved
import org.lflang.lf.Reactor | ||
import org.lflang.lf.VarRef | ||
|
||
class CppConnectionGenerator(private val reactor: Reactor) { |
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.
This class needs some documentation...
Currently, after delays are implemented as an AST transformation. With lf-lang/reactor-cpp#38, the C++ runtime provides a native solution for implementing delayed and physical connections. This PR disables the AST transformation in the C++ target and instead uses the native runtime implementations. It also adds a couple of tests for various corner cases that have not been tested before.
In short, the runtime provides to classes
DelayedConnection
andPhysicalConnection
that are specializations of theAction
class (which better should be called Trigger). By implementingAction
, the connections may add new events to the event queue. At the same time, they provide API for binding to one upstream and multiple downstream ports. Due to a callback mechanism, the connection gets notified when the upstream port is set and it will schedule an event. When the scheduler retrieves the event from the event queue, itssetup()
function will also set all downstream ports and accordingly trigger downstream reactions.This PR probably makes the C++ target the first target to correctly implement physical connections, as physical connections are currently not properly handled by the AST transformation (see #616)