GMail behaved badly with my last message, hiding most of it as "quoted text", even though most of it was not. Since I see both of you are on GMail too, you need to click on "Show quoted text" to see it.
My apologies to lurkers or non-participants for the resend. On Dec 29, 2007 6:06 PM, John Cowan <[EMAIL PROTECTED]> wrote: > On Dec 29, 2007 3:54 PM, Ola Bini <[EMAIL PROTECTED]> wrote: > > > The problem > > is that they're all using things that require you to manipulate the > > stack in some way. setjmp and longjmp can of course be duplicated in a > > manner by using exceptions, > > Correct. > > > but the rest of the stack manipulation doesn't seem possible. > > > No other tricks are required! Since only pointers and primitives, > never objects, are allocated on the Java stack, no object eviction is > needed, so you just keep on calling and never returning (hence the > allusion to "MTA Charlie") and finally throw the exception to kill the > stack, which is now 100% garbage. > > (If there can be plain Java code mixed into the call stack, there is > some danger that someone will do a "catch(Throwable e)" or > "catch(RuntimeException e)" and screw the mechanism.) > > Kelly Nawrocke writes: > > > I had some papers on A-Normal form and trampolining on the JVM > > ANF and CPS are of course equivalent, so it's hardly surprising that > what you can do with one, you can do with the other. > > > They found that > > returning to the trampoline loop every N frames (~40 was optimal at > > the time) was the most efficient. > > This is essentially what I described in my last post -- throw the > exception every N calls. Of course the size of N depends on how much > stack you allocate to your JVM at startup, which depends on how you > are using whatever physical memory you have. After some experiments > with trying to set the stack size experimentally at system > configuration time, current versions of Chicken just set an arbitrary > C-stack size (128 KB, I think) which can be overridden either at > system configuration time or at run time. > > The exception should override the fillInStackTrace method, which is > what costs the most time in throwing an exception. > > -- > > GMail doesn't have rotating .sigs, but you can see mine at > http://www.ccil.org/~cowan/signatures > -- GMail doesn't have rotating .sigs, but you can see mine at http://www.ccil.org/~cowan/signatures --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---
