-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
track call depth separately from loop count in VM (#24512)
refs #24503 Infinite recursions currently are not tracked separately from infinite loops, because they also increase the loop counter. However the max infinite loop count is very high by default (10 million) and does not reliably catch infinite recursions before consuming a lot of memory. So to protect against infinite recursions, we separately track call depth, and add a separate option for the maximum call depth, much lower than the maximum iteration count by default (2000, the same as `nimCallDepthLimit`). --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
- Loading branch information
Showing
6 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
proc foo(x: int) = | ||
if x < 0: | ||
echo "done" | ||
else: | ||
foo(x + 1) #[tt.Error | ||
^ maximum call depth for the VM exceeded; if you are sure this is not a bug in your code, compile with `--maxCallDepthVM:number` (current value: 2000)]# | ||
|
||
static: | ||
foo(1) |