TrivialMemoryManager currently doesn't check the return type of AllocateRWX -- and returns a 'null' MemoryBlock to its caller.
I would like to change the behavior, and check for errors inside the memory manager, so that If AllocateRWX fails, we can get an human readable error message that explains why the allocation failed, rather than printing a generic failure message. Also, if we check for memory allocation failures in the MemoryManager, we can guarantee the following invariant: if the memory manager returns, the buffer returned is valid. Therefore the clients can convert error handling into asserts.
Please let me know what you think.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
This points to some serious issues with the MemoryManager interface: We should really have a way to report this kind of failure back to users, rather than crashing.
That said, this looks good for now.
Comment Actions
Thanks for your review, Lang. I opened a bug so that we can track/don't forget about the interface changes. https://llvm.org/bugs/show_bug.cgi?id=25187