Hello,

I have been trying to implement coroutines in v8 based on Gary Hai's
work, js-coroutine ( http://code.google.com/p/js-coroutine/ ) which
uses libpcl to provide the coroutine support. This method seems to
work very well but for exceptions which cause segfaults.

I took a look at how exception handling is implemented in v8, and as
far as I can tell there is basically a stack of TryCatch objects
attached to a per-thread singleton. I believe this causes a problem
when more than one coroutine includes a try/catch block within the
same thread.

For instance, consider coro1 which enters a try/catch block, then
yields to coro2 which subsequently enters a try/catch block and yields
back to coro1. Now, when an error is thrown in coro1, I believe that
it's the coro2 try/catch that actually is used to handle the error.

Incidentally, the Error constructor also seems to cause a segfault in
this instance. Perhaps it is related, but I haven't really
investigated that.

I am not particularly familiar with the v8 code base, but I want to
learn enough to solve this problem. I am incredibly excited about the
prospect of true coroutines in the JavaScript, and I feel like it's
really close. Any pointers or advice would be very helpful.

Thanks!

Michael Carter

-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to