@@ -38,8 +38,6 @@ let runningOnMono =
3838
3939let _ = if logging then dprintn " * warning: Il.logging is on"
4040
41- let isNil x = match x with [] -> true | _ -> false
42- let nonNil x = match x with [] -> false | _ -> true
4341let int_order = LanguagePrimitives.FastGenericComparer< int>
4442
4543let notlazy v = Lazy.CreateFromValue v
@@ -86,11 +84,7 @@ let memoizeNamespaceRightTable = new ConcurrentDictionary<string,string option *
8684
8785
8886let splitNamespace nm =
89- let mutable res = Unchecked.defaultof<_>
90- let ok = memoizeNamespaceTable.TryGetValue( nm,& res)
91- if ok then res else
92- let x = splitNamespaceAux nm
93- ( memoizeNamespaceTable.[ nm] <- x; x)
87+ memoizeNamespaceTable.GetOrAdd( nm, splitNamespaceAux)
9488
9589let splitNamespaceMemoized nm = splitNamespace nm
9690
@@ -99,12 +93,9 @@ let memoizeNamespaceArrayTable =
9993 Concurrent.ConcurrentDictionary< string, string[]>()
10094
10195let splitNamespaceToArray nm =
102- let mutable res = Unchecked.defaultof<_>
103- let ok = memoizeNamespaceArrayTable.TryGetValue( nm,& res)
104- if ok then res else
105- let x = Array.ofList ( splitNamespace nm)
106- ( memoizeNamespaceArrayTable.[ nm] <- x; x)
107-
96+ memoizeNamespaceArrayTable.GetOrAdd( nm, fun nm ->
97+ let x = Array.ofList ( splitNamespace nm)
98+ x)
10899
109100let splitILTypeName ( nm : string ) =
110101 match nm.LastIndexOf '.' with
@@ -157,11 +148,7 @@ let splitTypeNameRightAux nm =
157148 else None, nm
158149
159150let splitTypeNameRight nm =
160- let mutable res = Unchecked.defaultof<_>
161- let ok = memoizeNamespaceRightTable.TryGetValue( nm,& res)
162- if ok then res else
163- let x = splitTypeNameRightAux nm
164- ( memoizeNamespaceRightTable.[ nm] <- x; x)
151+ memoizeNamespaceRightTable.GetOrAdd( nm, splitTypeNameRightAux)
165152
166153// --------------------------------------------------------------------
167154// Ordered lists with a lookup table
@@ -1987,7 +1974,7 @@ let mkILFieldRef(tref,nm,ty) = { EnclosingTypeRef=tref; Name=nm; Type=ty}
19871974let mkILFieldSpec ( tref , ty ) = { FieldRef= tref; EnclosingType= ty }
19881975
19891976let mkILFieldSpecInTy ( typ : ILType , nm , fty ) =
1990- mkILFieldSpec ( mkILFieldRef ( typ.TypeRef, nm, fty), typ)
1977+ mkILFieldSpec ( mkILFieldRef ( typ.TypeRef, nm, fty), typ)
19911978
19921979let emptyILCustomAttrs = ILAttributes ( fun () -> [| |])
19931980
@@ -2650,7 +2637,7 @@ let rec rescopeILTypeSpecQuick scoref (tspec:ILTypeSpec) =
26502637 let tref = tspec.TypeRef
26512638 let tinst = tspec.GenericArgs
26522639 let qtref = qrescope_ tref scoref tref
2653- if ILList.isEmpty tinst && isNone qtref then
2640+ if ILList.isEmpty tinst && Option. isNone qtref then
26542641 None (* avoid reallocation in the common case *)
26552642 else
26562643 match qtref with
@@ -3692,12 +3679,13 @@ type ILGlobals with
36923679 mkILCustomAttribute this ( mkSystemDiagnosticsDebuggableTypeRef this, [ this.typ_ Bool; this.typ_ Bool], [ ILAttribElem.Bool false ; ILAttribElem.Bool jitOptimizerDisabled], [])
36933680
36943681
3695- member this.mkDebuggableAttributeV2 ( ignoreSymbolStoreSequencePoints , jitOptimizerDisabled , enableEnC ) =
3682+ member this.mkDebuggableAttributeV2 ( jitTracking , ignoreSymbolStoreSequencePoints , jitOptimizerDisabled , enableEnC ) =
36963683 let tref = mkSystemDiagnosticsDebuggableTypeRef this
36973684 mkILCustomAttribute this
36983685 ( tref,[ mkILNonGenericValueTy ( tref_ DebuggableAttribute_ DebuggingModes this)],
36993686 (* See System.Diagnostics.DebuggableAttribute.DebuggingModes *)
3700- [ ILAttribElem.Int32( ( if jitOptimizerDisabled then 256 else 0 ) |||
3687+ [ ILAttribElem.Int32( ( if jitTracking then 1 else 0 ) |||
3688+ ( if jitOptimizerDisabled then 256 else 0 ) |||
37013689 ( if ignoreSymbolStoreSequencePoints then 2 else 0 ) |||
37023690 ( if enableEnC then 4 else 0 ))],[])
37033691
@@ -4277,14 +4265,14 @@ let resolveILMethodRefWithRescope r td (mref:ILMethodRef) =
42774265 let nargs = args.Length
42784266 let nm = mref.Name
42794267 let possibles = td.Methods.FindByNameAndArity ( nm, nargs)
4280- if isNil possibles then failwith ( " no method named " + nm + " found in type " + td.Name);
4268+ if List.isEmpty possibles then failwith ( " no method named " + nm + " found in type " + td.Name)
42814269 match
42824270 possibles |> List.filter ( fun md ->
42834271 mref.CallingConv = md.CallingConv &&
42844272 // REVIEW: this uses equality on ILType. For CMOD_OPTIONAL this is not going to be correct
4285- ( md.Parameters, mref.ArgTypes) ||> ILList.lengthsEqAndForall2 ( fun p1 p2 -> r p1.Type = p2) &&
4273+ ( md.Parameters, mref.ArgTypes) ||> ILList.lengthsEqAndForall2 ( fun p1 p2 -> r p1.Type = p2) &&
42864274 // REVIEW: this uses equality on ILType. For CMOD_OPTIONAL this is not going to be correct
4287- r md.Return.Type = mref.ReturnType) with
4275+ r md.Return.Type = mref.ReturnType) with
42884276 | [] -> failwith ( " no method named " + nm+ " with appropriate argument types found in type " + td.Name)
42894277 | [ mdef] -> mdef
42904278 | _ -> failwith ( " multiple methods named " + nm+ " appear with identical argument types in type " + td.Name)
0 commit comments