Fix threads on Darwin 10.8
authorPaul Khuong <pvk@pvk.ca>
Wed, 1 Aug 2012 22:00:34 +0000 (18:00 -0400)
committerPaul Khuong <pvk@pvk.ca>
Wed, 1 Aug 2012 22:10:09 +0000 (18:10 -0400)
commit578362575fc2112b828597cc1025e3ead43d43ba
tree243c0fcaa3ce63ed7410473de23d1436a29dbeed
parent597826f00530e8d0c6f4a8ccda2e366f56b65579
Fix threads on Darwin 10.8

 * We used to pun (64-bit) addresses into 32-bit mach_port_name.

 * We used to assume arbitrary 32-bit addresses were always
   acceptable mach port names.

 * Stop doing that. Instead, allocate small descriptors until one's
   address is an acceptable port name (inspired by CCL).

 * Also, keep a lock-free free-list of descriptors to skip the previous
   loop in common cases.

 * There are still some strange issues, but I can't tell if they're new,
   and they seem preferable to consistently lose-ing when spawning threads.
src/runtime/darwin-os.c
src/runtime/x86-64-darwin-os.c
src/runtime/x86-darwin-os.c