You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/large-inputs-and-stack-overflows.md
+13-7Lines changed: 13 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,13 +89,12 @@ The previous example is considered incomplete, because arbitrary _combinations_
89
89
90
90
## Stack Guards
91
91
92
-
The `StackGuard` type is used to count synchronous recursive processing and move to a new thread if a limit is reached. Compilation globals are re-installed. Sample:
92
+
The `StackGuard` type is used to move to a new thread if there is no sufficient stack space for a synchronous recursive call. Compilation globals are re-installed. Sample:
93
93
94
94
```fsharp
95
-
let TcStackGuardDepth = StackGuard.GetDepthOption "Tc"
96
95
97
96
...
98
-
stackGuard = StackGuard(TcMaxStackGuardDepth)
97
+
stackGuard = StackGuard("TcExpr")
99
98
100
99
let rec ....
101
100
@@ -108,10 +107,17 @@ and TcExpr cenv ty (env: TcEnv) tpenv (expr: SynExpr) =
108
107
109
108
```
110
109
111
-
Note stack guarding doesn't result in a tailcall so will appear in recursive stack frames, because a counter must be decremented after the call. This is used systematically for recursive processing of:
110
+
Note stack guarding doesn't result in a tailcall so will appear in recursive stack frames, because a counter must be decremented after the call.
112
111
113
-
* SyntaxTree SynExpr
114
-
* TypedTree Expr
112
+
Compiling with `--times` option will show a summary if any thread switches were made due to stack guarding:
0 commit comments