Merged
Conversation
Ast should not contain implementation for program. We can use it without Program.
Context should not depend on simulate. We can use context without simulation.
d490e6a to
a11cb6a
Compare
Rececntly we wrongly changed CMakeXxdImpl. Now it points to correct path.
a11cb6a to
3aa2bb0
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR continues the effort to reduce the runtime library footprint by splitting large compilation units, extracting Context out of src/simulate/simulate.cpp and Program out of src/ast/ast.cpp so they can be built/linked into different libraries as needed.
Changes:
- Moved
das::Contextimplementation (and debug-agent globals/helpers) fromsrc/simulate/simulate.cppinto newsrc/runtime/context.cpp. - Moved
das::Programimplementation fromsrc/ast/ast.cppinto newsrc/ast/ast_program.cpp. - Updated CMake sources list and adjusted the XXD helper to use a function + a different script path mechanism (and bumped CMake minimum version).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/simulate/simulate.cpp | Removes Context + debug-agent implementation from this TU to enable finer-grained linking. |
| src/runtime/context.cpp | New TU containing Context and debug-agent implementation previously in simulate.cpp. |
| src/ast/ast.cpp | Removes Program implementation so AST code can be split into smaller object files. |
| src/ast/ast_program.cpp | New TU containing Program implementation previously in ast.cpp. |
| CMakeLists.txt | Registers new source files and bumps minimum required CMake version. |
| CMakeCommon.txt | Refactors CMAKE_TEXT_XXD from macro→function and changes how CMakeXxdImpl.txt is referenced. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,1237 @@ | |||
| #include "daScript/simulate/simulate.h" | |||
| #include "daScript/ast/ast.h" | |||
| #include "daScript/misc/fpe.h" | |||
Collaborator
Author
There was a problem hiding this comment.
This commit only copies existing code. I suggest to not make any modifications in it.
| sharedSize = ctx.sharedSize; | ||
| shared = ctx.shared; | ||
| sharedOwner = false; | ||
| // functoins |
Collaborator
Author
There was a problem hiding this comment.
This commit only copies existing code. I suggest to not make any modifications to it.
Comment on lines
+270
to
285
| function(CMAKE_TEXT_XXD project_name file_name) | ||
| add_custom_command( | ||
| DEPENDS ${file_name} | ||
| OUTPUT ${file_name}.inc | ||
| VERBATIM | ||
| WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
| COMMAND ${CMAKE_COMMAND} -DFILE_TYPE:STRING="TEXT" -DINPUT_FILE_NAME:STRING=${file_name} | ||
| -P ${CMAKE_SOURCE_DIR}/CMakeXxdImpl.txt | ||
| -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/CMakeXxdImpl.txt | ||
| ) | ||
|
|
||
| list(APPEND XXD_DEPENDS_LIST_${project_name} ${file_name}.inc) | ||
| set(XXD_DEPENDS_LIST_${project_name} ${XXD_DEPENDS_LIST_${project_name}} ${file_name}.inc PARENT_SCOPE) | ||
| execute_process( | ||
| WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
| COMMAND ${CMAKE_COMMAND} -DFILE_TYPE:STRING="TEXT" -DINPUT_FILE_NAME:STRING=${file_name} | ||
| -P ${CMAKE_SOURCE_DIR}/CMakeXxdImpl.txt | ||
| -P ${CMAKE_CURRENT_FUNCTION_LIST_DIR}/CMakeXxdImpl.txt | ||
| ) |
| @@ -1,4 +1,4 @@ | |||
| cmake_minimum_required (VERSION 3.16) | |||
| cmake_minimum_required (VERSION 3.17) | |||
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In order to have small runtime library we should clearly separate object files.
This PR continues work in this direction. After extracting serialize from ast node, we split
Programfromast.cppandContextfromsimulate.cpp. So, they may end up in different libraries.