refactor access to function bodies #2626
Merged
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.
Add READ_{EXPR,STAT}, WRITE_{EXPR,STAT}, CONST_ADDR_{EXPR,STAT} helpers to improve over code readability, and to make code which only reads from the body immediately distinguishable from code which writes to it.
With this change, it becomes trivial to see that code.c is the only place we ever write into function bodies.
This enables future refactoring of the coder; e.g. we can stop using
PtrBody
in it, which is a useful optimization for the code executor, but less so for generating code.@markuspf I am not sure if this has any potential overlap with your syntax tree work; since I don't want to sabotage that, please let me know if this is the case, and we should put this PR here on hold.