5 ms·
As I have said, I'm sure it's not a new concept. You provided some links to hardware accelerators for somewhat related systems, and they imply software solution
by bumholio 8y ago
As I have said, I'm sure it's not a new concept. You provided some links to hardware accelerators for somewhat related systems, and they imply software solutions are unworkable performance wise.
But it seems to me that is not the case for what I am proposing. For the most part, working with pointers should generate almost the same assembly, the [alloc_id] part is simply copied around verbatim and [ptr] is used as before. A function that just dereferences pointer parameters will receive alloc_id in the stack frame but it will ignore it and not load it in the registers. If the pointer is duplicated, the alloc_id is copied on, somewhat increasing stack pressure and reducing memory bandwidth, but certainly not 100x slowdown. Modern processors are very good at parallelising these type of loads and stores.
The performance impact should hit when doing pointer arithmetic and advanced casting, depending on the degree of runtime assurance we want to offer. Every address alteration is followed by a sanity check of the pointer against it's allocation segment. An out-of-bounds pointer can be NULLed to trigger a subsequent run-time exception, while keeping with the standard that such pointers mean undefined behavior.
In the case of some frequent operations, like incrementing, these checks can be extremely fast. Not that hardware solutions would not help, but if such a technique works there is certainly a class of programs that would even accept the slowdown of a software solution. So I have to wonder if there is more to this I am not seeing, besides performance.
- pjmlp 8y agoWhat you are missing it is the human factor. At CppCon 2014, if I am not mistaken, too lazy to search the exact year. Herb Sutter asked the audience how many use some kind of analysis tooling. About 1% of the audience say they did. Joe Duffy has a remark almost at the end of his keynote at Rustconf where he states even with Midori running in front of the Windows team, they weren't accepting it as possible. At least on Solaris, regardless of its future, those protections are now on for many executables. https://blogs.oracle.com/solaris/default-memory-allocator-security-protections-using-silicon-secured-memory-ssm-adi https://blogs.oracle.com/solaris/default-memory-allocator-se... Likewise Google has been locking down what native code is allowed to do on Android, including compiling everything with FORTIFY enabled. It seems pressure must come from OS vendors for habits to change.