On Sep 25, 2013, at 9:36 , Eliot Miranda <eliot.miranda@gmail.com> wrote:
Hi Henry,
On Wed, Sep 25, 2013 at 1:14 AM, Henrik Johansen <henrik.s.johansen@veloxit.no> wrote:
On Sep 24, 2013, at 9:58 , Eliot Miranda <eliot.miranda@gmail.com> wrote:
On Mon, Sep 23, 2013 at 3:10 PM, Nicolas Cellier <nicolas.cellier.aka.nice@gmail.com> wrote: Isn't Eliot just implementing this feature, having a segment of non relocatable objects?
Sort of. Spur will allow any object in old space to stay still, and through become can move any object to old space very simply. So instead of having a special fixed space segment it has a best-bit compaction algorithm that doesn't slide objects, but moves them into holes. With this kind of compaction it is very easy to leave objects put.
A further advantage of Spur is that objects have 64-bit alignment so passing arrays to e.g. code using sse instructions, won't cause potential alignment faults.
Not to be a drag, but SSE operations have 16-byte alignment requirement. With 8-byte aligmnent of first indexable slot, you'd still need to use aligned loads/stores.
Talking out-of-line with someone who has lots of experience with Smalltalk memory management it came to me that the pinning primitive could (and should) take an aligmnet argument). So one says e.g.
buffer := (ByteArray new: 1024) pinWithByteAlignment: 16
-- best, Eliot
I feel this, plus an FFI that lets you specify parameter alignment tags*, and pin the arguments accordingly, would be an excellent solution. For example, AVX ops already requires 32-byte alignment. Covering all the cases where alignment might be an issue seems like a hefty task for the allocator to care about by default. Might be a good idea to make sure they're padded to a corresponding multiple of bytes as well, just to be safe :) (Say, some library using movapd to store the results back as well, without regarding odd-numbers of elements, thus potentially overwriting the next objects header) Cheers, Henry P.S. For the record, alignment isn't ever an issue when writing your own SSE functions using NB. You'd simply \\16/32 the provided pointer, do aligned loads, and mask out the leading/trailing bytes when storing using maskmovdqu/vmaskmov** ;) *A custom FFI interrupt handler for #GP returning an error instead of crashing when an alignment tag is missing would be out of the question though, right? ;) ** Well, if someone gets around to implementing the VEX-encoded instructions in NB, that is