Title | macOS thread registration guard is ineffective and unnecessary |
Status | closed |
Priority | nice |
Assigned user | Gareth Rees |
Organization | Ravenbrook |
Description | The function ProtThreadRegister in protxc.c arranges to deliver EXC_BAD_ACCESS exceptions to protExcPort so that they can be handled by the MPS. Some effort is made to avoid doing this twice for the "main" thread (the one that first creates an arena and so calls ProtSetup).
This is ineffective (because a thread can be registered with multiple arenas, and on the second and subsequent registrations the exception swapping would be repeated for that thread) and also unnecessary (because nothing goes wrong when the guard is removed: swapping the exception port is idempotent). |
Analysis | It looks as though the guard was necessary in a previous version of the code, when an attempt was made to remember the old exception port for each thread and pass unrecognized exceptions through to that port. But the current version of the code assumes that this is unnecessary (see .assume.only-port) and so we can simplify it by removing the guard. |
How found | inspection |
Evidence | None |
Created by | Gareth Rees |
Created on | 2018-06-15 12:36:26 |
Last modified by | Gareth Rees |
Last modified on | 2018-06-15 12:44:51 |
History | 2018-06-15 GDR Created. |