[Vm-dev] Spur Memory segment and OS allocation

Clément Bera bera.clement at gmail.com
Sat Apr 28 08:57:00 UTC 2018


Hi Eliot, Hi all,

On mac and linux, Spur uses mmap to allocate new segments. The V3 memory
manager used malloc instead. I've looked into many other VMs (Javascript
and Java), and most of them use posix_memalign (basically malloc where you
can ask for specific alignment).

I am wondering why we are using mmap over posix_memalign / malloc. The only
reason I can find is that Spur always allocate new memory segments at a
higher address than past segments to guarantee that young objects are on
lower addresses than old objects for the write barrier. Is that correct?

Assuming it is correct, let's say I change Spur to implement the write
barrier differently (typically, I change all objects to be aligned on 128
bits instead of 64 and have different allocation alignment for young (128
bits alignment) and old objects(128+64 bits alignment)). Will we be able to
use posix_memalign / malloc to allocate new memory segment if I do that ?
Or does the VM rely on segments being on higher addresses for other reasons
? For example, does the VM assume CogMethods are on lower addresses than
objects on heap and rely on it to check if a stack frame is mframe or
iframe ?

Thanks,

-- 
Clément Béra
https://clementbera.github.io/
https://clementbera.wordpress.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180428/81d11119/attachment-0001.html>


More information about the Vm-dev mailing list