Hey Marc (or anyone who has used Jss from the Dumping Grounds on the wiki),
I grabbed your scheme-to-javascript compiler off the dumping grounds, and it works great in Safari. In Firefox 2 & 3 however, the javascript engine throws the error "too much recursion." I will be looking through the code myself, but do you think there's a fix? If it's a real stack overflow error (not from an infinite loop), you could do some optimizing before spitting out the Javascript. This might get too involved, and the compiler might not have all the information to make guesses at inlining, etc. I haven't studied CPS- transforming compilers enough yet.
- James
Afficher les réponses par date
JSS uses CPS conversion and trampolines, so the call graph is (should be?) of a small constant depth. I don't know why you are getting a "too much recursion error". The only thing I can think of is that the JavaScript code itself is too heavily nested (syntactically) and the JavaScript interpreter/compiler overflows the compile-time stack while parsing/compiling the code. Does the problem occur for large files only? Have you tried JSS on other browsers? I'm curious which ones encounter the same problem. Do you have a test case I can try?
Marc
On 30-May-08, at 3:51 PM, James Long wrote:
Hey Marc (or anyone who has used Jss from the Dumping Grounds on the wiki),
I grabbed your scheme-to-javascript compiler off the dumping grounds, and it works great in Safari. In Firefox 2 & 3 however, the javascript engine throws the error "too much recursion." I will be looking through the code myself, but do you think there's a fix? If it's a real stack overflow error (not from an infinite loop), you could do some optimizing before spitting out the Javascript. This might get too involved, and the compiler might not have all the information to make guesses at inlining, etc. I haven't studied CPS- transforming compilers enough yet.
- James
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
It happens (for me) with any JSS file - the runtime code itself is generating the error. Even a simple JSS file with the code `(display "Hello World")' causes the error. That doesn't happen for you? I tried disabling Firebug or anything else that might be causing the problem, but it still happens. I looked around for the Javascript error on the net and I couldn't find any oddities about it. Are you testing Firefox on OS X? It happens for me on Firefox 2 & 3 on OS X Leopard.
It works under Safari, and I can't test IE at the moment.
I was indeed able to reproduce the same Javascript error by kicking the stack depth over 5000.
I'd love to study the compiler at some point - when I do that maybe I'll try to give a better bug report.
- James
On May 31, 2008, at 9:09 AM, Marc Feeley wrote:
JSS uses CPS conversion and trampolines, so the call graph is (should be?) of a small constant depth. I don't know why you are getting a "too much recursion error". The only thing I can think of is that the JavaScript code itself is too heavily nested (syntactically) and the JavaScript interpreter/compiler overflows the compile-time stack while parsing/compiling the code. Does the problem occur for large files only? Have you tried JSS on other browsers? I'm curious which ones encounter the same problem. Do you have a test case I can try?
Marc
On 30-May-08, at 3:51 PM, James Long wrote:
Hey Marc (or anyone who has used Jss from the Dumping Grounds on the wiki),
I grabbed your scheme-to-javascript compiler off the dumping grounds, and it works great in Safari. In Firefox 2 & 3 however, the javascript engine throws the error "too much recursion." I will be looking through the code myself, but do you think there's a fix? If it's a real stack overflow error (not from an infinite loop), you could do some optimizing before spitting out the Javascript. This might get too involved, and the compiler might not have all the information to make guesses at inlining, etc. I haven't studied CPS- transforming compilers enough yet.
- James
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
If I remember correctly, the code works under Safari and Opera (never tested it on IE). After some testing I was able to compile simple things such as (display "hello") by removing the compiler from the run-time, but anything more complicated then a simple display will give the too much recursion error.
Catherine
James Long wrote:
It happens (for me) with any JSS file - the runtime code itself is generating the error. Even a simple JSS file with the code `(display "Hello World")' causes the error. That doesn't happen for you? I tried disabling Firebug or anything else that might be causing the problem, but it still happens. I looked around for the Javascript error on the net and I couldn't find any oddities about it. Are you testing Firefox on OS X? It happens for me on Firefox 2 & 3 on OS X Leopard.
It works under Safari, and I can't test IE at the moment.
I was indeed able to reproduce the same Javascript error by kicking the stack depth over 5000.
I'd love to study the compiler at some point - when I do that maybe I'll try to give a better bug report.
- James
On May 31, 2008, at 9:09 AM, Marc Feeley wrote:
JSS uses CPS conversion and trampolines, so the call graph is (should be?) of a small constant depth. I don't know why you are getting a "too much recursion error". The only thing I can think of is that the JavaScript code itself is too heavily nested (syntactically) and the JavaScript interpreter/compiler overflows the compile-time stack while parsing/compiling the code. Does the problem occur for large files only? Have you tried JSS on other browsers? I'm curious which ones encounter the same problem. Do you have a test case I can try?
Marc
On 30-May-08, at 3:51 PM, James Long wrote:
Hey Marc (or anyone who has used Jss from the Dumping Grounds on the wiki),
I grabbed your scheme-to-javascript compiler off the dumping grounds, and it works great in Safari. In Firefox 2 & 3 however, the javascript engine throws the error "too much recursion." I will be looking through the code myself, but do you think there's a fix? If it's a real stack overflow error (not from an infinite loop), you could do some optimizing before spitting out the Javascript. This might get too involved, and the compiler might not have all the information to make guesses at inlining, etc. I haven't studied CPS- transforming compilers enough yet.
- James
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
On 2-Jun-08, at 2:05 PM, Catherine Gaudron wrote:
If I remember correctly, the code works under Safari and Opera (never tested it on IE). After some testing I was able to compile simple things such as (display "hello") by removing the compiler from the run-time, but anything more complicated then a simple display will give the too much recursion error.
Catherine
The problem appears to be that the Firefox JavaScript parser is overflowing the ***compiler's*** stack. I verified this with the code below.
So one idea would be to modify the JavaScript code generator to flatten the code. I'm not sure how easy this is... it requires a kind of lambda lifting of the code.
I'll look into it.
Marc
<script language="JavaScript">
function f(x) { return x+1 }
// This expression works as expected: alert(f(f(f(f(0)))))
// The following expression gives a "too much recursion" error. // There is no "recursion" at run time, but possibly some at compile time. // A better error message would be "too much syntactic nesting". It // is probable that the Firefox JavaScript front-end (i.e. parser) is // written in JavaScript and uses recursion, so the JavaScript runtime // system detects a stack overflow while parsing/compiling the code. // On Firefox 1.5.0.1 the maximal nesting of calls to f seems to be 344 // which is not much...
alert( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f (f (f (f (f (f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f( 0 ))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )))))))))))))))))))))))))))))))))))))))) )
</script>