Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions docs/release-notes/.FSharp.Compiler.Service/11.0.100.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
### Improved

* Nullness warning FS3261 on dotted method or property access (e.g. `x.Member`) now underlines the receiver expression and includes the member name and (when known) the binding name in the message. ([Issue #19658](https://github.com/dotnet/fsharp/issues/19658), [PR #19814](https://github.com/dotnet/fsharp/pull/19814))
* IL: share the pickled references ([PR #20301](https://github.com/dotnet/fsharp/pull/20301))
* Direct delegate construction ([PR ##19993](https://github.com/dotnet/fsharp/pull/19993))

### Changed
Expand Down
28 changes: 25 additions & 3 deletions src/Compiler/TypedTree/TypedTreePickle.fs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,22 @@ type ReaderState =
isimpletys: InputTable<TType>
ifile: string
iILModule: ILModuleDef option // the Abstract IL metadata for the DLL being read

// The pickled format has no table for these, so each is written out at every mention while a
// blob names very few distinct ones.
iilscopes: Dictionary<ILScopeRef, ILScopeRef>
iiltyperefs: Dictionary<ILTypeRef, ILTypeRef>
iilmethodrefs: Dictionary<ILMethodRef, ILMethodRef>
}

// A `HashSet` would fit better, but the member returning the instance it holds is netstandard2.1.
let shareIL (table: Dictionary<'T, 'T>) (v: 'T) : 'T =
match table.TryGetValue v with
| true, existing -> existing
| _ ->
table[v] <- v
v

let ufailwith st str = ffailwith st.ifile str

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -1066,6 +1080,9 @@ let unpickleObjWithDanglingCcus
isimpletys = new_itbl "isimpletys (fake)" [||]
ifile = file
iILModule = ilModule
iilscopes = Dictionary<_, _>()
iiltyperefs = Dictionary<_, _>()
iilmethodrefs = Dictionary<_, _>()
}

let ccuNameTab = u_array u_encoded_ccuref st2
Expand Down Expand Up @@ -1126,6 +1143,9 @@ let unpickleObjWithDanglingCcus
isimpletys = simpletypTab
ifile = file
iILModule = ilModule
iilscopes = Dictionary<_, _>()
iiltyperefs = Dictionary<_, _>()
iilmethodrefs = Dictionary<_, _>()
}

let res = u st1
Expand Down Expand Up @@ -1231,7 +1251,7 @@ let u_ILScopeRef st =
| _ -> ufailwith st "u_ILScopeRef"

let res = rescopeILScopeRef st.iilscope res
res
shareIL st.iilscopes res

let p_ILHasThis x st =
p_byte
Expand Down Expand Up @@ -1320,7 +1340,8 @@ let u_ILCallConv st =

let u_ILTypeRef st =
let a, b, c = u_tup3 u_ILScopeRef u_strings u_string st
ILTypeRef.Create(a, b, c)
let res = ILTypeRef.Create(a, b, c)
shareIL st.iiltyperefs res

let u_ILArrayShape =
u_wrap ILArrayShape (u_list (u_tup2 (u_option u_int32) (u_option u_int32)))
Expand Down Expand Up @@ -1413,7 +1434,8 @@ let u_ILMethodRef st =
let x1, x2, x3, x4, x5, x6 =
u_tup6 u_ILTypeRef u_ILCallConv u_int u_string u_ILTypes u_ILType st

ILMethodRef.Create(x1, x2, x4, x3, x5, x6)
let res = ILMethodRef.Create(x1, x2, x4, x3, x5, x6)
shareIL st.iilmethodrefs res

let u_ILFieldRef st =
let x1, x2, x3 = u_tup3 u_ILTypeRef u_string u_ILType st
Expand Down
Loading