-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
adding few more c++17 operators override. #581
Conversation
src/snmalloc/override/new.cc
Outdated
@@ -71,3 +71,45 @@ void operator delete[](void* p, std::nothrow_t&) | |||
{ | |||
ThreadAlloc::get().dealloc(p); | |||
} | |||
|
|||
void* operator new(size_t size, std::align_val_t) |
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.
Discarding the alignment requirement seems dubious? While it's generally true that snmalloc
prefer to align things much more strongly than generally required, it's still possible to ask for yet stronger alignment. I think the correct thing to do is to use
snmalloc/src/mem/sizeclasstable.h
Line 131 in d0df2d0
aligned_size(size_t alignment, size_t size) |
snmalloc/src/override/malloc.cc
Lines 158 to 174 in d0df2d0
SNMALLOC_EXPORT void* | |
SNMALLOC_NAME_MANGLE(memalign)(size_t alignment, size_t size) | |
{ | |
if ((alignment == 0) || (alignment == size_t(-1))) | |
{ | |
errno = EINVAL; | |
return nullptr; | |
} | |
if ((size + alignment) < size) | |
{ | |
errno = ENOMEM; | |
return nullptr; | |
} | |
return SNMALLOC_NAME_MANGLE(malloc)(aligned_size(alignment, size)); | |
} |
I do not know to what extent those checks are also required by C++ .
return ThreadAlloc::get().alloc(size); | ||
} | ||
|
||
void operator delete(void* p, std::align_val_t)EXCEPTSPEC |
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.
void operator delete(void* p, std::align_val_t)EXCEPTSPEC | |
void operator delete(void* p, std::align_val_t) EXCEPTSPEC |
I'm surprised clang-format
was OK with that without the whitespace.
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.
... oh wow, it in fact requires that it not be there. That... that sure seems like a bug, but I guess it's best to do what it wants. Sorry!
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 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.
by the way is clang-format9 still recommended ? Thankfully I still have it somewhere.
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 is, but I might move this and Verona forward to a newer version. It is getting a bit long in the tooth now.
6154ca7
to
3faf00e
Compare
@devnexen would be able to run clang-format to unblock the CI? |
3faf00e
to
6c3a2ee
Compare
Changes have been addressed from this review and @nwf-msr is OOF at the moment.
No description provided.