Refactor capptr_domesticate SFINAE to make more statically safe.

This refactoring was provided by David.  Previously if a backend
provided a capptr_domesticate function with the wrong type it would be
silently ignored.  This change requires backends to explicitly opt in
to domestication via a new Backend::Option and ensures the compiler
will loudly complain if there is a mismatch.
This commit is contained in:
Robert Norton
2022-04-27 11:56:16 +01:00
committed by David Chisnall
parent bf54eeb7be
commit f277cf2f00
4 changed files with 72 additions and 19 deletions

View File

@@ -86,6 +86,13 @@ namespace snmalloc
* the queue nodes themselves (which are always considered Wild)?
*/
bool QueueHeadsAreTame = true;
/**
* Does the backend provide a capptr_domesticate function to sanity check
* pointers? If so it will be called when untrusted pointers are consumed
* (on dealloc and in freelists) otherwise a no-op version is provided.
*/
bool HasDomesticate = false;
};
/**