Dont' use a random probe & alloc strategy for the IRMemoryMap.
authorZachary Turner <zturner@google.com>
Wed, 9 Jul 2014 16:42:27 +0000 (16:42 +0000)
committerZachary Turner <zturner@google.com>
Wed, 9 Jul 2014 16:42:27 +0000 (16:42 +0000)
commit3ddcd314f25060dafefcf6c5142f1fe49d37f9fb
tree97a159a5715a23e6c4aa968c19546c81771d5175
parent58814445d4a43d9ab8a2adba5309d6affd378101
Dont' use a random probe & alloc strategy for the IRMemoryMap.

The current strategy for host allocation is to choose a random
address and attempt to allocate there, eventually failing if the
allocation cannot be satisfied.

The C standard only guarantees that RAND_MAX >= 32767, so for
platforms that use a very small RAND_MAX allocations will fail
with very high probability.  On such platforms (Windows is one),
you can reproduce this trivially by running lldb, typing "expr (3)"
and then hitting enter you see a failure.  Failures generally
happen with a frequency of about 1 failure every 5 evaluations.

There is no good reason that allocations need to look like "real"
pointers, so this patch changes the allocation scheme to simply
jump straight to the end and grab a free chunk of memory.

Reviewed By: Sean Callanan

Differential Revision: http://reviews.llvm.org/D4300

llvm-svn: 212630
lldb/source/Expression/IRMemoryMap.cpp