-
Notifications
You must be signed in to change notification settings - Fork 113
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
Factor out libc code into a header. #624
Conversation
This pulls the main definitions of the various libc malloc functions into a header for easier use and inclusion in other projects.
Do they still get inlined in the .cc file? |
It looks good:
and
|
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.
Two hopefully quick questions, but the bulk of it seems fine.
src/snmalloc/override/libc.h
Outdated
* Clang was helpfully inlining the constant return value, and | ||
* thus converting from a tail call to an ordinary call. | ||
*/ | ||
static inline void* snmalloc_not_allocated = nullptr; |
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.
Does marking this const
re-enable the problematic inlining?
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 had a look at the code a bit more, and it no longer seems like it is a problem.
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.
Also ended up adding some SNMALLOC_FAST_PATH to force some inlining as calloc
and realloc
had introduced an additional tail call than needed.
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.
LGTM
This pulls the main definitions of the various libc malloc functions into a header for easier use and inclusion in other projects.