Skip to content

Commit a1d92e1

Browse files
authored
Fix various typos and wording in Compiler Internals docs (dotnet#12776)
1 parent 4a80167 commit a1d92e1

8 files changed

+18
-18
lines changed

docs/coding-standards.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The F# compiler code base is slowly being updated to better coding standards. Th
1010

1111
The future work includes
1212

13-
* [ ] Consistent use of fantomas formatting acrossas much of the codebase as feasible
13+
* [ ] Consistent use of fantomas formatting across as much of the codebase as feasible
1414
* [ ] Consistent naming conventions
1515
* [ ] Reduction in line length
1616
* [ ] Reduction in single-character identifiers
@@ -29,7 +29,7 @@ The compiler codebase uses various abbreviations. Here are some of the most comm
2929
| `arginfo` | Argument (parameter) metadata |
3030
| `ccu` | Reference to an F# compilation unit = an F# DLL (possibly including the DLL being compiled) |
3131
| `celem` | Custom attribute element |
32-
| `cenv` | Compilation environment. Means different things in different contexts, but usually a parameter for a singlecompilation state object being passed through a set of related functions in a single phase. The compilation state is often mutable. |
32+
| `cenv` | Compilation environment. Means different things in different contexts, but usually a parameter for a single compilation state object being passed through a set of related functions in a single phase. The compilation state is often mutable. |
3333
| `cpath` | Compilation path, meaning A.B.C for the overall names containing a type or module definition |
3434
| `css` | Constraint solver state. |
3535
| `denv` | Display Environment. Parameters guiding the formatting of types |
@@ -43,7 +43,7 @@ The compiler codebase uses various abbreviations. Here are some of the most comm
4343
| `lid` | Long Identifier |
4444
| `m` | A source code range marker |
4545
| `mimpl` | IL interface method implementation |
46-
| `minfo` | An info object for a method (whet a .NET method, an F# method or a provided method) |
46+
| `minfo` | An info object for a method (whether a .NET method, an F# method or a provided method) |
4747
| `modul` | a Typed Tree structure for a namespace or F# module |
4848
| `pat` | Pattern, a syntactic AST node representing part of a pattern in a pattern match |
4949
| `pinfo` | An info object for a property (whether a .NET property, an F# property or a provided property) |

docs/compiler-startup-performance.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ On all platforms, the following factors affect startup performance:
1414

1515
* Time to open referenced assemblies (for example, `mscorlib.dll`, `FSharp.Core.dll`) and analyze them for the types and namespaces defined. This depends particularly on whether this is correctly done in an on-demand way.
1616

17-
* Time to process "open" declarations are the top of each file. Processing these declarations have been observed to take time in some cases of F# compilation.
17+
* Time to process "open" declarations at the top of each file. Processing these declarations have been observed to take time in some cases of F# compilation.
1818

1919
* Factors specific to the specific files being compiled.
2020

docs/debug-emit.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Emitted debug information includes:
4040
* The PDB file/information (embedded or in PDB file) which contains
4141
* Debug "sequence" points for IL code
4242
* Names of locals and the IL code scopes over which those names are active
43-
* The attributes on IL methods such as `CompilerGeneratedAttribute` and `DebuggerNonUserCodeAttribute`, wee below
43+
* The attributes on IL methods such as `CompilerGeneratedAttribute` and `DebuggerNonUserCodeAttribute`, see below
4444
* We add some codegen to give better debug experiences, see below.
4545

4646
We almost always now emit the [Portable PDB](https://github.com/dotnet/runtime/blob/main/docs/design/specs/PortablePdb-Metadata.md) format.
@@ -73,7 +73,7 @@ We use the terms "sequence point" and "debug point" interchangeably. The word "s
7373

7474
Breakpoints have two existences which must give matching behavior:
7575

76-
* At design-time, before debugging is launched, `ValidateBreakpointLocation` is called to validate every breakpoint. This operators on the SyntaxTree and forms a kind of "gold-standard" about the exact places where break points are valid.
76+
* At design-time, before debugging is launched, `ValidateBreakpointLocation` is called to validate every breakpoint. This operates on the SyntaxTree and forms a kind of "gold-standard" about the exact places where break points are valid.
7777

7878
* At run-time, breakpoints are "mapped" by the .NET runtime to actual sequence points found in the PDB data for .NET methods. The runtime searches all methods with debug points for the relevant document and determines where to "bind" the actual breakpoint to. A typical debugger can bind a breakpoint to multiple locations.
7979

@@ -201,14 +201,14 @@ Other computation expressions such as `async { .. }` or `builder { ... }` get de
201201

202202
* For every `builder.TryFinally` call, a debug point covering the `try` keyword is added immediately within the body lambda expression. A debug point covering the `finally` keyword is added immediately within the finally lambda expression. No debug point is added for the `builder.TryFinally` call itself even if used in statement position.
203203

204-
* For every `builder.Yield`, `builder.Return`, `builder.YieldFrom` or `builder.ReturnFrom` call, debug points are placed on the expression as if it were control flow. For example `yield 1` will place a debug point on `1`and `yield! printfn "hello"; [2]` will place two debug points.
204+
* For every `builder.Yield`, `builder.Return`, `builder.YieldFrom` or `builder.ReturnFrom` call, debug points are placed on the expression as if it were control flow. For example `yield 1` will place a debug point on `1` and `yield! printfn "hello"; [2]` will place two debug points.
205205

206206
* No debug point is added for the `builder.Run`, `builder.Run` or `builder.Delay` calls at the entrance to the computation expression, nor the `builder.Delay` calls implied by `try/with` or `try/finally` or sequential `Combine` calls.
207207

208208
The computations are often "cold-start" anyway, leading to a two-phase debug problem.
209209

210210
The "step-into" and "step-over" behaviour for computation expressions is often buggy because it is performed with respect to the de-sugaring and inlining rather than the original source.
211-
For example, a "step over" on a "while" with a non-inlined `builder.While` will step over the whole call, when the used expects it to step the loop.
211+
For example, a "step over" on a "while" with a non-inlined `builder.While` will step over the whole call, when the user expects it to step the loop.
212212
One approach is to inline the `builder.While` method, and apply `[<InlineIfLambda>]` to the body function. This however has only limited success
213213
as at some points inlining fails to fully flatten. Builders implemented with resumable code tend to be much better in this regards as
214214
more complete inlining and code-flattening is applied.
@@ -298,7 +298,7 @@ Debug points for `task { .. }` poses much harder problems. We use "while" loops
298298

299299
As mentioned above, other computation expressions such as `async { .. }` have significant problems with their debug points.
300300

301-
The main problem is stepping: even after inlining the code for computation expressions is rarely "flattened" enough, so, for example, a "step-into" is required to get into the second part of an `expr1; expr2` construct (i.e. an `async.Combine(..., async.Delay(fun () -> ...)))`) where the user expects to press "step-over".
301+
The main problem is stepping: even after inlining the code for computation expressions is rarely "flattened" enough, so, for example, a "step-into" is required to get into the second part of an `expr1; expr2` construct (i.e. an `async.Combine(..., async.Delay(fun () -> ...))`) where the user expects to press "step-over".
302302

303303
Breakpoints tend to be less problematic.
304304

@@ -336,7 +336,7 @@ These methods also get `CompilerGeneratedAttribute`, and `DebuggerNonUserCodeAtt
336336

337337
> TODO: we should also consider emitting `ExcludeFromCodeCoverageAttribute`, being assessed at time of writing, however the absence of debug points should be sufficient to exclude these.
338338
339-
> TODO: the `NewABC` methods are missing `CompilerGeneratedAttribute`, and `DebuggerNonUserCodeAttribute`. However the absence of debug points should be sufficient to exclude these from code coverage and profiling.
339+
> TODO: the `NewABC` methods are missing `CompilerGeneratedAttribute`, and `DebuggerNonUserCodeAttribute`. However, the absence of debug points should be sufficient to exclude these from code coverage and profiling.
340340
341341
### Generated closures for lambdas
342342

@@ -464,7 +464,7 @@ We do some "extra" code gen to improve debugging. It is likely much of this coul
464464

465465
### 'this' value
466466

467-
For `member x.Foo() = ...` the implementation of the member adds a local variable `x` containing the `this` pointer from `ldarg.0`. THis means hovering over `x` in the method produces the right value, as does `x.Property` etc.
467+
For `member x.Foo() = ...` the implementation of the member adds a local variable `x` containing the `this` pointer from `ldarg.0`. This means hovering over `x` in the method produces the right value, as does `x.Property` etc.
468468

469469
### Pipeline debugging
470470

docs/diagnostics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ and functions
2121

2222
## Diagnostic messages
2323

24-
For the compiler, a key file is `FSComp.txt` olding most of the messages. There are also a few other similar files including some old error messages in `FSStrings.resx`.
24+
For the compiler, a key file is `FSComp.txt` holding most of the messages. There are also a few other similar files including some old error messages in `FSStrings.resx`.
2525

2626
## Adding Diagnostics
2727

docs/large-inputs-and-stack-overflows.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The compiler accepts large inputs such as:
1919

2020
The compiler performs constant folding for large constants so there are no costs to using them at runtime. However, this is subject to a machine's stack size when compiling, leading to `StackOverflow` exceptions if those constants are very large. The same can be observed for certain kinds of array, list, or sequence expressions. This appears to be more prominent when compiling on macOS because macOS has a smaller stack size.
2121

22-
Many sources of `StackOverflow` exceptions prior to F# 4.7 when processing these kinds of constructs were resolved by processing them on the heap via continuation passing techniques. This avoids filling data on the stack and appears to have negligible effects on overall throughout or memory usage of the compiler.
22+
Many sources of `StackOverflow` exceptions prior to F# 4.7 when processing these kinds of constructs were resolved by processing them on the heap via continuation passing techniques. This avoids filling data on the stack and appears to have negligible effects on overall throughput or memory usage of the compiler.
2323

2424
There are two techniques to deal with this
2525

docs/memory-usage.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ In general, the F# compiler allocates a lot of memory. More than it needs to. Ho
2929
Some allocations are much more than others
3030
* Large Object Heap (LOH) allocations (> ~80K) are rarely collected and should only be used for long-lived items.
3131
* Ephemeral allocations that never escape the Gen0 seem to not matter that much, though of course should be considered.
32-
* Don't try to remove all allocations, and don't asseume copy large structs is better than allocating a reference type. Measure instead.
32+
* Don't try to remove all allocations, and don't assume copy large structs is better than allocating a reference type. Measure instead.
3333

3434
To analyze memory usage of F# tooling, you have two primary avenues:
3535

docs/optimizations.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ let sumBy f xs =
6565
loop xs 0
6666
```
6767

68-
The inner `loop` function is emitted as a separate static method named `loop@2` and incurs no overhead involved with allocatin an `FSharpFunc` at runtime.
68+
The inner `loop` function is emitted as a separate static method named `loop@2` and incurs no overhead involved with allocating an `FSharpFunc` at runtime.
6969

7070
In [`LowerCallsAndSeqs.fs`](https://github.com/dotnet/fsharp/blob/main/src/fsharp/LowerCallsAndSeqs.fs), a few optimizations are performed:
7171

docs/overview.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The following are the most relevant parts of the F# compiler tooling, making up
5353

5454
## Key compiler phases
5555

56-
The following is a diagram of how different phases of F# compiler work:
56+
The following is a diagram of how the different phases of the F# compiler work:
5757

5858
![F# compiler phases](http://fsharp.github.io/img/fscomp-phases.png)
5959

@@ -81,7 +81,7 @@ The following are the key phases and high-level logical operations of the F# com
8181

8282
* _Pattern match compilation_, see [PatternMatchCompilation.fsi](https://github.com/dotnet/fsharp/blob/main/src/fsharp/PatternMatchCompilation.fsi)/[PatternMatchCompilation.fs](https://github.com/dotnet/fsharp/blob/main/src/fsharp/PatternMatchCompilation.fs). Accepts a subset of checked Typed Tree nodes representing F# pattern matching and produces Typed Tree expressions implementing the pattern matching. Called during type checking as each construct involving pattern matching is processed.
8383

84-
* _Constraint solving_, see [ConstraintSolver.fsi](https://github.com/dotnet/fsharp/blob/main/src/fsharp/ConstraintSolver.fsi)/[ConstraintSolver.fs](https://github.com/dotnet/fsharp/blob/main/src/fsharp/ConstraintSolver.fs).A constraint solver state is maintained during type checking of a single file, and constraints are progressively asserted (i.e. added to this state). Fresh inference variables are generated and variables are eliminated (solved). Variables are also generalized at various language constructs, or explicitly declared, making them "rigid". Called during type checking as each construct is processed.
84+
* _Constraint solving_, see [ConstraintSolver.fsi](https://github.com/dotnet/fsharp/blob/main/src/fsharp/ConstraintSolver.fsi)/[ConstraintSolver.fs](https://github.com/dotnet/fsharp/blob/main/src/fsharp/ConstraintSolver.fs). A constraint solver state is maintained during type checking of a single file, and constraints are progressively asserted (i.e. added to this state). Fresh inference variables are generated and variables are eliminated (solved). Variables are also generalized at various language constructs, or explicitly declared, making them "rigid". Called during type checking as each construct is processed.
8585

8686
* _Post-inference type checks_, see [PostInferenceChecks.fsi](https://github.com/dotnet/fsharp/blob/main/src/fsharp/PostInferenceChecks.fsi)/[PostInferenceChecks.fs](https://github.com/dotnet/fsharp/blob/main/src/fsharp/PostInferenceChecks.fs). Called at the end of type checking/inference for each file. A range of checks that can only be enforced after type checking on a file is complete, such as analysis when using `byref<'T>` or other `IsByRefLike` structs.
8787

@@ -112,4 +112,4 @@ The F# compiler is bootstrapped. That is, an existing F# compiler is used to bui
112112

113113
## FSharp.Build
114114

115-
`FSharp.Build.dll` and `Microsoft.FSharp.targets` give MSBuild support for F# projects (`.fsproj`) and contain the. Although not strictly part of the F# compiler, they are essential for using F# in all contexts for .NET, aside from some more targeted scripting scenarios. The targets expose things like the `CoreCompile` and `Fsc` tasks called by MSBuild.
115+
`FSharp.Build.dll` and `Microsoft.FSharp.targets` give MSBuild support for F# projects (`.fsproj`) and contain the targets. Although not strictly part of the F# compiler, they are essential for using F# in all contexts for .NET, aside from some more targeted scripting scenarios. The targets expose things like the `CoreCompile` and `Fsc` tasks called by MSBuild.

0 commit comments

Comments
 (0)