Fri Mar 6 02:00:18 PST 2009 Simon Marlow <[email protected]>
* Partial fix for #2917
Ignore-this: d62309f9a2b682cc2b5ef0bb4376ea54
- add newAlignedPinnedByteArray# for allocating pinned BAs with
arbitrary alignment
- the old newPinnedByteArray# now aligns to 16 bytes
Foreign.alloca will use newAlignedPinnedByteArray#, and so might end
up wasting less space than before (we used to align to 8 by default).
Foreign.allocaBytes and Foreign.mallocForeignPtrBytes will get 16-byte
aligned memory, which is enough to avoid problems with SSE
instructions on x86, for example.
There was a bug in the old newPinnedByteArray#: it aligned to 8 bytes,
but would have failed if the header was not a multiple of 8
(fortunately it always was, even with profiling). Also we
occasionally wasted some space unnecessarily due to alignment in
allocatePinned().
I haven't done anything about Foreign.malloc/mallocBytes, which will
give you the same alignment guarantees as malloc() (8 bytes on
Linux/x86 here).
M ./compiler/prelude/primops.txt.pp +5
M ./includes/StgMiscClosures.h +1
M ./rts/Linker.c +1
M ./rts/PrimOps.cmm -11 +35
M ./rts/sm/Compact.c +4
M ./rts/sm/Evac.c -6 +14
M ./rts/sm/Storage.c -8 +3
View patch online:
http://darcs.haskell.org/ghc/_darcs/patches/20090306100018-12142-18bbb9f72b4f8a183ad7920a4024e7bcf71466cd.gz
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc