Annotation of OpenXM_contrib2/asir2000/gc/doc/README.darwin, Revision 1.1
1.1 ! noro 1: Darwin/MacOSX Support - May 20, 2003
! 2: ====================================
! 3:
! 4: Important Usage Notes
! 5: =====================
! 6:
! 7: GC_init() MUST be called before calling any other GC functions. This
! 8: is necessary to properly register segments in dynamic libraries. This
! 9: call is required even if you code does not use dynamic libraries as the
! 10: dyld code handles registering all data segments.
! 11:
! 12: The incremental collector is still a bit flaky on darwin. It seems to
! 13: work reliably with workarounds for a few possible bugs in place however
! 14: these workaround may not work correctly in all cases. There may also
! 15: be additional problems that I have not found.
! 16:
! 17: Implementation Information
! 18: ==========================
! 19: Darwin/MacOSX support is nearly complete. Thread support is reliable on
! 20: Darwin 6.x (MacOSX 10.2) and there have been reports of success on older
! 21: Darwin versions (MacOSX 10.1). Shared library support had also been
! 22: added and the gc can be run from a shared library. There is currently only
! 23: support for Darwin/PPC although adding x86 support should be trivial.
! 24:
! 25: Thread support is implemented in terms of mach thread_suspend and
! 26: thread_resume calls. These provide a very clean interface to thread
! 27: suspension. This implementation doesn't rely on pthread_kill so the
! 28: code works on Darwin < 6.0 (MacOSX 10.1). All the code to stop the
! 29: world is located in darwin_stop_world.c.
! 30:
! 31: The original incremental collector support unfortunatelly no longer works
! 32: on recent Darwin versions. It also relied on some undocumented kernel
! 33: structures. Mach, however, does have a very clean interface to exception
! 34: handing. The current implementation uses Mach's exception handling.
! 35:
! 36: Much thanks goes to Andrew Stone, Dietmar Planitzer, Andrew Begel,
! 37: Jeff Sturm, and Jesse Rosenstock for all their work on the
! 38: Darwin/OS X port.
! 39:
! 40: -Brian Alliet
! 41: brian@brianweb.net
! 42:
! 43:
! 44: Older Information (Most of this no longer applies to the current code)
! 45: ======================================================================
! 46:
! 47: While the GC should work on MacOS X Server, MacOS X and Darwin, I only tested
! 48: it on MacOS X Server.
! 49: I've added a PPC assembly version of GC_push_regs(), thus the setjmp() hack is
! 50: no longer necessary. Incremental collection is supported via mprotect/signal.
! 51: The current solution isn't really optimal because the signal handler must decode
! 52: the faulting PPC machine instruction in order to find the correct heap address.
! 53: Further, it must poke around in the register state which the kernel saved away
! 54: in some obscure register state structure before it calls the signal handler -
! 55: needless to say the layout of this structure is no where documented.
! 56: Threads and dynamic libraries are not yet supported (adding dynamic library
! 57: support via the low-level dyld API shouldn't be that hard).
! 58:
! 59: The original MacOS X port was brought to you by Andrew Stone.
! 60:
! 61:
! 62: June, 1 2000
! 63:
! 64: Dietmar Planitzer
! 65: dave.pl@ping.at
! 66:
! 67: Note from Andrew Begel:
! 68:
! 69: One more fix to enable gc.a to link successfully into a shared library for
! 70: MacOS X. You have to add -fno-common to the CFLAGS in the Makefile. MacOSX
! 71: disallows common symbols in anything that eventually finds its way into a
! 72: shared library. (I don't completely understand why, but -fno-common seems to
! 73: work and doesn't mess up the garbage collector's functionality).
! 74:
! 75: Feb 26, 2003
! 76:
! 77: Jeff Sturm and Jesse Rosenstock provided a patch that adds thread support.
! 78: GC_MACOSX_THREADS should be defined in the build and in clients. Real
! 79: dynamic library support is still missing, i.e. dynamic library data segments
! 80: are still not scanned. Code that stores pointers to the garbage collected
! 81: heap in statically allocated variables should not reside in a dynamic
! 82: library. This still doesn't appear to be 100% reliable.
! 83:
! 84: Mar 10, 2003
! 85: Brian Alliet contributed dynamic library support for MacOSX. It could also
! 86: use more testing.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>