Title | Alignment requirements for manual classes are needlessly strict |
Status | closed |
Priority | nice |
Assigned user | Gareth Rees |
Organization | Ravenbrook |
Description | All the manually managed memory classes have needlessly strict, and/or wrongly documented, alignment requirements. 1. MVT. The Pool Class Properties table [1] says, "MVT pools have configurable alignment, but it may not be smaller than the natural alignment for the platform (see MPS_PF_ALIGN)" but the Pool Reference entry [2] says, "The minimum alignment supported by pools of this class is sizeof(void *)." This is inconsistent. It is the Properties table that is correct -- in poolmv2.c there's an AVER(SizeIsAligned(align, MPS_PF_ALIGN)) -- but is this necessary? 2. MVFF. The Pool Class Properties table [1] says, "The alignment of blocks is configurable, but may not be smaller than the natural alignment of the platform." -- but is this necessary? 3. MFS. The Pool Class Properties table [1] has a footnote which doesn't mention MFS at all. 4. MV. The Pool Class Properties table [1] says, "The alignment of blocks allocated from MV (Manual Variable) pools is platform-dependent." but doesn't say what it is. |
Analysis | 1. I believe that the reason for the alignment requirement is that MVT uses Freelist when memory is low, and so alignment has to be a multiple of freelistMinimumAlignment. But that's sizeof(void*), which is smaller than MPS_PF_ALIGN on some platforms. So we could relax the alignment requirement for MVT down to sizeof(void*). 2. The situation is similar for MVFF except that MVFF uses the alloc/free protocol, and so there is no need for any constraint on the alignment -- MVFFAlloc and MVFFFree already call SizeAlignUp. 3, 4. The Pool Class Properties table should name MFS and the natural alignment in the footnote. |
How found | inspection |
Evidence | [1] <http://www.ravenbrook.com/project/mps/...l/pool/intro.html#pool-class-properties >[2] < http://www.ravenbrook.com/project/mps/master/manual/html/pool/mvt.html >[3] http://www.ravenbrook.com/project/mps/master/manual/html/pool/mvff.html |
Test procedure | mpmss |
Created by | Gareth Rees |
Created on | 2014-04-08 18:04:51 |
Last modified by | Gareth Rees |
Last modified on | 2014-10-20 17:36:49 |
History | 2014-04-08 GDR Created. |
Change | Effect | Date | User | Description |
---|---|---|---|---|
186481 | closed | 2014-06-11 12:18:40 | Gareth Rees | Merge mps/branch/2014-04-08/align into the master sources. |