Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4767c60
Add Roslyn-format EnC CustomDebugInformation codec and portable PDB m…
NatElkins Jul 1, 2026
e9e88a7
Use ProcessStartInfo.Arguments for net472 compatibility
NatElkins Jul 1, 2026
6976a6b
Make the EnC CDI test module public for xunit v3 discovery
NatElkins Jul 2, 2026
c96f5da
Add ECMA-335 EnC metadata delta writer
NatElkins Jul 1, 2026
c3ed355
Fix EnC CDI cross-validation test process launch on Desktop and bare …
NatElkins Jul 3, 2026
16962d4
Remove extra EOF blank line in delta metadata tests
NatElkins Jul 8, 2026
22b5a3e
Extract stable synthesized-name replay layer
NatElkins Jul 2, 2026
42d793f
Fix generated-name scope test in stable names slice
NatElkins Jul 8, 2026
09bbef5
Add typed-tree diff slice for hot reload
NatElkins Jul 2, 2026
aebb67a
Merge branch 'hotreload-stable-names' into hotreload-baseline-reader
NatElkins Jul 9, 2026
ebbf20b
Add hot reload baseline reader state
NatElkins Jul 3, 2026
9727c67
Fix synthesized-name snapshot assertions to use the array equality ov…
NatElkins Jul 3, 2026
e8bdb01
Merge branch 'hotreload-typedtree-diff' into hotreload-delta-emitter
NatElkins Jul 9, 2026
7365d30
Merge branch 'enc-metadata-delta-writer' into hotreload-delta-emitter
NatElkins Jul 9, 2026
ab53d0f
Extract hot reload delta emitter
NatElkins Jul 3, 2026
55ca844
Align the signature-change diff test with the evolved differ classifi…
NatElkins Jul 3, 2026
c2028e6
Extract hot reload session slice
NatElkins Jul 3, 2026
c1982e6
Fix CI compile breaks and extraction debris in the session slice tests
NatElkins Jul 3, 2026
ba39bcb
Fix net472 and CI-image portability breaks in session slice tests
NatElkins Jul 3, 2026
66232df
Drop the netcore-only Contains overload from delta builder tests
NatElkins Jul 3, 2026
44e96ae
Gate the Roslyn baseline comparison tests to .NET Core
NatElkins Jul 3, 2026
60b5336
Normalize fixture line endings before update-source splicing
NatElkins Jul 3, 2026
51eb5ec
Update ilxgen name-path architecture guard
NatElkins Jul 8, 2026
b4d5b23
Remove duplicate delta metadata test copies
NatElkins Jul 8, 2026
d4d0bde
Remove duplicate compiler global reset member
NatElkins Jul 8, 2026
884759d
Remove duplicate compiler global reset signature
NatElkins Jul 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/release-notes/.FSharp.Compiler.Service/11.0.100.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@

### Added

* Added internal synthesized-name replay infrastructure for compiler-generated names, preserving normal compilation output while enabling future hot reload name stability work.
* Add an internal typed-tree diff utility for future F# hot reload edit classification. It is not called by normal compilation. ([PR #19941](https://github.com/dotnet/fsharp/pull/19941))
* Added internal F# hot reload delta emitter and symbol matcher infrastructure with direct emitter test coverage.
* Added `FSharpMemberOrFunctionOrValue.IsPropertyAccessor` convenience property that returns true for compiler-generated property accessors (`get_X` / `set_X`). ([Issue #18157](https://github.com/dotnet/fsharp/issues/18157), [PR #19883](https://github.com/dotnet/fsharp/pull/19883))
* Added warning FS3884 when a function or delegate value is used as an interpolated string argument. ([PR #19289](https://github.com/dotnet/fsharp/pull/19289))
* Symbols: add ObsoleteDiagnosticInfo ([PR #19359](https://github.com/dotnet/fsharp/pull/19359))
Expand All @@ -140,6 +143,10 @@
* Checker: recover on checking language version ([PR ##19970](https://github.com/dotnet/fsharp/pull/19970))
* Implied argument names for function-to-delegate coercions now fall back to the delegate's `Invoke` parameter names when the function has no recoverable names (e.g. a partial application like `System.Func<int, int>((+) 1)`), instead of synthetic `delegateArg0`, `delegateArg1`, … names. ([PR #20001](https://github.com/dotnet/fsharp/pull/20001))
* Add internal `ResetCompilerGeneratedNameState` to `CompilerGlobalState` name generators so warm-checker re-compilation can produce fresh-process-identical generated names. ([PR #20017](https://github.com/dotnet/fsharp/pull/20017))
* Add Roslyn-format EnC CustomDebugInformation codec and portable PDB method CDI emission support to AbstractIL. ([PR #20018](https://github.com/dotnet/fsharp/pull/20018))
* Add internal ECMA-335 Edit-and-Continue metadata delta writer to AbstractIL. ([PR #20019](https://github.com/dotnet/fsharp/pull/20019))
* Add internal `ResetCompilerGeneratedNameState` to `CompilerGlobalState` name generators so warm-checker re-compilation can produce fresh-process-identical generated names. ([PR #20017](https://github.com/dotnet/fsharp/pull/20017))
* Add experimental hot reload support: `--test:HotReloadDeltas` baseline capture in fsc, EnC metadata/IL/PDB delta emission, rude-edit detection, and an `FSharpChecker` session API (`CreateHotReloadSession`, with `AddProject`/`EmitDelta`/`Commit`/`Discard`). Off by default; flag-off compilation is unchanged. ([Issue #11636](https://github.com/dotnet/fsharp/issues/11636), [PR #19941](https://github.com/dotnet/fsharp/pull/19941))

### Improved

Expand All @@ -151,4 +158,4 @@
* Exception field serialization (`GetObjectData` and field-restoring constructor) is now gated behind `langversion:11` (`LanguageFeature.ExceptionFieldSerializationSupport`). With langversion ≤10, exception codegen is unchanged from pre-#19342 behavior. ([PR #19746](https://github.com/dotnet/fsharp/pull/19746))

### Breaking Changes
* Optimizer: don't inline named functions in debug builds ([PR #19548](https://github.com/dotnet/fsharp/pull/19548)
* Optimizer: don't inline named functions in debug builds ([PR #19548](https://github.com/dotnet/fsharp/pull/19548)
1 change: 1 addition & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ These release notes track our current efforts to document changes to the F# proj

### FSharp Compiler Service (main)

* Added internal hot reload baseline reading for recorded EnC state and synthesized-name snapshot PDB data.
* In FSharpParsingOptions, rename ConditionalCompilationDefines --> ConditionalDefines
* Some syntax tree nodes have changed, e.g. introduction of SyntaxTree trivia
* Resolved expressions (FSharpExpr) now reveal debug points, you must match them explicitly using `DebugPoint(dp, expr)`
Expand Down
186 changes: 186 additions & 0 deletions src/Compiler/AbstractIL/DeltaIndexSizing.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.

/// Computes coded index sizing for delta metadata emission.
///
/// This module determines whether various metadata indices require 2 or 4 bytes
/// based on row counts in the metadata tables. This is per ECMA-335 II.24.2.6.
///
/// Uses TableNames from BinaryConstants.fs for ECMA-335 metadata table indices,
/// following the same pattern as the baseline IL writer (ilwrite.fs).
module internal FSharp.Compiler.AbstractIL.DeltaIndexSizing

open FSharp.Compiler.AbstractIL.BinaryConstants
open FSharp.Compiler.AbstractIL.ILDeltaHandles
open FSharp.Compiler.AbstractIL.DeltaMetadataEncoding

type MetadataHeapSizes = FSharp.Compiler.AbstractIL.ILBinaryWriter.MetadataHeapSizes

/// Holds computed "bigness" flags for all coded index types.
/// When true, the index requires 4 bytes; when false, 2 bytes suffice.
type CodedIndexSizes =
{
StringsBig: bool
GuidsBig: bool
BlobsBig: bool
SimpleIndexBig: bool[]
TypeDefOrRefBig: bool
TypeOrMethodDefBig: bool
HasConstantBig: bool
HasCustomAttributeBig: bool
HasFieldMarshalBig: bool
HasDeclSecurityBig: bool
MemberRefParentBig: bool
HasSemanticsBig: bool
MethodDefOrRefBig: bool
MemberForwardedBig: bool
ImplementationBig: bool
CustomAttributeTypeBig: bool
ResolutionScopeBig: bool
}

let private tableSize (tableRowCounts: int[]) (table: int) = tableRowCounts.[table]

let private totalRowCount (tableRowCounts: int[]) (externalRowCounts: int[]) (table: int) =
let index = table

let external =
if externalRowCounts.Length = tableRowCounts.Length then
externalRowCounts.[index]
else
0

tableRowCounts.[index] + external

let private referenceExceedsLimit (tableRowCounts: int[]) (externalRowCounts: int[]) (maxValueExclusive: int) (tables: int[]) =
tables
|> Array.exists (fun table -> totalRowCount tableRowCounts externalRowCounts table >= maxValueExclusive)

/// Determines if a coded index requires 4 bytes (big) or 2 bytes (small).
/// For EnC deltas (uncompressed), all indices are 4 bytes.
/// For compressed metadata, size depends on whether any referenced table
/// has enough rows to overflow the available bits after the tag.
let private codedBigness (tagBits: int) (tableRowCounts: int[]) (externalRowCounts: int[]) (isCompressed: bool) (tables: int[]) =
if not isCompressed then
// EnC deltas always use 4-byte indices
true
else
let limit = pown 2 (16 - tagBits)
referenceExceedsLimit tableRowCounts externalRowCounts limit tables

let private isSimpleIndexBig (tableRowCounts: int[]) (externalRowCounts: int[]) (isCompressed: bool) (tableIndex: int) =
if not isCompressed then
true
else
let local =
if tableIndex < tableRowCounts.Length then
tableRowCounts.[tableIndex]
else
0

let external =
if tableIndex < externalRowCounts.Length then
externalRowCounts.[tableIndex]
else
0

local + external >= 0x10000

/// Compute coded index sizes for all index types.
/// This determines the byte width of each reference type in the metadata tables.
let compute (tableRowCounts: int[]) (externalRowCounts: int[]) (heapSizes: MetadataHeapSizes) (isEncDelta: bool) : CodedIndexSizes =

let isCompressed = not isEncDelta

// Heap indices: 4 bytes if uncompressed or heap >= 64KB
let stringsBig = (not isCompressed) || heapSizes.StringHeapSize >= 0x10000
let blobsBig = (not isCompressed) || heapSizes.BlobHeapSize >= 0x10000
let guidsBig = (not isCompressed) || heapSizes.GuidHeapSize >= 0x10000

// Simple table indices
let simpleIndexBig =
Array.init DeltaTokens.TableCount (fun i -> isSimpleIndexBig tableRowCounts externalRowCounts isCompressed i)

// Helper to compute coded index bigness for a set of tables
let coded tag tables =
codedBigness tag tableRowCounts externalRowCounts isCompressed tables

// -------------------------------------------------------------------------
// Coded Index Definitions (per ECMA-335 II.24.2.6)
// -------------------------------------------------------------------------
// Each coded index combines a tag (to identify which table) with a row index.
// The tag uses the low N bits; the row index uses the remaining bits.
// If any table in the coded index exceeds (2^(16-N) - 1) rows, we need 4 bytes.

// TypeDefOrRef: TypeDef(0), TypeRef(1), TypeSpec(2) - 2-bit tag
let typeDefOrRefBig =
coded CodedIndices.TypeDefOrRef.TagBits CodedIndices.TypeDefOrRef.Tables

// TypeOrMethodDef: TypeDef(0), MethodDef(1) - 1-bit tag
let typeOrMethodDefBig =
coded CodedIndices.TypeOrMethodDef.TagBits CodedIndices.TypeOrMethodDef.Tables

// HasConstant: Field(0), Param(1), Property(2) - 2-bit tag
let hasConstantBig =
coded CodedIndices.HasConstant.TagBits CodedIndices.HasConstant.Tables

// HasCustomAttribute: 22 possible parent types - 5-bit tag
// This is the largest coded index, covering most metadata entities
let hasCustomAttributeBig =
coded CodedIndices.HasCustomAttribute.TagBits CodedIndices.HasCustomAttribute.Tables

// HasFieldMarshal: Field(0), Param(1) - 1-bit tag
let hasFieldMarshalBig =
coded CodedIndices.HasFieldMarshal.TagBits CodedIndices.HasFieldMarshal.Tables

// HasDeclSecurity: TypeDef(0), MethodDef(1), Assembly(2) - 2-bit tag
let hasDeclSecurityBig =
coded CodedIndices.HasDeclSecurity.TagBits CodedIndices.HasDeclSecurity.Tables

// MemberRefParent: TypeDef(0), TypeRef(1), ModuleRef(2), MethodDef(3), TypeSpec(4) - 3-bit tag
let memberRefParentBig =
coded CodedIndices.MemberRefParent.TagBits CodedIndices.MemberRefParent.Tables

// HasSemantics: Event(0), Property(1) - 1-bit tag
let hasSemanticsBig =
coded CodedIndices.HasSemantics.TagBits CodedIndices.HasSemantics.Tables

// MethodDefOrRef: MethodDef(0), MemberRef(1) - 1-bit tag
let methodDefOrRefBig =
coded CodedIndices.MethodDefOrRef.TagBits CodedIndices.MethodDefOrRef.Tables

// MemberForwarded: Field(0), MethodDef(1) - 1-bit tag
let memberForwardedBig =
coded CodedIndices.MemberForwarded.TagBits CodedIndices.MemberForwarded.Tables

// Implementation: File(0), AssemblyRef(1), ExportedType(2) - 2-bit tag
let implementationBig =
coded CodedIndices.Implementation.TagBits CodedIndices.Implementation.Tables

// CustomAttributeType: MethodDef(2), MemberRef(3) - 3-bit tag
// Note: tags 0, 1, 4 are reserved/unused
let customAttributeTypeBig =
coded CodedIndices.CustomAttributeType.TagBits CodedIndices.CustomAttributeType.Tables

// ResolutionScope: Module(0), ModuleRef(1), AssemblyRef(2), TypeRef(3) - 2-bit tag
let resolutionScopeBig =
coded CodedIndices.ResolutionScope.TagBits CodedIndices.ResolutionScope.Tables

{
StringsBig = stringsBig
GuidsBig = guidsBig
BlobsBig = blobsBig
SimpleIndexBig = simpleIndexBig
TypeDefOrRefBig = typeDefOrRefBig
TypeOrMethodDefBig = typeOrMethodDefBig
HasConstantBig = hasConstantBig
HasCustomAttributeBig = hasCustomAttributeBig
HasFieldMarshalBig = hasFieldMarshalBig
HasDeclSecurityBig = hasDeclSecurityBig
MemberRefParentBig = memberRefParentBig
HasSemanticsBig = hasSemanticsBig
MethodDefOrRefBig = methodDefOrRefBig
MemberForwardedBig = memberForwardedBig
ImplementationBig = implementationBig
CustomAttributeTypeBig = customAttributeTypeBig
ResolutionScopeBig = resolutionScopeBig
}
Loading
Loading