Closed Bug 584594 Opened 14 years ago Closed 14 years ago

Recursion limit differs between interp and -m

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jruderman, Unassigned)

References

Details

(function too_much_recursion(i){print(i);{too_much_recursion(i+1)}})(0)

interp: 2999
-j:     2999
-m:     3000

I could tell my fuzzer to ignore differences when it's intentionally doing too-much-recursion, but then I could miss some bugs.  Also, the fuzzer often unintentionally causes too-much-recursion, and it's hard to detect those cases.
To free some of my memory:

Related to this, we can recurse beyond JS_MAX_INLINE_COUNT -- JaegerShot() sets the VMFrame.inlineCallCount to 0, disregarding the inlineCallCount seen by the interpreter.

So if we write a function that recursively has an unjittable function calling a jittable function calling the unjittable function, the inlineCallCount keeps getting reset, so we keep recursing until we run out of stack frames.
Jesse, I'm thinking this is WONTFIX. As of bug 586886 recursion limits are now based on stack usage and not call counts. I think this is the right decision for the JIT, but not necessarily the interpreter & tracer.

We could do it in both places to try and maintain some semblance of consistency, but this consistency was a farce to begin with - finicky and unreliable, like checkStats() or timing. Certainly we can no longer have tests that assert the recursion limit precisely matches some given number of calls.
I've modified the fuzzer so it doesn't do output-comparison when it intentionally generates a too-much-recursion function.

Sometimes it accidentally generates a too-much-recursion function.  This is a contrived example, but I'd expect the fuzzer to generate things like it:

var i=0; try { function r() { ++i; r(); } r(); } catch(e) { } print(i);

We'll see how often this happens.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
Sounds good, thanks for the workaround.
We ultimately went with a more robust workaround in bug 706433: shells compiled with --enable-more-deterministic print a message on stderr when they hit a recursion limit.
You need to log in before you can comment on or make changes to this bug.