-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] --enable=effects does not adequately clear the stack #1533
Comments
I'm getting
from your second link. |
Yeah, if you open the developer console you'll see the recursion error. (You might need to click "clear cache" and then "synthesize" again.). I'm not sure why webworkers aren't catching the exception |
I've pushed a change so that, when it redeploys, the error message should be correctly caught and cached and displayed. |
The function causing the stack overflow is not tailrec
I would not be surprised if the implementation of It would be easier to investigate with What version of ocaml are you using ? Adding |
Here are the .ml sources, if you want to investigate more. It's just one .ml file (and corresponding .mli file), should be fully standalone except for needing Adding |
I confirm that My statements about this in another thread were probably too imprecise. If I’m remembering correctly, only the functions that may transitively call effect performers or continuation resumers are translated to CPS, and thus will "benefit" from regular stack clearing as a side effect. |
We could imagine a mode that would perform cps rewriting unconditionally |
For performance reasons, we perform a partial CPS transformation, keeping as much as we can the code in direct style. The transformation will preserve tail recursion, but non tail recursive functions can still exhaust the stack. You can just replace your definition of function let rec rev_app l1 l2 =
match l1 with
[] -> l2
| a :: l -> rev_app l (a :: l2)
let app l1 l2 = rev_app (rev_app l1 []) l2 |
I don’t know how the code is generated, but for the record, the stdlib has |
@vouillon, should we close this with a |
Right, this is not a tail-recursion issue. |
Describe the bug
https://mit-plv.github.io/fiat-crypto/?argv=%5B%22word-by-word-montgomery%22%2C%22p256%22%2C%2232%22%2C%222%5E256-2%5E224%2B2%5E192%2B2%5E96-1%22%5D&interactive
gives
Uncaught RangeError: Maximum call stack size exceeded
fiat_crypto.tar.gz is an tar.gz of the webpage, though you'll need to run a simple server to play with it because it uses webworkers. The input into the input box is
word-by-word-montgomery p256 32 2^256-2^224+2^192+2^96-1
in string mode or["word-by-word-montgomery","p256","32","2^256-2^224+2^192+2^96-1"]
in json mode, it takes a couple minutes (?) before throwing the error.See also #1530 for more details
The text was updated successfully, but these errors were encountered: