-
Notifications
You must be signed in to change notification settings - Fork 116
Basic OpenBSD backend support. #74
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
Cannot enforce alignment so we just check its correctness.
davidchisnall
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.
There's a lot of code copied and pasted from the FreeBSD PAL here. Please can you pull that out into a common generic BSD PAL? I think that the OpenBSD one will likely be the generic one and FreeBSD is that plus the addition of support for aligned allocation support.
src/pal/pal_openbsd.h
Outdated
| * Bitmap of PalFeatures flags indicating the optional features that this | ||
| * PAL supports. | ||
| */ | ||
| static constexpr uint64_t pal_features = AlignedAllocation | LazyCommit; |
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.
If you can't guarantee alignment, then don't advertise that you support aligned allocation - the code using the PAL will fix this for you.
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.
It was
There's a lot of code copied and pasted from the FreeBSD PAL here. Please can you pull that out into a common generic BSD PAL? I think that the OpenBSD one will likely be the generic one and FreeBSD is that plus the addition of support for aligned allocation support.
It was to avoid too many ifdef
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.
If you can't guarantee alignment, then don't advertise that you support aligned allocation - the code using the PAL will fix this for you.
Yes useless flag indeed.
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 meant pull out the common functions into a shared superclass, not add a mess of ifdefs...
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.
Sorry my bad :-)
mjp41
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.
This looks good to me. Thanks for your contribution. @davidchisnall can you double check
| class PALOBSD : public PALBSD | ||
| { | ||
| public: | ||
| static constexpr uint64_t pal_features = LazyCommit; |
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.
If you include this line in the PALBSD, then we can remove this file, and just use PALBSD for OpenBSD and extend it for FreeBSD.
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.
Yes I considered this but was not sure if one day OpenBSD would need a particular treatment (ie having special mmap flags nothing else has).
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 think the right thing to do here (from the perspective of making the code readable) is for the BSD PAL to set LazyCommit and for the OpenBSD PAL to declare pal_features but set it to PALBSD::pal_features, so if anyone needs to extend this class with non-generic behaviour later then they have a reminder to do so. I'll make that change when I do some cleanup.
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.
No problem at all with that, result is the same just make the "inheritance" reminder clearer indeed.
|
Now that the BSD back ends are merged, the Linux one looks quite untidy. I think I will try to refactor some of it into a POSIX PAL today. |
Cannot enforce alignment so we just check its correctness.