[context] for Mac OS X (and other platforms) via libtask

I have put some code up on github that uses libtask's implementation of asm based context switching as a backend implementation of boost::context. I have verified that it allows me to use Boost.Fiber on Mac OS X. I suspect that my changes would allow Boost.Context to work with arm, power pc, and any other platform supported by libtask. The protected_stack allocator does not seem to work on OS X, so I switched to using malloc/free. I wonder if this is the reason why the ucontext implementation was not working on OS X either. Considering ucontext on Mac OS X is deprecated and asm 100x faster, I am not sure it is worth while to get the ucontext implementation working. I suspect that the correct solution would be to modify the code in libs/context/src/libtask to implement the fcontext pattern, but I have no experience with asm. https://github.com/bytemaster/boost_context_osx/tree/master/libs/context/src

Am 06.02.2011 15:14, schrieb Daniel Larimer:
I have put some code up on github that uses libtask's implementation of asm based context switching as a backend implementation of boost::context. I have verified that it allows me to use Boost.Fiber on Mac OS X. I suspect that my changes would allow Boost.Context to work with arm, power pc, and any other platform supported by libtask.
The protected_stack allocator does not seem to work on OS X, so I switched to using malloc/free. I wonder if this is the reason why the ucontext implementation was not working on OS X either. Considering ucontext on Mac OS X is deprecated and asm 100x faster, I am not sure it is worth while to get the ucontext implementation working.
I suspect that the correct solution would be to modify the code in libs/context/src/libtask to implement the fcontext pattern, but I have no experience with asm.
https://github.com/bytemaster/boost_context_osx/tree/master/libs/context/src
Mac OS X uses the SYSV ABI - the problem is the MACH-O binary format which I've to address if the lib is build upon PIC. Do you test on i386 or x86_64? Oliver

On Feb 6, 2011, at 9:55 AM, Oliver Kowalke wrote:
Am 06.02.2011 15:14, schrieb Daniel Larimer:
I have put some code up on github that uses libtask's implementation of asm based context switching as a backend implementation of boost::context. I have verified that it allows me to use Boost.Fiber on Mac OS X. I suspect that my changes would allow Boost.Context to work with arm, power pc, and any other platform supported by libtask.
The protected_stack allocator does not seem to work on OS X, so I switched to using malloc/free. I wonder if this is the reason why the ucontext implementation was not working on OS X either. Considering ucontext on Mac OS X is deprecated and asm 100x faster, I am not sure it is worth while to get the ucontext implementation working.
I suspect that the correct solution would be to modify the code in libs/context/src/libtask to implement the fcontext pattern, but I have no experience with asm.
https://github.com/bytemaster/boost_context_osx/tree/master/libs/context/src
Mac OS X uses the SYSV ABI - the problem is the MACH-O binary format which I've to address if the lib is build upon PIC.
Do you test on i386 or x86_64?
I am using a MacBook Pro running 10.6.6 and compiled for x86_64, but libtask runs on both i386 and x86_64 as well as PowerPC and I did not modify the context code from libtask, I simply called it from boost::context::impl_t. Assuming a 3rd party library has a boost compatible license, are there any problems integrating source from a 3rd party library in a boost library submission? Dan

On 2/6/2011 2:14 PM, Daniel Larimer wrote:
I have put some code up on github that uses libtask's implementation of asm based context switching as a backend implementation of boost::context. I have verified that it allows me to use Boost.Fiber on Mac OS X. I suspect that my changes would allow Boost.Context to work with arm, power pc, and any other platform supported by libtask.
The protected_stack allocator does not seem to work on OS X, so I switched to using malloc/free. I wonder if this is the reason why the ucontext implementation was not working on OS X either. Considering ucontext on Mac OS X is deprecated and asm 100x faster, I am not sure it is worth while to get the ucontext implementation working.
I suspect that the correct solution would be to modify the code in libs/context/src/libtask to implement the fcontext pattern, but I have no experience with asm.
https://github.com/bytemaster/boost_context_osx/tree/master/libs/context/src
Hi Daniel, Did you see the response I posted in your other recent thread on this topic? http://lists.boost.org/Archives/boost/2011/01/176236.php It might fix the problems you're seeing on OS X without introducing the libtask dependency. Apologies for the noise if you've already seen/tried this. Cheers, Edd
participants (3)
-
Daniel Larimer
-
Edd Dawson
-
Oliver Kowalke