[pypy-dev] Problem with large allocation in test

pypy at pocketnix.org pypy at pocketnix.org
Thu Apr 21 12:33:58 CEST 2011

On Thu, Apr 21, 2011 at 12:21:48PM +0200, Armin Rigo wrote:
> Hi Vincent,
> On Tue, Apr 19, 2011 at 2:02 PM, Vincent Legoll
> <vincent.legoll at gmail.com> wrote:
> > Wouldn't a big read only mmap from /dev/zero before the to be jumped
> > adress allow for not really trying to allocate the big chunk of RAM ?
> >
> > That may be a good fix, still allowing the test for far jumps...
> It's not needed; mmap() can optionally take a position argument,
> allowing us to choose the position of the small pieces of requested
> memory.

i have been working on a patch based around this behavior of mmap, 
currently mmap as called in this test does not allow you to specify 
the base_addr hint however there is an alloc function as used by the 
jit that allows you to specify this address indirectly (by setting 
hint.pos in the same class).

it appears only the jit is calling this function and as such i have 
been working on a patch that i hope to have ready in the next couple 
of days. i wouldn't mind some feedback on how i am trying to do it

i am cloning the alloc function and adding a new parameter to specify 
a base addr, then ripping out the hint object as i have been unable to 
find anything that references it directly (with a quick grep, will test 
to be sure)

after there is done i will migrate the test from mmap to the new alloc 
function and provide hints that satisfy the spacing requirements

one this is all working i had intended to dump the Alic function and 
replace it with the new alloc function and update the callers, from my 
grepping of the source it appears like it is called once or twice in 
the jit and should be easy to update

i am assuming this is the correct course of action, if i should 
instead not be replacing the original alloc function and just create 
a new alloc_with_hint function and keep/use both let me know

this has been an intresting way to get fammilar with pypy

More information about the Pypy-dev mailing list