MPS issue job003342

Titlemps_arena_unsafe functions are bogus
Statusclosed
Prioritynice
Assigned userRichard Brooksby
OrganizationRavenbrook
DescriptionThe functions mps_arena_unsafe_expose_remember_protection [1] and mps_arena_unsafe_restore_protection [2] are kind of hairy (as well as having absurd names). It's not at all clear what the use case is for these.

The function mps_arena_expose [3] "is expected only to be useful for debugging" so why have special unsafe functions that appear to be only for speeding it up?
AnalysisThe history of these functions seems to be as follows:

1. Configura encountered an assertion failure when Office XP is installed (job000812).

2. They had trouble investigating this because of the MPS's memory protection (job000813).

3. mps_arena_expose was introduced to enable them to investigate the problem.

4. However, the performance was not acceptable (job000818).

5. The mps_arena_unsafe_* functions were introduced to improve the performance. Some bugs (job000825) were encountered and fixed.

6. Configura discovered the cause of the problem: an Office XP component was posting events, and their event handler was calling into the MPS directly (bypassing the MPS trampoline). The solution was for the event handler to call into the MPS via the trampoline. See analysis in job000812.

7. And now the MPS trampoline is unecessary (job003330).

So it looks as though all three functions could safely be removed.

For the moment I have marked all three functions as "deprecated starting with version 1.111". We can remove them in version 1.112 or some later version.

Note that the original assertion failure [4] was

    MPS ASSERTION FAILURE: lock->claims == 0
    .\lockw3.c
    78

and the "Common assertions and their causes" section of the manual gives the correct explanation [5]: "The client program has made a re-entrant call into the MPS. Look at the backtrace to see what it was. Common culprits are signal handlers, ..."
How foundinspection
Evidence[1] <http://info.ravenbrook.com/project/mps...arena_unsafe_expose_remember_protection>
[2] <http://info.ravenbrook.com/project/mps...ce/#mps_arena_unsafe_restore_protection>
[3] <http://info.ravenbrook.com/project/mps....110/manual/reference/#mps_arena_expose>
[4] https://info.ravenbrook.com/mail/2003/09/02/20-00-00/0.txt
[5] http://www.ravenbrook.com/project/mps/...html#common-assertions-and-their-causes
Observed in1.110.0
Created byGareth Rees
Created on2012-10-24 15:29:33
Last modified byGareth Rees
Last modified on2016-09-04 12:23:46
History2012-10-24 GDR Created.
2012-10-25 GDR Better analysis based on examination of issue database.

Fixes

Change Effect Date User Description
180943 closed 2013-02-08 16:17:34 Richard Brooksby Integrating branch/2012-10-09/user-guide back to master.