MPS issue job001147

TitleMPS on OS X needs a protection module in order to be faster
Statusclosed
Priorityessential
Assigned userDavid Jones
OrganizationRavenbrook
DescriptionThe MPS on OS X is slow. In particular it is much slower than a stop-and-copy collector. See [1], RB's experiments with sc

(Implemented on PowerPC OS X) Now required on Intel OS X.
AnalysisOne of the reasons it is slow is that OS X has no protection module (protxc). We need to implement a protection module in order to remove this cause of slowness.

We could probably use protfr.c unmodified, or modified very little.

So far, 2005-03-04 it seems that whilst the mprotect code works
more or less as is, the signal handling seems screwed. Tests
seem to go into an infinite loop and when running under a debugger
it doesn't seem possible to handle the signal properly or break into the
signal handler, and so is impossible to debug.

Looking at the Boehm GC code (this is very unpleasant) suggests
that they use Mach vm_protect and exception handling. Not only
is this cool, it just might work.

[2] (a post by Timothy Wood of Omnigroup) seems incredibly
useful; I find by looking at the Boehm GC code.

Aha, it turns out that si_addr is the address of the faulting
instruction, and the faulting address is someplace else. Thanks
to NB for some snorkelling help.

Now proceeding with traditional UNIX mprotect / sigaction
handler. Which seems to work just fine.

2007-02-20 DRJ:

Need to implement on Intel OS X. Probably using some
combination of protxcpp.c, protfri3.c, and protso.c

2007-03-02 DRJ:

On Intel OS X the info->si_addr field is correct, so we can use
code which looks much like proto1.c (which is slightly cleaner
than protso.c).

2007-03-09 DRJ:

Implemented in protix.c for Intel Darwin.
How foundmanual_test
Evidence[1] //info.ravenbrook.com/mail/2005/03/01/11-16-25/0.txt
[2] http://www.omnigroup.com/mailman/archive/macosx-dev/2000-June/002030.html
Observed in1.105.0
Created byDavid Jones
Created on2005-03-02 09:51:10
Last modified byDavid Jones
Last modified on2007-03-09 11:26:10
History2005-03-02 DRJ Created
2005-03-04 DRJ Updated
2007-02-20 DRJ Required for Intel now.
2007-03-02 DRJ MacTel notes.
2007-03-09 DRJ Closed

Fixes

Change Effect Date User Description
161905 closed 2007-03-09 09:35:31 David Jones MPS: Typo in config.h was breaking FreeBSD builds.
161902 open 2007-03-08 21:50:28 David Jones MPS: Protection for Intel Darwin. Hopefully cross-platform.
147633 open 2005-03-04 15:53:57 David Jones MPS: Removing some pretty useful printf debugging code from
protxcpp
147632 open 2005-03-04 15:53:00 David Jones MPS: oops. previous submit blatted over my dirty branch. must
have forgotten to p4 edit it.
147629 open 2005-03-04 15:37:12 David Jones MPS: implemented prot on OS X.