[Openmcl-devel] macOS and CCL

R. Matthew Emerson rme at acm.org
Mon Aug 27 15:50:51 PDT 2018

Hi everyone.

On most Unix systems, CCL uses signals to suspend and resume threads.  CCL has to do the suspend/resume dance because the garbage collector has to run with other threads suspended.

On the Mac, signals are implemented using lower-level Mach exceptions.  Although it would be nice to use the same scheme on all the Unix systems, there are a couple of reasons why using signals on the Mac doesn't really work well for CCL.  Historically, it was impossible to debug a SIGSEGV signal handler, because the debugger would stop for the EXC_BAD_ACCESS, and there would be no way to continue [1].  Maybe that's better now.

The real killer, though, is that the threads used by libdispatch (aka Grand Central Dispatch) ignore signals.  As macOS evolves, it uses libdisatch more and more.  When a libdispatch thread calls into CCL, we need to be able to suspend it so that the GC can run.  We thus have no choice but to use Mach exception handling.

We must be doing something wrong, however.

https://github.com/Clozure/ccl/issues/127 is an issue that I think demonstrates the problem with a small example.

I could really use some help with this, even if it's just talking it over.  Get in touch if you are able/interested, or have some suggestions on who would be good to talk to.


More information about the Openmcl-devel mailing list