HomePhabricator

Dont' use a random probe & alloc strategy for the IRMemoryMap.

Description

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

Details

Committed
zturnerJul 9 2014, 9:42 AM
Differential Revision
D4300: Don't use a random probe / allocation scheme in the IRMemoryMap
Branches
Unknown
Tags
Unknown