MPS issue job003749

TitleHard to write portable debugging pool options
Statusclosed
Prioritynice
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionSuppose you write:

    mps_pool_debug_option_s debug_options = {
        (const void *)"postpost", 8,
        (const void *)"free", 4,
    };

And pass this to an MVFF pool with default values for all the keyword arguments. This works fine on all platforms ... except for W3I6MV, where the creation of the pool returns MPS_RES_PARAM (mysteriously: see job003485).

You can see that I struggled with this when getting the test suite to run on Windows [2].
AnalysisDebugPoolInit() insists that

    debug->fenceSize % PoolAlignment(pool) == 0

But the default pool alignment for MVFF is MPS_PF_ALIGN and on W3I6MV this is 16. So to make a portable set of debug options, you have to make fenceSize and freeSize at least as big as the largest alignment of the pool on any platform you need to port to. So what you need is:

    mps_pool_debug_option_s debug_options = {
        (const void *)"postpostpostpost", 16,
        (const void *)"free", 4,
    };

For freeSize there's an inverse constraint:

    PoolAlignment(pool) % debug->freeSize == 0

so freeSize has to be at least as small as the smallest alignment of the pool on any platform you need to port to! This is rubbish, and in fact there is no good reason for these constraints other than the convenience of the implementation in dbgpool.c [1].

The manual [3] says, "Both fence_size and free_size must be a multiple of the alignment of the pool, and also a multiple of the alignment of the pool’s object format if it has one" but this isn't correct.
How foundautomated_test
Evidence[1] <http://www.ravenbrook.com/project/mps/master/code/dbgpool.c>
[2] <https://info.ravenbrook.com/infosys/cgi/perfbrowse.cgi?@describe+185089>
[3] <http://www.ravenbrook.com/project/mps/master/manual/html/topic/debugging.html>
Test procedurempmss
Created byGareth Rees
Created on2014-04-09 11:51:50
Last modified byGareth Rees
Last modified on2014-10-20 17:41:20
History2014-04-09 GDR Created.

Fixes

Change Effect Date User Description
185379 closed 2014-04-09 13:00:52 Gareth Rees Make debugging pool implementation more flexible -- there's no longer a requirement for fenceSize to be a multiple of the pool alignment, nor for freeSize to be a divisor of the pool alignment. This makes it easy to write simple and portable debug options structures without having to mess about with MPS_PF_ALIGN.