Skip to content
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

refactor access to function bodies #2626

Merged
merged 3 commits into from
Jul 13, 2018

Conversation

fingolfin
Copy link
Member

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.

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.
Instead of putting the char into the first *byte* of the expression,
we store it in the first UInt slot.
@fingolfin fingolfin added topic: kernel release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes labels Jul 5, 2018
@fingolfin fingolfin requested a review from markuspf July 5, 2018 13:37
@codecov
Copy link

codecov bot commented Jul 5, 2018

Codecov Report

Merging #2626 into master will decrease coverage by <.01%.
The diff coverage is 91.23%.

@@            Coverage Diff             @@
##           master    #2626      +/-   ##
==========================================
- Coverage    74.8%    74.8%   -0.01%     
==========================================
  Files         479      479              
  Lines      242199   242203       +4     
==========================================
+ Hits       181188   181190       +2     
- Misses      61011    61013       +2
Impacted Files Coverage Δ
src/code.h 100% <ø> (ø) ⬆️
src/funcs.c 97.63% <100%> (ø) ⬆️
src/vars.c 86.94% <86.29%> (ø) ⬆️
src/compiler.c 87.2% <87.55%> (-0.04%) ⬇️
src/code.c 93.68% <96.61%> (ø) ⬆️
src/stats.c 89.62% <98.57%> (+0.02%) ⬆️
src/exprs.c 93.96% <98.68%> (+0.01%) ⬆️
src/hpc/threadapi.c 43.48% <0%> (-0.11%) ⬇️

@fingolfin
Copy link
Member Author

I just checked, and this does not conflict with PR #2628 at all (though once this is merged, the syntax tree code should be adjusted to use READ_STAT and READ_EXPR, too (which is easy, a matter of running a regex search&replace)

@fingolfin fingolfin merged commit 34aee34 into gap-system:master Jul 13, 2018
@fingolfin fingolfin deleted the mh/read-write-expr-stat branch July 13, 2018 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants