[Vm-dev] hampering the desire of the VM and image to visit every object at startup time (multiple times)

David T. Lewis lewis at mail.msen.com
Tue Apr 14 11:37:54 UTC 2009

On Tue, Apr 14, 2009 at 10:58:15AM +0200, Bert Freudenberg wrote:
> On 14.04.2009, at 07:26, John M McIntosh wrote:
> >I created a pharo entry to track the problem the VM & image has in  
> >wanting to visit every smalltalk object multiple times at startup  
> >time.
> >Athought this behavior is masked by Gigaherz processors, it's very  
> >evident as a problem on the iPhone. Fixing it results in reducing
> >MB of RAM memory usage and saves actual "seconds* of clock time at  
> >startup.
> >
> >http://code.google.com/p/pharo/issues/detail?id=737&colspec=ID%20Type%20Status%20Summary%20Milestone&start=200
> Very nice. We experimented in that direction for OLPC which also is  
> comparatively slow CPU wise, and even slower loading the whole image  
> from the flash disk (which involves decompressing). Mmapping only the  
> pages needed should give a considerable boost.
> Do we have evidence that an mmap base address of 500 MB works across  
> platforms?

Well, there's only one way to find out ;)

AFAIK nobody has tried this on Linux yet, but it should not be hard to
do. The necessary support is in VMMaker already (see Mantis 7233), so it
would be a matter of changing the unix support code, adding two functions
and updating configure to point at the new functions.

You can get an idea of what's involved from the change set preamble:

Change Set:		Interpreter-readImageFromFile-jmm-dtl
Date:			23 October 2008

Pass image file and image header length to object memory allocation function
in order to enable mmap loading without address swizzling, per jmm proposal.

CCodeGenerator will provide default implementations in interp.h that are
backward compatible with the existing platform support code. These defaults
may be overridden by adding definitions such as the following to sqConfig.h
(or config.h via configure for the unix VM).

#define allocateMemoryMinimumImageFileHeaderSize(heapSize, minimumMemory, fileStream, headerSize) \
    myMemoryAllocator(heapSize, minimumMemory, fileStream, headerSize)

#define sqImageFileReadEntireImage(memoryAddress, fileStream, elementSize,  length) \
    myImageFileReader(memoryAddress, fileStream, elementSize,  length)

More information about the Vm-dev mailing list