-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
libexpr: move eval memory allocation to own struct #14047
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
Conversation
3ca0525 to
f124072
Compare
9f6202e to
efe955f
Compare
xokdvium
left a comment
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.
Fixed some outstanding issues with baseEnvP (bad merge probably). Let's wait for @roberth to take a look as well.
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.
Can you explain a bit more about the context? What does "take on more management of the heap" mean?
Changing all these state.allocValue() to state.mem.allocValue() seems like gratuitous code churn to me that will cause a lot of merge conflicts.
Different gc implementations, @Radvendii in particular is working on using 32bit indices rather than pointers to reduce memory usage. This would require a new gc however. I also experimented with bumper allocators for nix-eval-jobs.
Which pull requests do you have in mind? I don't see too much regarding evaluation at the moment. Note that he ported this patch based on @xokdvium request, discussed during a team meeting. |
That may be premature abstraction though if we don't know what @roberth's eval caching work will require from a memory interface.
That sounds great, but unless we anticipate that we would have multiple implementations in the same code base (rather than just replacing the existing one), having an extra abstraction layer may just make such work harder rather than easier. BTW, one way to reduce the code churn in this PR a lot is to keep |
This sounds good. |
OK great, if we can unblock this by doing that to make the new |
I plan to add a layer that goes around the "outside" of the evaluator, where |
efe955f to
bf3171b
Compare
|
Okay, I restored For the record while learning my way around the code base recently I found the number of functions that just forward to another function somewhat confusing. Asking myself things like Why are they there? Am I missing something? Which one should I be using? I added a comment to make it hopefully clearer. |
ac59260 to
e90f6de
Compare
56d6d23 to
d5bc8b9
Compare
Co-authored-by: eldritch horrors <[email protected]> Co-authored-by: Sergei Zimmerman <[email protected]> See original commit on lix: https://git.lix.systems/lix-project/lix/commit/f5754dc90ae9b1207656d0e29ad2704d3ef1e554
d5bc8b9 to
7b3c193
Compare
xokdvium
left a comment
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.
Diff is much smaller
| : size(size) | ||
| , elems(size <= 2 ? inlineElems : (Value **) allocBytes(size * sizeof(Value *))) | ||
| { | ||
| state.nrListElems += size; |
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 am not sure that every ListBuilder is going through the new mem.listBuilder?
OK nevermind, I thought there was some sort of default arg but there is not. This is easy to verify.
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.
When I search the codebase, I don't find any other instances. Neither with LSP goto-references nor with a text search for ListBuilder. But it could be getting initialized in some way that is tripping up both searches.
Motivation
Separate the concerns of memory management from the rest of EvalState. This will become even more important in the future as we take on more management of the heap.
Context
Co-authored-by: eldritch horrors [email protected]
https://git.lix.systems/lix-project/lix/commit/f5754dc90ae9b1207656d0e29ad2704d3ef1e554
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.
CC @xokdvium