-
Notifications
You must be signed in to change notification settings - Fork 59
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
Introduce memswap(3) API #207
Comments
A few other issues that need to be considered: The C++ Swapping can be a lot more efficient if we have a guarantee that |
Agreed on all points -- I'd imagined that On aliasing: If we think the primary consumer is sorting, then it probably makes sense to guarantee non-overlap. I wonder how much |
LLVM recognises both The distinction is more important for the inlined versions, because they can batch more sequential reads (given enough registers) and interact better with modern pipelines and caches, particularly when the size is known at compile time. After further thought, I'm not sure how important the aliasing information will be for swap, because you intrinsically need to load both. |
Closing in favor of CTSRD-CHERI/llvm-project#395 |
Sundry sort-related utility functions end up implementing their own memory-swapping implementations that typically fail to preserve tags (
qsort()
, etc). This might be improved in the future by providing amemswap(3)
API to C that provides a suitable implementation of swapping the contents of two memory locations -- e.g.,memswap(void *dst, void *src, size_t len)
that would preserve tags on suitably aligned and suitably sized chunks of memory. This would then ideally be used with uintptr_t when working with data structures that may contain pointers.The text was updated successfully, but these errors were encountered: