File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -102,8 +102,8 @@ let TypesFeasiblyEquivStripMeasures g amap m ty1 ty2 =
102102 TypesFeasiblyEquivalent true 0 g amap m ty1 ty2
103103
104104let inline TryGetCachedTypeSubsumption ( g : TcGlobals ) ( amap : ImportMap ) key =
105- if g.compilationMode = CompilationMode.OneOff && g. langVersion.SupportsFeature LanguageFeature.UseTypeSubsumptionCache then
106- match amap.TypeSubsumptionCache.TryGetValue ( key) with
105+ if g.langVersion.SupportsFeature LanguageFeature.UseTypeSubsumptionCache then
106+ match amap.TypeSubsumptionCache.TryGet ( key) with
107107 | true , subsumes ->
108108 ValueSome subsumes
109109 | false , _ ->
@@ -112,8 +112,8 @@ let inline TryGetCachedTypeSubsumption (g: TcGlobals) (amap: ImportMap) key =
112112 ValueNone
113113
114114let inline UpdateCachedTypeSubsumption ( g : TcGlobals ) ( amap : ImportMap ) key subsumes : unit =
115- if g.compilationMode = CompilationMode.OneOff && g. langVersion.SupportsFeature LanguageFeature.UseTypeSubsumptionCache then
116- amap.TypeSubsumptionCache[ key] <- subsumes
115+ if g.langVersion.SupportsFeature LanguageFeature.UseTypeSubsumptionCache then
116+ amap.TypeSubsumptionCache.TryAdd ( key, subsumes) |> ignore
117117
118118/// The feasible coercion relation. Part of the language spec.
119119let rec TypeFeasiblySubsumesType ndeep ( g : TcGlobals ) ( amap : ImportMap ) m ( ty1 : TType ) ( canCoerce : CanCoerce ) ( ty2 : TType ) =
Original file line number Diff line number Diff line change @@ -106,7 +106,8 @@ type [<Struct; NoComparison; CustomEquality>] TTypeCacheKey =
106106type ImportMap ( g : TcGlobals , assemblyLoader : AssemblyLoader ) =
107107 let typeRefToTyconRefCache = ConcurrentDictionary< ILTypeRef, TyconRef>()
108108
109- let typeSubsumptionCache = ConcurrentDictionary< TTypeCacheKey, bool>( System.Environment.ProcessorCount, 1024 )
109+ let typeSubsumptionCache =
110+ Cache< TTypeCacheKey, bool>. Create({ CacheOptions.Default with MaximumCapacity = 1024 })
110111
111112 member _.g = g
112113
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ type ImportMap =
7373 member g : TcGlobals
7474
7575 /// Type subsumption cache
76- member TypeSubsumptionCache : ConcurrentDictionary < TTypeCacheKey , bool >
76+ member TypeSubsumptionCache : Cache < TTypeCacheKey , bool >
7777
7878module Nullness =
7979
You can’t perform that action at this time.
0 commit comments