support coroutine

A few questions

- How about a variance of `emscripten_coroutine_create` that allows customized stack size?
- Do we need `emscriptens_coroutine_destroy`, for those coroutine we don't need anymore, but still running?
- Do we need to save and restore STACK_MAX?
- The code is not actually asm.js validated, not sure how to make _malloc and _free work.
OK, it's done.


On Thu, Aug 7, 2014 at 4:19 PM, Alon Zakai <notifications@github.com> wrote:

> In src/library_async.js:
>
> > + *  4 callee's STACKTOP
> > + *  8 my async ctx
> > + * 12 my STACKTOP
> > + * 16 coroutine function
> > + * 20 coroutine arg
> > + * 24 my stack:
> > + *    ...
> > + */
> > +  emscripten_coroutine_create__sig: 'iii',
> > +  emscripten_coroutine_create__asm: true,
> > +  emscripten_coroutine_create__deps: ['malloc'],
> > +  emscripten_coroutine_create: function(f, arg) {
> > +    f = f|0;
> > +    arg = arg|0;
> > +    var coroutine = 0;
> > +    coroutine = _malloc(4096);
>
> No, just STACK_MAX
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/kripken/emscripten/pull/2612/files#r15970608>.
>