Re-use host Python process when compiling from command line #372
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
... instead of spawning a sub-process. This keeps namespaces consistent (in a way that spawning a subprocess wouldn't) and allows the use of a Python debugger. Resolves #362
NOTE FOR DEBUGGING: the IDE (compile-design) does not yet support debugging, so you'll need to create a main stub (like bllinky_skeleton.py, as if running from the command line) and debug from that. But breakpoints do work.
Implementation-wise, this 'flips' the client / server role: after sending the design to compile to the server, the Python process then acts as an HDL server until receiving an empty request (denoting end of compilation), then waits for the compilation result. This also restructures the interface structure, notably bringing the core compiler interface structurally closer to the Python implementation, with a dedicated serializer / deserializer class (instead of it being monolithic).
This also refactors the compiler to eliminate error suppression, instead moving it into the generator test case (using redirect_stderr) which is the only place this functionality is used. This new structure also un-suppresses a warning in the test suite, which will be addressed separately.
Also bumps the compiler version.