[Lldb-commits] [PATCH] Don't use a random probe / allocation scheme in the IRMemoryMap

Zachary Turner zturner at google.com
Tue Jul 1 12:38:56 PDT 2014


================
Comment at: source/Expression/IRMemoryMap.cpp:76
@@ +75,3 @@
+      lldb::addr_t addr = back->first;
+      size_t size = back->second.m_size;
+      ret = llvm::RoundUpToAlignment(addr+size, 4096);
----------------
Todd Fiala wrote:
> This now shadows the size argument to the function.  Maybe rename it to something like allocation_size.
> 
> I think you also want to check if size (the argument to the function) + ret would bust the address space (i.e. validate that the requested size can really fit within the address space if it comes where the method suggests).
> 
> Are we guaranteed that these allocations are contiguous?  If they're not contiguous, and if we do not have enough space at the end of the allocations, then that opens up a reason to look for holes earlier in the address space.
They should be contiguous.  After all, this is an interval map where each item in the tree can be reduced to the pair (start, size), and by extension represents the interval [start, start+size).  So by simply pulling the last entry off the map and rounding up to the required alignment, it should be guaranteed that the entry returns is at the next possible location that a value can be allocated at with the given alignment requirement.

http://reviews.llvm.org/D4300






More information about the lldb-commits mailing list