MPS issue job003745

TitleAWL alignment is not configurable
Statusclosed
Priorityessential
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionThe walkt0 test case [1] fails on W3I3MV with the assertion:

    mpsi.c:1003: MPS ASSERTION FAILED: SizeIsAligned(size, BufferPool(buf)->alignment)
AnalysisOn W3I3MV, the alignment of the AWL pool is MPS_PF_ALIGN=8, but the alignment of the Dylan object format is sizeof(void*)=4.

In the Pool Reference for AWL [2], it says, "The alignment of blocks is configurable," and this came from "A guide to MPS pool classes and their properties" [3] (see table in §7). But this is not true! If you look at AWLInit() in poolawl.c, you’ll see that it never sets pool->alignment to format->alignment as other classes with formats do; this leaves pool->alignment at the default value, which is MPS_PF_ALIGN.

There are two possibilities:

A. The manual is right and the code in poolawl.c is wrong. AWL should set the pool alignment from the format alignment.

B. There is an undocumented constraint on the alignment of objects in AWL pools that justifies the implementation, and the manual is wrong.

If (B) is the case, then any user of AWL must align allocation sizes up to a multiple of MPS_PF_ALIGN so as to avoid the assertion failure from mpsi.c, which is how awlut.c, awluthe.c and awlutth.c avoid this problem. But DL and I looked at the poolawl.c code and could not see what the undocumented constraint might be.

Note that this problem was reported previously by RB in 1997 [4] which gives some confidence that (B) is correct.
How foundautomated_test
Evidence[1] <http://www.ravenbrook.com/project/mps/master/code/walkt0.c>
[2] <http://www.ravenbrook.com/project/mps/master/manual/html/pool/awl.html>
[3] <https://info.ravenbrook.com/project/mp...minfo/mmdoc/doc/mps/guide/pool-classes/>
[4] <https://info.ravenbrook.com/project/mps/mail/1997/07/30/12-29/0.txt>
Created byGareth Rees
Created on2014-04-07 18:43:59
Last modified byGareth Rees
Last modified on2014-09-27 23:33:59
History2014-04-07 GDR Created.

Fixes

Change Effect Date User Description
185357 closed 2014-04-08 18:29:25 Gareth Rees The alignment of an AWL pool is now set to the format alignment, as documented. The alignment restriction on pointers is now based on sizeof(void *), not MPS_PF_ALIGN.