On Fri, Oct 10, 2008 at 09:36:51PM -0700, John M McIntosh wrote:
In the past year or so there has been discussion of using mmap to set a start address for the offset of object memory so that memory address swizzling does not occur. Also various operating systems vendors say using mmap to page in large files is faster than using fread, this in fact is true and noticeable on the iPhone.
This requires a change to VMMaker so that sqAllocateMemory can pass the file pointer and the header size, since in the sqAllocateMemory we need to figure out the file (image size) and also understand the headersize of the image file to return a proper address to work with.
John,
If I understand correctly, the change in #readImageFromFile:HeapSize:StartingAt: might look like this:
"allocate a contiguous block of memory for the Squeak heap" memory := self allocateMemory: heapSize minimum: minimumMemory imageFile: f headerSize: headerSize.
For backward compatibility in the support code (e.g. for the existing unix platform code), a define could be provided like this:
#define allocateMemoryminimumimageFileheaderSize(heapSize, minimumMemory, f, headerSize) \ sqAllocateMemory(minimumMemory, heapSize)
And for the iPhone VM, you could have a macro like this:
#define allocateMemoryminimumimageFileheaderSize(heapSize, minimumMemory, f, headerSize) \ sqAllocateMemoryMac(minimumMemory, heapSize, f, headerSize) {
Does that sound right? Change set attached for the VMMaker part.
- Dave