Charles Oliver Nutter schrieb: > On Fri, Nov 13, 2009 at 11:09 AM, Jochen Theodorou <[email protected]> wrote: >> the alternative would be to generate for run something like: >> >> private Object run$co(Context context) { >> l0: >> switch (context.jumpToLabel) { >> case 1: jmp l1 >> } >> context.l0=0; >> for (;context.l0<10; context.l0++) { >> System.out.println(context.l0); >> l1: >> context.jumpToLabel=1; >> return null; >> } >> context.jumpToLabel=-1; >> return null; >> } >> >> jumpToLabel is used to identify the entry/exit point, context will hold >> all local variables (l*) >> >> Where would such an approach be not as good as yours? > > This is basically what all the bytecode-weaving coroutine/continuation > libraries do. Jython also does this for their > lambda/generator/coroutine stuff so they can jump in and out. The > primary issue is that you can only jump in and out of the methods you > have performed this transformation on. That means you can't call > through any untransformed code and expect to be able to resume it.
but isn't here yield responsible for that? Does this means the coroutine support here will allow calling yield from outside or from deep down the stack? It will it mean the stack will be kept? This was not clear from the first post. Since only one Thread is used I assumed it might not be the case. bye Jochen -- Jochen "blackdrag" Theodorou The Groovy Project Tech Lead (http://groovy.codehaus.org) http://blackdragsview.blogspot.com/ _______________________________________________ mlvm-dev mailing list [email protected] http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
