From 60edd653d4f88c369f29e2011ae52e9d728f6787 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 31 Dec 2019 13:11:36 -0800 Subject: [PATCH 1/9] ref -> mutable in /absil --- src/absil/ildiag.fs | 14 +- src/absil/illib.fs | 18 +- src/absil/ilread.fs | 382 ++++++++++++++++++++-------------------- src/absil/ilsupp.fs | 12 +- src/absil/ilwrite.fs | 96 +++++----- src/absil/ilwritepdb.fs | 40 ++--- 6 files changed, 281 insertions(+), 281 deletions(-) diff --git a/src/absil/ildiag.fs b/src/absil/ildiag.fs index 1cd20ad8750..d43bdf8dca4 100644 --- a/src/absil/ildiag.fs +++ b/src/absil/ildiag.fs @@ -5,18 +5,18 @@ module internal FSharp.Compiler.AbstractIL.Diagnostics -let diagnosticsLog = ref (Some stdout) +let mutable diagnosticsLog = Some stdout -let setDiagnosticsChannel s = diagnosticsLog := s +let setDiagnosticsChannel s = diagnosticsLog <- s -let dflushn () = match !diagnosticsLog with None -> () | Some d -> d.WriteLine(); d.Flush() -let dflush () = match !diagnosticsLog with None -> () | Some d -> d.Flush() +let dflushn () = match diagnosticsLog with None -> () | Some d -> d.WriteLine(); d.Flush() +let dflush () = match diagnosticsLog with None -> () | Some d -> d.Flush() let dprintn (s:string) = - match !diagnosticsLog with None -> () | Some d -> d.Write s; d.Write "\n"; dflush() + match diagnosticsLog with None -> () | Some d -> d.Write s; d.Write "\n"; dflush() let dprintf (fmt: Format<_,_,_,_>) = - Printf.kfprintf dflush (match !diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt + Printf.kfprintf dflush (match diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt let dprintfn (fmt: Format<_,_,_,_>) = - Printf.kfprintf dflushn (match !diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt + Printf.kfprintf dflushn (match diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt diff --git a/src/absil/illib.fs b/src/absil/illib.fs index 9a84e94e34a..1abd555298d 100644 --- a/src/absil/illib.fs +++ b/src/absil/illib.fs @@ -47,15 +47,15 @@ let LOH_SIZE_THRESHOLD_BYTES = 80_000 // Library: ReportTime //--------------------------------------------------------------------- let reportTime = - let tFirst = ref None - let tPrev = ref None + let mutable tFirst = None + let mutable tPrev = None fun showTimes descr -> if showTimes then let t = Process.GetCurrentProcess().UserProcessorTime.TotalSeconds - let prev = match !tPrev with None -> 0.0 | Some t -> t - let first = match !tFirst with None -> (tFirst := Some t; t) | Some t -> t + let prev = match tPrev with None -> 0.0 | Some t -> t + let first = match tFirst with None -> (tFirst <- Some t; t) | Some t -> t printf "ilwrite: TIME %10.3f (total) %10.3f (delta) - %s\n" (t - first) (t - prev) descr - tPrev := Some t + tPrev <- Some t //------------------------------------------------------------------------- // Library: projections @@ -573,10 +573,10 @@ module String = let getLines (str: string) = use reader = new StringReader(str) [| - let line = ref (reader.ReadLine()) - while not (isNull !line) do - yield !line - line := reader.ReadLine() + let mutable line = reader.ReadLine() + while not (isNull line) do + yield line + line <- reader.ReadLine() if str.EndsWithOrdinal("\n") then // last trailing space not returned // http://stackoverflow.com/questions/19365404/stringreader-omits-trailing-linebreak diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs index fed858c4d50..7e2eed479c5 100644 --- a/src/absil/ilread.fs +++ b/src/absil/ilread.fs @@ -522,8 +522,8 @@ let instrs () = // The tables are delayed to avoid building them unnecessarily at startup // Many applications of AbsIL (e.g. a compiler) don't need to read instructions. -let oneByteInstrs = ref None -let twoByteInstrs = ref None +let mutable oneByteInstrs = None +let mutable twoByteInstrs = None let fillInstrs () = let oneByteInstrTable = Array.create 256 I_invalid_instr let twoByteInstrTable = Array.create 256 I_invalid_instr @@ -542,16 +542,16 @@ let fillInstrs () = oneByteInstrTable.[i] <- f List.iter addInstr (instrs()) List.iter (fun (x, mk) -> addInstr (x, I_none_instr (noPrefixes mk))) (noArgInstrs.Force()) - oneByteInstrs := Some oneByteInstrTable - twoByteInstrs := Some twoByteInstrTable + oneByteInstrs <- Some oneByteInstrTable + twoByteInstrs <- Some twoByteInstrTable let rec getOneByteInstr i = - match !oneByteInstrs with + match oneByteInstrs with | None -> fillInstrs(); getOneByteInstr i | Some t -> t.[i] let rec getTwoByteInstr i = - match !twoByteInstrs with + match twoByteInstrs with | None -> fillInstrs(); getTwoByteInstr i | Some t -> t.[i] @@ -680,20 +680,20 @@ type GenericParamsIdx = GenericParamsIdx of int * TypeOrMethodDefTag * int let mkCacheInt32 lowMem _inbase _nm _sz = if lowMem then (fun f x -> f x) else - let cache = ref null - let count = ref 0 + let mutable cache = null + let mutable count = 0 #if STATISTICS addReport (fun oc -> if !count <> 0 then oc.WriteLine ((_inbase + string !count + " "+ _nm + " cache hits"): string)) #endif fun f (idx: int32) -> let cache = - match !cache with - | null -> cache := new Dictionary(11) + match cache with + | null -> cache <- Dictionary(11) | _ -> () - !cache + cache match cache.TryGetValue idx with | true, res -> - incr count + count <- count + 1 res | _ -> let res = f idx @@ -702,20 +702,20 @@ let mkCacheInt32 lowMem _inbase _nm _sz = let mkCacheGeneric lowMem _inbase _nm _sz = if lowMem then (fun f x -> f x) else - let cache = ref null - let count = ref 0 + let mutable cache = null + let mutable count = 0 #if STATISTICS addReport (fun oc -> if !count <> 0 then oc.WriteLine ((_inbase + string !count + " " + _nm + " cache hits"): string)) #endif fun f (idx :'T) -> let cache = - match !cache with - | null -> cache := new Dictionary<_, _>(11 (* sz: int *) ) + match cache with + | null -> cache <- Dictionary<_, _>(11 (* sz: int *) ) | _ -> () - !cache + cache match cache.TryGetValue idx with | true, v -> - incr count + count <- count + 1 v | _ -> let res = f idx @@ -804,12 +804,12 @@ let seekReadIndexedRows (numRows, rowReader, keyFunc, keyComparer, binaryChop, r res else - let res = ref [] + let mutable res = [] for i = 1 to numRows do let rowinfo = rowReader i if keyComparer (keyFunc rowinfo) = 0 then - res := rowConverter rowinfo :: !res - List.rev !res + res <- rowConverter rowinfo :: res + List.rev res let seekReadOptionalIndexedRow info = @@ -994,8 +994,8 @@ let seekReadTypeRefRow (ctxt: ILMetadataReader) mdv idx = /// Read Table ILTypeDef. let seekReadTypeDefRow (ctxt: ILMetadataReader) idx = ctxt.seekReadTypeDefRow idx -let seekReadTypeDefRowUncached ctxtH idx = - let (ctxt: ILMetadataReader) = getHole ctxtH +let seekReadTypeDefRowUncached (ctxtH: ILMetadataReader option ref) idx = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() let mutable addr = ctxt.rowAddr TableNames.TypeDef idx let flags = seekReadInt32Adv mdv &addr @@ -1050,8 +1050,8 @@ let seekReadMemberRefRow (ctxt: ILMetadataReader) mdv idx = /// Read Table Constant. let seekReadConstantRow (ctxt: ILMetadataReader) idx = ctxt.seekReadConstantRow idx -let seekReadConstantRowUncached ctxtH idx = - let (ctxt: ILMetadataReader) = getHole ctxtH +let seekReadConstantRowUncached (ctxtH: ILMetadataReader option ref) idx = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() let mutable addr = ctxt.rowAddr TableNames.Constant idx let kind = seekReadUInt16Adv mdv &addr @@ -1136,8 +1136,8 @@ let seekReadPropertyRow (ctxt: ILMetadataReader) mdv idx = /// Read Table MethodSemantics. let seekReadMethodSemanticsRow (ctxt: ILMetadataReader) idx = ctxt.seekReadMethodSemanticsRow idx -let seekReadMethodSemanticsRowUncached ctxtH idx = - let (ctxt: ILMetadataReader) = getHole ctxtH +let seekReadMethodSemanticsRowUncached (ctxtH: ILMetadataReader option ref) idx = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() let mutable addr = ctxt.rowAddr TableNames.MethodSemantics idx let flags = seekReadUInt16AsInt32Adv mdv &addr @@ -1238,8 +1238,8 @@ let seekReadManifestResourceRow (ctxt: ILMetadataReader) mdv idx = /// Read Table Nested. let seekReadNestedRow (ctxt: ILMetadataReader) idx = ctxt.seekReadNestedRow idx -let seekReadNestedRowUncached ctxtH idx = - let (ctxt: ILMetadataReader) = getHole ctxtH +let seekReadNestedRowUncached (ctxtH: ILMetadataReader option ref) idx = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() let mutable addr = ctxt.rowAddr TableNames.Nested idx let nestedIdx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr @@ -1270,15 +1270,15 @@ let seekReadMethodSpecRow (ctxt: ILMetadataReader) mdv idx = (mdorIdx, instIdx) -let readUserStringHeapUncached ctxtH idx = - let (ctxt: ILMetadataReader) = getHole ctxtH +let readUserStringHeapUncached (ctxtH: ILMetadataReader option ref) idx = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() seekReadUserString mdv (ctxt.userStringsStreamPhysicalLoc + idx) let readUserStringHeap (ctxt: ILMetadataReader) idx = ctxt.readUserStringHeap idx -let readStringHeapUncached ctxtH idx = - let (ctxt: ILMetadataReader) = getHole ctxtH +let readStringHeapUncached (ctxtH: ILMetadataReader option ref) idx = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() seekReadUTF8String mdv (ctxt.stringsStreamPhysicalLoc + idx) @@ -1288,8 +1288,8 @@ let readStringHeapOption (ctxt: ILMetadataReader) idx = if idx = 0 then None els let emptyByteArray: byte[] = [||] -let readBlobHeapUncached ctxtH idx = - let (ctxt: ILMetadataReader) = getHole ctxtH +let readBlobHeapUncached (ctxtH: ILMetadataReader option ref) idx = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() // valid index lies in range [1..streamSize) // NOTE: idx cannot be 0 - Blob\String heap has first empty element that mdv one byte 0 @@ -1347,31 +1347,31 @@ let readNativeResources (pectxt: PEReader) = yield ILNativeResource.In (pectxt.fileName, pectxt.nativeResourcesAddr, start, pectxt.nativeResourcesSize ) ] -let getDataEndPointsDelayed (pectxt: PEReader) ctxtH = +let getDataEndPointsDelayed (pectxt: PEReader) (ctxtH: ILMetadataReader option ref) = + let ctxt = getHole ctxtH lazy - let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() - let dataStartPoints = - let res = ref [] + let dataStartPoints = + let mutable res = [] for i = 1 to ctxt.getNumRows TableNames.FieldRVA do let rva, _fidx = seekReadFieldRVARow ctxt mdv i - res := ("field", rva) :: !res + res <- ("field", rva) :: res for i = 1 to ctxt.getNumRows TableNames.ManifestResource do let (offset, _, _, TaggedIndex(_tag, idx)) = seekReadManifestResourceRow ctxt mdv i if idx = 0 then let rva = pectxt.resourcesAddr + offset - res := ("manifest resource", rva) :: !res - !res + res <- ("manifest resource", rva) :: res + res if isNil dataStartPoints then [] else let methodRVAs = - let res = ref [] + let mutable res = [] for i = 1 to ctxt.getNumRows TableNames.Method do let (rva, _, _, nameIdx, _, _) = seekReadMethodRow ctxt mdv i if rva <> 0 then let nm = readStringHeap ctxt nameIdx - res := (nm, rva) :: !res - !res + res <- (nm, rva) :: res + res ([ pectxt.textSegmentPhysicalLoc + pectxt.textSegmentPhysicalSize pectxt.dataSegmentPhysicalLoc + pectxt.dataSegmentPhysicalSize ] @ @@ -1473,8 +1473,8 @@ and seekReadAssemblyManifest (ctxt: ILMetadataReader) pectxt idx = IgnoreSymbolStoreSequencePoints = 0 <> (flags &&& 0x2000) } and seekReadAssemblyRef (ctxt: ILMetadataReader) idx = ctxt.seekReadAssemblyRef idx -and seekReadAssemblyRefUncached ctxtH idx = - let (ctxt: ILMetadataReader) = getHole ctxtH +and seekReadAssemblyRefUncached (ctxtH: ILMetadataReader option ref) idx = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() let (v1, v2, v3, v4, flags, publicKeyOrTokenIdx, nameIdx, localeIdx, hashValueIdx) = seekReadAssemblyRefRow ctxt mdv idx let nm = readStringHeap ctxt nameIdx @@ -1563,10 +1563,10 @@ and seekReadPreTypeDef ctxt toponly (idx: int) = // Return the ILPreTypeDef Some (mkILPreTypeDefRead (ns, n, idx, ctxt.typeDefReader)) -and typeDefReader ctxtH: ILTypeDefStored = +and typeDefReader (ctxtH: ILMetadataReader option ref): ILTypeDefStored = mkILTypeDefReader - (fun idx -> - let (ctxt: ILMetadataReader) = getHole ctxtH + (fun idx -> + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() // Re-read so as not to save all these in the lazy closure - this suspension ctxt.is the largest // heavily allocated one in all of AbsIL @@ -1628,8 +1628,8 @@ and seekReadInterfaceImpls (ctxt: ILMetadataReader) mdv numtypars tidx = and seekReadGenericParams ctxt numtypars (a, b): ILGenericParameterDefs = ctxt.seekReadGenericParams (GenericParamsIdx(numtypars, a, b)) -and seekReadGenericParamsUncached ctxtH (GenericParamsIdx(numtypars, a, b)) = - let (ctxt: ILMetadataReader) = getHole ctxtH +and seekReadGenericParamsUncached (ctxtH: ILMetadataReader option ref) (GenericParamsIdx(numtypars, a, b)) = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() let pars = seekReadIndexedRows @@ -1668,7 +1668,7 @@ and seekReadGenericParamConstraints (ctxt: ILMetadataReader) mdv numtypars gpidx and seekReadTypeDefAsType (ctxt: ILMetadataReader) boxity (ginst: ILTypes) idx = ctxt.seekReadTypeDefAsType (TypeDefAsTypIdx (boxity, ginst, idx)) -and seekReadTypeDefAsTypeUncached ctxtH (TypeDefAsTypIdx (boxity, ginst, idx)) = +and seekReadTypeDefAsTypeUncached (ctxtH: ILMetadataReader option ref) (TypeDefAsTypIdx (boxity, ginst, idx)) = let ctxt = getHole ctxtH mkILTy boxity (ILTypeSpec.Create(seekReadTypeDefAsTypeRef ctxt idx, ginst)) @@ -1684,8 +1684,8 @@ and seekReadTypeDefAsTypeRef (ctxt: ILMetadataReader) idx = ILTypeRef.Create(scope=ILScopeRef.Local, enclosing=enc, name = nm ) and seekReadTypeRef (ctxt: ILMetadataReader) idx = ctxt.seekReadTypeRef idx -and seekReadTypeRefUncached ctxtH idx = - let (ctxt: ILMetadataReader) = getHole ctxtH +and seekReadTypeRefUncached (ctxtH: ILMetadataReader option ref) idx = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() let scopeIdx, nameIdx, namespaceIdx = seekReadTypeRefRow ctxt mdv idx let scope, enc = seekReadTypeRefScope ctxt mdv scopeIdx @@ -1693,7 +1693,7 @@ and seekReadTypeRefUncached ctxtH idx = ILTypeRef.Create(scope=scope, enclosing=enc, name = nm) and seekReadTypeRefAsType (ctxt: ILMetadataReader) boxity ginst idx = ctxt.seekReadTypeRefAsType (TypeRefAsTypIdx (boxity, ginst, idx)) -and seekReadTypeRefAsTypeUncached ctxtH (TypeRefAsTypIdx (boxity, ginst, idx)) = +and seekReadTypeRefAsTypeUncached (ctxtH: ILMetadataReader option ref) (TypeRefAsTypIdx (boxity, ginst, idx)) = let ctxt = getHole ctxtH mkILTy boxity (ILTypeSpec.Create(seekReadTypeRef ctxt idx, ginst)) @@ -1942,8 +1942,8 @@ and sigptrGetLocal (ctxt: ILMetadataReader) numtypars bytes sigptr = and readBlobHeapAsMethodSig (ctxt: ILMetadataReader) numtypars blobIdx = ctxt.readBlobHeapAsMethodSig (BlobAsMethodSigIdx (numtypars, blobIdx)) -and readBlobHeapAsMethodSigUncached ctxtH (BlobAsMethodSigIdx (numtypars, blobIdx)) = - let (ctxt: ILMetadataReader) = getHole ctxtH +and readBlobHeapAsMethodSigUncached (ctxtH: ILMetadataReader option ref) (BlobAsMethodSigIdx (numtypars, blobIdx)) = + let ctxt = getHole ctxtH let bytes = readBlobHeap ctxt blobIdx let sigptr = 0 let ccByte, sigptr = sigptrGetByte bytes sigptr @@ -1962,7 +1962,7 @@ and readBlobHeapAsType ctxt numtypars blobIdx = and readBlobHeapAsFieldSig ctxt numtypars blobIdx = ctxt.readBlobHeapAsFieldSig (BlobAsFieldSigIdx (numtypars, blobIdx)) -and readBlobHeapAsFieldSigUncached ctxtH (BlobAsFieldSigIdx (numtypars, blobIdx)) = +and readBlobHeapAsFieldSigUncached (ctxtH: ILMetadataReader option ref) (BlobAsFieldSigIdx (numtypars, blobIdx)) = let ctxt = getHole ctxtH let bytes = readBlobHeap ctxt blobIdx let sigptr = 0 @@ -1975,7 +1975,7 @@ and readBlobHeapAsFieldSigUncached ctxtH (BlobAsFieldSigIdx (numtypars, blobIdx) and readBlobHeapAsPropertySig (ctxt: ILMetadataReader) numtypars blobIdx = ctxt.readBlobHeapAsPropertySig (BlobAsPropSigIdx (numtypars, blobIdx)) -and readBlobHeapAsPropertySigUncached ctxtH (BlobAsPropSigIdx (numtypars, blobIdx)) = +and readBlobHeapAsPropertySigUncached (ctxtH: ILMetadataReader option ref) (BlobAsPropSigIdx (numtypars, blobIdx)) = let ctxt = getHole ctxtH let bytes = readBlobHeap ctxt blobIdx let sigptr = 0 @@ -1991,7 +1991,7 @@ and readBlobHeapAsPropertySigUncached ctxtH (BlobAsPropSigIdx (numtypars, blobId and readBlobHeapAsLocalsSig (ctxt: ILMetadataReader) numtypars blobIdx = ctxt.readBlobHeapAsLocalsSig (BlobAsLocalSigIdx (numtypars, blobIdx)) -and readBlobHeapAsLocalsSigUncached ctxtH (BlobAsLocalSigIdx (numtypars, blobIdx)) = +and readBlobHeapAsLocalsSigUncached (ctxtH: ILMetadataReader option ref) (BlobAsLocalSigIdx (numtypars, blobIdx)) = let ctxt = getHole ctxtH let bytes = readBlobHeap ctxt blobIdx let sigptr = 0 @@ -2022,8 +2022,8 @@ and byteAsCallConv b = and seekReadMemberRefAsMethodData ctxt numtypars idx: VarArgMethodData = ctxt.seekReadMemberRefAsMethodData (MemberRefAsMspecIdx (numtypars, idx)) -and seekReadMemberRefAsMethodDataUncached ctxtH (MemberRefAsMspecIdx (numtypars, idx)) = - let (ctxt: ILMetadataReader) = getHole ctxtH +and seekReadMemberRefAsMethodDataUncached (ctxtH: ILMetadataReader option ref) (MemberRefAsMspecIdx (numtypars, idx)) = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() let (mrpIdx, nameIdx, typeIdx) = seekReadMemberRefRow ctxt mdv idx let nm = readStringHeap ctxt nameIdx @@ -2040,8 +2040,8 @@ and seekReadMemberRefAsMethDataNoVarArgs ctxt numtypars idx: MethodData = and seekReadMethodSpecAsMethodData (ctxt: ILMetadataReader) numtypars idx = ctxt.seekReadMethodSpecAsMethodData (MethodSpecAsMspecIdx (numtypars, idx)) -and seekReadMethodSpecAsMethodDataUncached ctxtH (MethodSpecAsMspecIdx (numtypars, idx)) = - let (ctxt: ILMetadataReader) = getHole ctxtH +and seekReadMethodSpecAsMethodDataUncached (ctxtH: ILMetadataReader option ref) (MethodSpecAsMspecIdx (numtypars, idx)) = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() let (mdorIdx, instIdx) = seekReadMethodSpecRow ctxt mdv idx let (VarArgMethodData(enclTy, cc, nm, argtys, varargs, retty, _)) = seekReadMethodDefOrRef ctxt numtypars mdorIdx @@ -2058,8 +2058,8 @@ and seekReadMethodSpecAsMethodDataUncached ctxtH (MethodSpecAsMspecIdx (numtypar and seekReadMemberRefAsFieldSpec (ctxt: ILMetadataReader) numtypars idx = ctxt.seekReadMemberRefAsFieldSpec (MemberRefAsFspecIdx (numtypars, idx)) -and seekReadMemberRefAsFieldSpecUncached ctxtH (MemberRefAsFspecIdx (numtypars, idx)) = - let (ctxt: ILMetadataReader) = getHole ctxtH +and seekReadMemberRefAsFieldSpecUncached (ctxtH: ILMetadataReader option ref) (MemberRefAsFspecIdx (numtypars, idx)) = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() let (mrpIdx, nameIdx, typeIdx) = seekReadMemberRefRow ctxt mdv idx let nm = readStringHeap ctxt nameIdx @@ -2076,8 +2076,8 @@ and seekReadMemberRefAsFieldSpecUncached ctxtH (MemberRefAsFspecIdx (numtypars, and seekReadMethodDefAsMethodData ctxt idx = ctxt.seekReadMethodDefAsMethodData idx -and seekReadMethodDefAsMethodDataUncached ctxtH idx = - let (ctxt: ILMetadataReader) = getHole ctxtH +and seekReadMethodDefAsMethodDataUncached (ctxtH: ILMetadataReader option ref) idx = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() // Look for the method def parent. let tidx = @@ -2116,8 +2116,8 @@ and seekReadMethodDefAsMethodDataUncached ctxtH idx = and seekReadFieldDefAsFieldSpec (ctxt: ILMetadataReader) idx = ctxt.seekReadFieldDefAsFieldSpec idx -and seekReadFieldDefAsFieldSpecUncached ctxtH idx = - let (ctxt: ILMetadataReader) = getHole ctxtH +and seekReadFieldDefAsFieldSpecUncached (ctxtH: ILMetadataReader option ref) idx = + let ctxt = getHole ctxtH let mdv = ctxt.mdfile.GetView() let (_flags, nameIdx, typeIdx) = seekReadFieldRow ctxt mdv idx let nm = readStringHeap ctxt nameIdx @@ -2196,20 +2196,20 @@ and seekReadMethod (ctxt: ILMetadataReader) mdv numtypars (idx: int) = and seekReadParams (ctxt: ILMetadataReader) mdv (retty, argtys) pidx1 pidx2 = - let retRes = ref (mkILReturn retty) + let mutable retRes = mkILReturn retty let paramsRes = argtys |> List.toArray |> Array.map mkILParamAnon for i = pidx1 to pidx2 - 1 do - seekReadParamExtras ctxt mdv (retRes, paramsRes) i - !retRes, List.ofArray paramsRes + seekReadParamExtras ctxt mdv (&retRes, paramsRes) i + retRes, List.ofArray paramsRes -and seekReadParamExtras (ctxt: ILMetadataReader) mdv (retRes, paramsRes) (idx: int) = +and seekReadParamExtras (ctxt: ILMetadataReader) mdv (retRes: byref, paramsRes) (idx: int) = let (flags, seq, nameIdx) = seekReadParamRow ctxt mdv idx let inOutMasked = (flags &&& 0x00FF) let hasMarshal = (flags &&& 0x2000) <> 0x0 let hasDefault = (flags &&& 0x1000) <> 0x0 let fmReader idx = seekReadIndexedRow (ctxt.getNumRows TableNames.FieldMarshal, seekReadFieldMarshalRow ctxt mdv, fst, hfmCompare idx, isSorted ctxt TableNames.FieldMarshal, (snd >> readBlobHeapAsNativeType ctxt)) if seq = 0 then - retRes := { !retRes with + retRes <- { retRes with Marshal=(if hasMarshal then Some (fmReader (TaggedIndex(hfm_ParamDef, idx))) else None) CustomAttrsStored = ctxt.customAttrsReader_ParamDef MetadataIndex = idx} @@ -2340,10 +2340,10 @@ and seekReadProperties (ctxt: ILMetadataReader) numtypars tidx = yield seekReadProperty ctxt mdv numtypars i ]) -and customAttrsReader ctxtH tag: ILAttributesStored = +and customAttrsReader (ctxtH: ILMetadataReader option ref) tag: ILAttributesStored = mkILCustomAttrsReader - (fun idx -> - let (ctxt: ILMetadataReader) = getHole ctxtH + (fun idx -> + let ctxt = getHole ctxtH seekReadIndexedRows (ctxt.getNumRows TableNames.CustomAttribute, seekReadCustomAttributeRow ctxt, (fun (a, _, _) -> a), hcaCompare (TaggedIndex(tag,idx)), @@ -2354,7 +2354,7 @@ and customAttrsReader ctxtH tag: ILAttributesStored = and seekReadCustomAttr ctxt (TaggedIndex(cat, idx), b) = ctxt.seekReadCustomAttr (CustomAttrIdx (cat, idx, b)) -and seekReadCustomAttrUncached ctxtH (CustomAttrIdx (cat, idx, valIdx)) = +and seekReadCustomAttrUncached (ctxtH: ILMetadataReader option ref) (CustomAttrIdx (cat, idx, valIdx)) = let ctxt = getHole ctxtH let method = seekReadCustomAttrType ctxt (TaggedIndex(cat, idx)) let data = @@ -2364,10 +2364,10 @@ and seekReadCustomAttrUncached ctxtH (CustomAttrIdx (cat, idx, valIdx)) = let elements = [] ILAttribute.Encoded (method, data, elements) -and securityDeclsReader ctxtH tag = +and securityDeclsReader (ctxtH: ILMetadataReader option ref) tag = + let ctxt = getHole ctxtH mkILSecurityDeclsReader - (fun idx -> - let (ctxt: ILMetadataReader) = getHole ctxtH + (fun idx -> let mdv = ctxt.mdfile.GetView() seekReadIndexedRows (ctxt.getNumRows TableNames.Permission, seekReadPermissionRow ctxt mdv, @@ -2481,37 +2481,37 @@ and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start s ilOffsetsOfLabels.[lab] <- ilOffset let ibuf = new ResizeArray<_>(sz/2) - let curr = ref 0 + let mutable curr = 0 let prefixes = { al=Aligned; tl= Normalcall; vol= Nonvolatile;ro=NormalAddress;constrained=None } - let lastb = ref 0x0 - let lastb2 = ref 0x0 - let b = ref 0x0 + let mutable lastb = 0x0 + let mutable lastb2 = 0x0 + let mutable b = 0x0 let get () = - lastb := seekReadByteAsInt32 pev (start + (!curr)) - incr curr - b := - if !lastb = 0xfe && !curr < sz then - lastb2 := seekReadByteAsInt32 pev (start + (!curr)) - incr curr - !lastb2 + lastb <- seekReadByteAsInt32 pev (start + (curr)) + curr <- curr + 1 + b <- + if lastb = 0xfe && curr < sz then + lastb2 <- seekReadByteAsInt32 pev (start + (curr)) + curr <- curr + 1 + lastb2 else - !lastb + lastb - let seqPointsRemaining = ref seqpoints + let mutable seqPointsRemaining = seqpoints - while !curr < sz do + while curr < sz do // registering "+string !curr+" as start of an instruction") - markAsInstructionStart !curr ibuf.Count + markAsInstructionStart curr ibuf.Count // Insert any sequence points into the instruction sequence while - (match !seqPointsRemaining with - | (i, _tag) :: _rest when i <= !curr -> true + (match seqPointsRemaining with + | (i, _tag) :: _rest when i <= curr -> true | _ -> false) do // Emitting one sequence point - let (_, tag) = List.head !seqPointsRemaining - seqPointsRemaining := List.tail !seqPointsRemaining + let (_, tag) = List.head seqPointsRemaining + seqPointsRemaining <- List.tail seqPointsRemaining ibuf.Add (I_seqpoint tag) // Read the prefixes. Leave lastb and lastb2 holding the instruction byte(s) @@ -2522,27 +2522,27 @@ and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start s prefixes.ro<-NormalAddress prefixes.constrained<-None get () - while !curr < sz && - !lastb = 0xfe && - (!b = (i_constrained &&& 0xff) || - !b = (i_readonly &&& 0xff) || - !b = (i_unaligned &&& 0xff) || - !b = (i_volatile &&& 0xff) || - !b = (i_tail &&& 0xff)) do + while curr < sz && + lastb = 0xfe && + (b = (i_constrained &&& 0xff) || + b = (i_readonly &&& 0xff) || + b = (i_unaligned &&& 0xff) || + b = (i_volatile &&& 0xff) || + b = (i_tail &&& 0xff)) do begin - if !b = (i_unaligned &&& 0xff) then - let unal = seekReadByteAsInt32 pev (start + (!curr)) - incr curr + if b = (i_unaligned &&& 0xff) then + let unal = seekReadByteAsInt32 pev (start + (curr)) + curr <- curr + 1 prefixes.al <- if unal = 0x1 then Unaligned1 elif unal = 0x2 then Unaligned2 elif unal = 0x4 then Unaligned4 else (dprintn "bad alignment for unaligned"; Aligned) - elif !b = (i_volatile &&& 0xff) then prefixes.vol <- Volatile - elif !b = (i_readonly &&& 0xff) then prefixes.ro <- ReadonlyAddress - elif !b = (i_constrained &&& 0xff) then - let uncoded = seekReadUncodedToken pev (start + (!curr)) - curr := !curr + 4 + elif b = (i_volatile &&& 0xff) then prefixes.vol <- Volatile + elif b = (i_readonly &&& 0xff) then prefixes.ro <- ReadonlyAddress + elif b = (i_constrained &&& 0xff) then + let uncoded = seekReadUncodedToken pev (start + (curr)) + curr <- curr + 4 let ty = seekReadTypeDefOrRef ctxt numtypars AsObject [] (uncodedTokenToTypeDefOrRefOrSpec uncoded) prefixes.constrained <- Some ty else prefixes.tl <- Tailcall @@ -2552,45 +2552,45 @@ and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start s // data for instruction begins at "+string !curr // Read and decode the instruction - if (!curr <= sz) then + if (curr <= sz) then let idecoder = - if !lastb = 0xfe then getTwoByteInstr ( !lastb2) - else getOneByteInstr ( !lastb) + if lastb = 0xfe then getTwoByteInstr (lastb2) + else getOneByteInstr (lastb) let instr = match idecoder with | I_u16_u8_instr f -> - let x = seekReadByte pev (start + (!curr)) |> uint16 - curr := !curr + 1 + let x = seekReadByte pev (start + (curr)) |> uint16 + curr <- curr + 1 f prefixes x | I_u16_u16_instr f -> - let x = seekReadUInt16 pev (start + (!curr)) - curr := !curr + 2 + let x = seekReadUInt16 pev (start + (curr)) + curr <- curr + 2 f prefixes x | I_none_instr f -> f prefixes | I_i64_instr f -> - let x = seekReadInt64 pev (start + (!curr)) - curr := !curr + 8 + let x = seekReadInt64 pev (start + (curr)) + curr <- curr + 8 f prefixes x | I_i32_i8_instr f -> - let x = seekReadSByte pev (start + (!curr)) |> int32 - curr := !curr + 1 + let x = seekReadSByte pev (start + (curr)) |> int32 + curr <- curr + 1 f prefixes x | I_i32_i32_instr f -> - let x = seekReadInt32 pev (start + (!curr)) - curr := !curr + 4 + let x = seekReadInt32 pev (start + (curr)) + curr <- curr + 4 f prefixes x | I_r4_instr f -> - let x = seekReadSingle pev (start + (!curr)) - curr := !curr + 4 + let x = seekReadSingle pev (start + (curr)) + curr <- curr + 4 f prefixes x | I_r8_instr f -> - let x = seekReadDouble pev (start + (!curr)) - curr := !curr + 8 + let x = seekReadDouble pev (start + (curr)) + curr <- curr + 8 f prefixes x | I_field_instr f -> - let (tab, tok) = seekReadUncodedToken pev (start + (!curr)) - curr := !curr + 4 + let (tab, tok) = seekReadUncodedToken pev (start + (curr)) + curr <- curr + 4 let fspec = if tab = TableNames.Field then seekReadFieldDefAsFieldSpec ctxt tok @@ -2601,8 +2601,8 @@ and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start s | I_method_instr f -> // method instruction, curr = "+string !curr - let (tab, idx) = seekReadUncodedToken pev (start + (!curr)) - curr := !curr + 4 + let (tab, idx) = seekReadUncodedToken pev (start + (curr)) + curr <- curr + 4 let (VarArgMethodData(enclTy, cc, nm, argtys, varargs, retty, minst)) = if tab = TableNames.Method then seekReadMethodDefOrRef ctxt numtypars (TaggedIndex(mdor_MethodDef, idx)) @@ -2623,42 +2623,42 @@ and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start s let mspec = mkILMethSpecInTy (enclTy, cc, nm, argtys, retty, minst) f prefixes (mspec, varargs) | I_type_instr f -> - let uncoded = seekReadUncodedToken pev (start + (!curr)) - curr := !curr + 4 + let uncoded = seekReadUncodedToken pev (start + (curr)) + curr <- curr + 4 let ty = seekReadTypeDefOrRef ctxt numtypars AsObject [] (uncodedTokenToTypeDefOrRefOrSpec uncoded) f prefixes ty | I_string_instr f -> - let (tab, idx) = seekReadUncodedToken pev (start + (!curr)) - curr := !curr + 4 + let (tab, idx) = seekReadUncodedToken pev (start + (curr)) + curr <- curr + 4 if tab <> TableNames.UserStrings then dprintn "warning: bad table in user string for ldstr" f prefixes (readUserStringHeap ctxt idx) | I_conditional_i32_instr f -> - let offsDest = (seekReadInt32 pev (start + (!curr))) - curr := !curr + 4 - let dest = !curr + offsDest + let offsDest = (seekReadInt32 pev (start + (curr))) + curr <- curr + 4 + let dest = curr + offsDest f prefixes (rawToLabel dest) | I_conditional_i8_instr f -> - let offsDest = int (seekReadSByte pev (start + (!curr))) - curr := !curr + 1 - let dest = !curr + offsDest + let offsDest = int (seekReadSByte pev (start + (curr))) + curr <- curr + 1 + let dest = curr + offsDest f prefixes (rawToLabel dest) | I_unconditional_i32_instr f -> - let offsDest = (seekReadInt32 pev (start + (!curr))) - curr := !curr + 4 - let dest = !curr + offsDest + let offsDest = (seekReadInt32 pev (start + (curr))) + curr <- curr + 4 + let dest = curr + offsDest f prefixes (rawToLabel dest) | I_unconditional_i8_instr f -> - let offsDest = int (seekReadSByte pev (start + (!curr))) - curr := !curr + 1 - let dest = !curr + offsDest + let offsDest = int (seekReadSByte pev (start + (curr))) + curr <- curr + 1 + let dest = curr + offsDest f prefixes (rawToLabel dest) | I_invalid_instr -> - dprintn ("invalid instruction: "+string !lastb+ (if !lastb = 0xfe then ", "+string !lastb2 else "")) + dprintn ("invalid instruction: "+string lastb+ (if lastb = 0xfe then ", "+string lastb2 else "")) I_ret | I_tok_instr f -> - let (tab, idx) = seekReadUncodedToken pev (start + (!curr)) - curr := !curr + 4 + let (tab, idx) = seekReadUncodedToken pev (start + (curr)) + curr <- curr + 4 (* REVIEW: this incorrectly labels all MemberRef tokens as ILMethod's: we should go look at the MemberRef sig to determine if it is a field or method *) let token_info = if tab = TableNames.Method || tab = TableNames.MemberRef (* REVIEW: generics or tab = TableNames.MethodSpec *) then @@ -2671,26 +2671,26 @@ and seekReadTopCode (ctxt: ILMetadataReader) pev mdv numtypars (sz: int) start s else failwith "bad token for ldtoken" f prefixes token_info | I_sig_instr f -> - let (tab, idx) = seekReadUncodedToken pev (start + (!curr)) - curr := !curr + 4 + let (tab, idx) = seekReadUncodedToken pev (start + (curr)) + curr <- curr + 4 if tab <> TableNames.StandAloneSig then dprintn "strange table for callsig token" let generic, _genarity, cc, retty, argtys, varargs = readBlobHeapAsMethodSig ctxt numtypars (seekReadStandAloneSigRow ctxt mdv idx) if generic then failwith "bad image: a generic method signature is begin used at a calli instruction" f prefixes (mkILCallSig (cc, argtys, retty), varargs) | I_switch_instr f -> - let n = (seekReadInt32 pev (start + (!curr))) - curr := !curr + 4 + let n = (seekReadInt32 pev (start + (curr))) + curr <- curr + 4 let offsets = List.init n (fun _ -> - let i = (seekReadInt32 pev (start + (!curr))) - curr := !curr + 4 + let i = (seekReadInt32 pev (start + (curr))) + curr <- curr + 4 i) - let dests = List.map (fun offs -> rawToLabel (!curr + offs)) offsets + let dests = List.map (fun offs -> rawToLabel (curr + offs)) offsets f prefixes dests ibuf.Add instr done // Finished reading instructions - mark the end of the instruction stream in case the PDB information refers to it. - markAsInstructionStart !curr ibuf.Count + markAsInstructionStart curr ibuf.Count // Build the function that maps from raw labels (offsets into the bytecode stream) to indexes in the AbsIL instruction stream let lab2pc = ilOffsetsOfLabels @@ -2823,11 +2823,11 @@ and seekReadMethodRVA (pectxt: PEReader) (ctxt: ILMetadataReader) (idx, nm, _int // Read all the sections that follow the method body. // These contain the exception clauses. - let nextSectionBase = ref (align 4 (codeBase + codeSize)) - let moreSections = ref hasMoreSections - let seh = ref [] - while !moreSections do - let sectionBase = !nextSectionBase + let mutable nextSectionBase = align 4 (codeBase + codeSize) + let mutable moreSections = hasMoreSections + let mutable seh = [] + while moreSections do + let sectionBase = nextSectionBase let sectionFlag = seekReadByte pev sectionBase // fat format for "+nm+", sectionFlag = " + string sectionFlag) let sectionSize, clauses = @@ -2907,16 +2907,16 @@ and seekReadMethodRVA (pectxt: PEReader) (ctxt: ILMetadataReader) (idx, nm, _int | _ -> sehMap.[key] <- [clause]) clauses ([], sehMap) ||> Seq.fold (fun acc (KeyValue(key, bs)) -> [ for b in bs -> {Range=key; Clause=b}: ILExceptionSpec ] @ acc) - seh := sehClauses - moreSections := (sectionFlag &&& e_CorILMethod_Sect_MoreSects) <> 0x0uy - nextSectionBase := sectionBase + sectionSize + seh <- sehClauses + moreSections <- (sectionFlag &&& e_CorILMethod_Sect_MoreSects) <> 0x0uy + nextSectionBase <- sectionBase + sectionSize done (* while *) (* Convert the linear code format to the nested code format *) if logging then dprintn ("doing localPdbInfos2") let localPdbInfos2 = List.map (fun f -> f raw2nextLab) localPdbInfos if logging then dprintn ("done localPdbInfos2, checking code...") - let code = buildILCode nm lab2pc instrs !seh localPdbInfos2 + let code = buildILCode nm lab2pc instrs seh localPdbInfos2 if logging then dprintn ("done checking code.") MethodBody.IL { IsZeroInit=initlocals @@ -3141,19 +3141,19 @@ let openMetadataReader (fileName, mdfile: BinaryFile, metadataPhysLoc, peinfo, p else let offset = seekReadInt32 mdv (pos + 0) let length = seekReadInt32 mdv (pos + 4) - let res = ref true - let fin = ref false - let n = ref 0 + let mutable res = true + let mutable fin = false + let mutable n = 0 // read and compare the stream name byte by byte - while (not !fin) do - let c= seekReadByteAsInt32 mdv (pos + 8 + (!n)) + while (not fin) do + let c= seekReadByteAsInt32 mdv (pos + 8 + (n)) if c = 0 then - fin := true - elif !n >= Array.length name || c <> name.[!n] then - res := false - incr n - if !res then Some(offset + metadataPhysLoc, length) - else look (i+1) (align 0x04 (pos + 8 + (!n))) + fin <- true + elif n >= Array.length name || c <> name.[n] then + res <- false + n <- n + 1 + if res then Some(offset + metadataPhysLoc, length) + else look (i+1) (align 0x04 (pos + 8 + (n))) look 0 streamHeadersStart let findStream name = @@ -3248,15 +3248,15 @@ let openMetadataReader (fileName, mdfile: BinaryFile, metadataPhysLoc, peinfo, p let valid = seekReadInt64 mdv (tablesStreamPhysLoc + 8) let sorted = seekReadInt64 mdv (tablesStreamPhysLoc + 16) let tablesPresent, tableRowCount, startOfTables = - let present = ref [] + let mutable present = [] let numRows = Array.create 64 0 - let prevNumRowIdx = ref (tablesStreamPhysLoc + 24) + let mutable prevNumRowIdx = tablesStreamPhysLoc + 24 for i = 0 to 63 do if (valid &&& (int64 1 <<< i)) <> int64 0 then - present := i :: !present - numRows.[i] <- (seekReadInt32 mdv !prevNumRowIdx) - prevNumRowIdx := !prevNumRowIdx + 4 - List.rev !present, numRows, !prevNumRowIdx + present <- i :: present + numRows.[i] <- (seekReadInt32 mdv prevNumRowIdx) + prevNumRowIdx <- prevNumRowIdx + 4 + List.rev present, numRows, prevNumRowIdx let getNumRows (tab: TableName) = tableRowCount.[tab.Index] let numTables = tablesPresent.Length diff --git a/src/absil/ilsupp.fs b/src/absil/ilsupp.fs index a5dbe768b88..6e18be8bd41 100644 --- a/src/absil/ilsupp.fs +++ b/src/absil/ilsupp.fs @@ -520,8 +520,8 @@ type ResFormatNode(tid: int32, nid: int32, lid: int32, dataOffset: int32, pbLink member x.Save(ulLinkedResourceBaseRVA: int32, pbLinkedResource: byte[], pUnlinkedResource: byte[], offset: int) = // Dump them to pUnlinkedResource // For each resource write header and data - let size = ref 0 - let unlinkedResourceOffset = ref 0 + let mutable size = 0 + let mutable unlinkedResourceOffset = 0 //resHdr.HeaderSize <- 32 if Unchecked.defaultof <> wzType then resHdr.HeaderSize <- resHdr.HeaderSize + ((cType + 1) * 2) - 4 @@ -530,9 +530,9 @@ type ResFormatNode(tid: int32, nid: int32, lid: int32, dataOffset: int32, pbLink let SaveChunk(p: byte[], sz: int) = if Unchecked.defaultof <> pUnlinkedResource then - Bytes.blit p 0 pUnlinkedResource (!unlinkedResourceOffset + offset) sz - unlinkedResourceOffset := !unlinkedResourceOffset + sz - size := !size + sz + Bytes.blit p 0 pUnlinkedResource (unlinkedResourceOffset + offset) sz + unlinkedResourceOffset <- unlinkedResourceOffset + sz + size <- size + sz () @@ -575,7 +575,7 @@ type ResFormatNode(tid: int32, nid: int32, lid: int32, dataOffset: int32, pbLink if dwFiller <> 0 then SaveChunk(bNil, 4 - dwFiller) - !size + size let linkNativeResources (unlinkedResources: byte[] list) (ulLinkedResourceBaseRVA: int32) = let resources = diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 802ad3d3a04..8c4b4b73727 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -555,7 +555,7 @@ type cenv = deterministic: bool showTimes: bool desiredMetadataVersion: ILVersionInfo - requiredDataFixups: (int32 * (int * bool)) list ref + mutable requiredDataFixups: (int32 * (int * bool)) list /// References to strings in codestreams: offset of code and a (fixup-location, string token) list) mutable requiredStringFixups: (int32 * (int * int) list) list codeChunks: ByteBuffer @@ -645,8 +645,8 @@ type ILTokenMappings = PropertyTokenMap: ILTypeDef list * ILTypeDef -> ILPropertyDef -> int32 EventTokenMap: ILTypeDef list * ILTypeDef -> ILEventDef -> int32 } -let recordRequiredDataFixup requiredDataFixups (buf: ByteBuffer) pos lab = - requiredDataFixups := (pos, lab) :: !requiredDataFixups +let recordRequiredDataFixup (requiredDataFixups: byref<('a * 'b) list>) (buf: ByteBuffer) pos lab = + requiredDataFixups <- (pos, lab) :: requiredDataFixups // Write a special value in that we check later when applying the fixup buf.EmitInt32 0xdeaddddd @@ -1596,23 +1596,23 @@ module Codebuf = // or long and adjusting the branch destinations. Record an adjust function to adjust all the other // gumpf that refers to fixed offsets in the code stream. let newCode, newReqdBrFixups, adjuster = - let remainingReqdFixups = ref orderedOrigReqdBrFixups - let origWhere = ref 0 - let newWhere = ref 0 - let doneLast = ref false - let newReqdBrFixups = ref [] + let mutable remainingReqdFixups = orderedOrigReqdBrFixups + let mutable origWhere = 0 + let mutable newWhere = 0 + let mutable doneLast = false + let mutable newReqdBrFixups = [] - let adjustments = ref [] + let mutable adjustments = [] - while (!remainingReqdFixups <> [] || not !doneLast) do - let doingLast = isNil !remainingReqdFixups - let origStartOfNoBranchBlock = !origWhere - let newStartOfNoBranchBlock = !newWhere + while (remainingReqdFixups <> [] || not doneLast) do + let doingLast = isNil remainingReqdFixups + let origStartOfNoBranchBlock = origWhere + let newStartOfNoBranchBlock = newWhere let origEndOfNoBranchBlock = if doingLast then origCode.Length else - let (_, origStartOfInstr, _) = List.head !remainingReqdFixups + let (_, origStartOfInstr, _) = List.head remainingReqdFixups origStartOfInstr // Copy over a chunk of non-branching code @@ -1621,25 +1621,25 @@ module Codebuf = // Record how to adjust addresses in this range, including the branch instruction // we write below, or the end of the method if we're doing the last bblock - adjustments := (origStartOfNoBranchBlock, origEndOfNoBranchBlock, newStartOfNoBranchBlock) :: !adjustments + adjustments <- (origStartOfNoBranchBlock, origEndOfNoBranchBlock, newStartOfNoBranchBlock) :: adjustments // Increment locations to the branch instruction we're really interested in - origWhere := origEndOfNoBranchBlock - newWhere := !newWhere + nobranch_len + origWhere <- origEndOfNoBranchBlock + newWhere <- newWhere + nobranch_len // Now do the branch instruction. Decide whether the fixup will be short or long in the new code if doingLast then - doneLast := true + doneLast <- true else - let (i, origStartOfInstr, tgs: ILCodeLabel list) = List.head !remainingReqdFixups - remainingReqdFixups := List.tail !remainingReqdFixups + let (i, origStartOfInstr, tgs: ILCodeLabel list) = List.head remainingReqdFixups + remainingReqdFixups <- List.tail remainingReqdFixups if origCode.[origStartOfInstr] <> 0x11uy then failwith "br fixup sanity check failed (1)" let i_length = if fst i = i_switch then 5 else 1 - origWhere := !origWhere + i_length + origWhere <- origWhere + i_length let origEndOfInstr = origStartOfInstr + i_length + 4 * tgs.Length - let newEndOfInstrIfSmall = !newWhere + i_length + 1 - let newEndOfInstrIfBig = !newWhere + i_length + 4 * tgs.Length + let newEndOfInstrIfSmall = newWhere + i_length + 1 + let newEndOfInstrIfBig = newWhere + i_length + 4 * tgs.Length let short = match i, tgs with @@ -1664,28 +1664,28 @@ module Codebuf = newCode.EmitInt32 tgs.Length) false - newWhere := !newWhere + i_length - if !newWhere <> newCode.Position then dprintn "mismatch between newWhere and newCode" + newWhere <- newWhere + i_length + if newWhere <> newCode.Position then dprintn "mismatch between newWhere and newCode" tgs |> List.iter (fun tg -> - let origFixupLoc = !origWhere + let origFixupLoc = origWhere checkFixup32 origCode origFixupLoc 0xdeadbbbb if short then - newReqdBrFixups := (!newWhere, newEndOfInstrIfSmall, tg, true) :: !newReqdBrFixups + newReqdBrFixups <- (newWhere, newEndOfInstrIfSmall, tg, true) :: newReqdBrFixups newCode.EmitIntAsByte 0x98 (* sanity check *) - newWhere := !newWhere + 1 + newWhere <- newWhere + 1 else - newReqdBrFixups := (!newWhere, newEndOfInstrIfBig, tg, false) :: !newReqdBrFixups + newReqdBrFixups <- (newWhere, newEndOfInstrIfBig, tg, false) :: newReqdBrFixups newCode.EmitInt32 0xf00dd00f (* sanity check *) - newWhere := !newWhere + 4 - if !newWhere <> newCode.Position then dprintn "mismatch between newWhere and newCode" - origWhere := !origWhere + 4) + newWhere <- newWhere + 4 + if newWhere <> newCode.Position then dprintn "mismatch between newWhere and newCode" + origWhere <- origWhere + 4) - if !origWhere <> origEndOfInstr then dprintn "mismatch between origWhere and origEndOfInstr" + if origWhere <> origEndOfInstr then dprintn "mismatch between origWhere and origEndOfInstr" let adjuster = - let arr = Array.ofList (List.rev !adjustments) + let arr = Array.ofList (List.rev adjustments) fun addr -> let i = try binaryChop (fun (a1, a2, _) -> if addr < a1 then -1 elif addr > a2 then 1 else 0) arr @@ -1696,7 +1696,7 @@ module Codebuf = addr - (origStartOfNoBranchBlock - newStartOfNoBranchBlock) newCode.Close(), - !newReqdBrFixups, + newReqdBrFixups, adjuster // Now adjust everything @@ -3061,7 +3061,7 @@ let writeILMetadataAndCode (generatePdb, desiredMetadataVersion, ilg, emitTailca // When we know the real RVAs of the data section we fixup the references for the FieldRVA table. // These references are stored as offsets into the metadata we return from this function - let requiredDataFixups = ref [] + let mutable requiredDataFixups = [] let next = cilStartAddress @@ -3146,11 +3146,11 @@ let writeILMetadataAndCode (generatePdb, desiredMetadataVersion, ilg, emitTailca let stringAddressTable = let tab = Array.create (strings.Length + 1) 0 - let pos = ref 1 + let mutable pos = 1 for i = 1 to strings.Length do - tab.[i] <- !pos + tab.[i] <- pos let s = strings.[i - 1] - pos := !pos + s.Length + pos <- pos + s.Length tab let stringAddress n = @@ -3159,12 +3159,12 @@ let writeILMetadataAndCode (generatePdb, desiredMetadataVersion, ilg, emitTailca let userStringAddressTable = let tab = Array.create (Array.length userStrings + 1) 0 - let pos = ref 1 + let mutable pos = 1 for i = 1 to Array.length userStrings do - tab.[i] <- !pos + tab.[i] <- pos let s = userStrings.[i - 1] let n = s.Length + 1 - pos := !pos + n + ByteBuffer.Z32Size n + pos <- pos + n + ByteBuffer.Z32Size n tab let userStringAddress n = @@ -3173,11 +3173,11 @@ let writeILMetadataAndCode (generatePdb, desiredMetadataVersion, ilg, emitTailca let blobAddressTable = let tab = Array.create (blobs.Length + 1) 0 - let pos = ref 1 + let mutable pos = 1 for i = 1 to blobs.Length do - tab.[i] <- !pos + tab.[i] <- pos let blob = blobs.[i - 1] - pos := !pos + blob.Length + ByteBuffer.Z32Size blob.Length + pos <- pos + blob.Length + ByteBuffer.Z32Size blob.Length tab let blobAddress n = @@ -3320,8 +3320,8 @@ let writeILMetadataAndCode (generatePdb, desiredMetadataVersion, ilg, emitTailca match t with | _ when t = RowElementTags.UShort -> tablesBuf.EmitUInt16 (uint16 n) | _ when t = RowElementTags.ULong -> tablesBuf.EmitInt32 n - | _ when t = RowElementTags.Data -> recordRequiredDataFixup requiredDataFixups tablesBuf (tablesStreamStart + tablesBuf.Position) (n, false) - | _ when t = RowElementTags.DataResources -> recordRequiredDataFixup requiredDataFixups tablesBuf (tablesStreamStart + tablesBuf.Position) (n, true) + | _ when t = RowElementTags.Data -> recordRequiredDataFixup &requiredDataFixups tablesBuf (tablesStreamStart + tablesBuf.Position) (n, false) + | _ when t = RowElementTags.DataResources -> recordRequiredDataFixup &requiredDataFixups tablesBuf (tablesStreamStart + tablesBuf.Position) (n, true) | _ when t = RowElementTags.Guid -> tablesBuf.EmitZUntaggedIndex guidsBig (guidAddress n) | _ when t = RowElementTags.Blob -> tablesBuf.EmitZUntaggedIndex blobsBig (blobAddress n) | _ when t = RowElementTags.String -> tablesBuf.EmitZUntaggedIndex stringsBig (stringAddress n) @@ -3448,7 +3448,7 @@ let writeILMetadataAndCode (generatePdb, desiredMetadataVersion, ilg, emitTailca applyFixup32 code locInCode token reportTime showTimes "Fixup Metadata" - entryPointToken, code, codePadding, metadata, data, resources, !requiredDataFixups, pdbData, mappings, guidStart + entryPointToken, code, codePadding, metadata, data, resources, requiredDataFixups, pdbData, mappings, guidStart //--------------------------------------------------------------------- // PHYSICAL METADATA+BLOBS --> PHYSICAL PE FORMAT diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 682b20a6888..aeb78986f85 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -575,17 +575,17 @@ let writePdbInfo showTimes f fpdb info cvChunk = try FileSystem.FileDelete fpdb with _ -> () - let pdbw = ref Unchecked.defaultof + let mutable pdbw = Unchecked.defaultof try - pdbw := pdbInitialize f fpdb + pdbw <- pdbInitialize f fpdb with _ -> error(Error(FSComp.SR.ilwriteErrorCreatingPdb fpdb, rangeCmdArgs)) match info.EntryPoint with | None -> () - | Some x -> pdbSetUserEntryPoint !pdbw x + | Some x -> pdbSetUserEntryPoint pdbw x - let docs = info.Documents |> Array.map (fun doc -> pdbDefineDocument !pdbw doc.File) + let docs = info.Documents |> Array.map (fun doc -> pdbDefineDocument pdbw doc.File) let getDocument i = if i < 0 || i > docs.Length then failwith "getDocument: bad doc number" docs.[i] @@ -596,36 +596,36 @@ let writePdbInfo showTimes f fpdb info cvChunk = let spCounts = info.Methods |> Array.map (fun x -> x.SequencePoints.Length) let allSps = Array.collect (fun x -> x.SequencePoints) info.Methods |> Array.indexed - let spOffset = ref 0 + let mutable spOffset = 0 info.Methods |> Array.iteri (fun i minfo -> - let sps = Array.sub allSps !spOffset spCounts.[i] - spOffset := !spOffset + spCounts.[i] + let sps = Array.sub allSps spOffset spCounts.[i] + spOffset <- spOffset + spCounts.[i] begin match minfo.Range with | None -> () | Some (a,b) -> - pdbOpenMethod !pdbw minfo.MethToken + pdbOpenMethod pdbw minfo.MethToken - pdbSetMethodRange !pdbw + pdbSetMethodRange pdbw (getDocument a.Document) a.Line a.Column (getDocument b.Document) b.Line b.Column // Partition the sequence points by document let spsets = - let res = Dictionary() + let res = Dictionary() for (_,sp) in sps do let k = sp.Document let mutable xsR = Unchecked.defaultof<_> if res.TryGetValue(k,&xsR) then - xsR := sp :: !xsR + xsR <- sp :: xsR else - res.[k] <- ref [sp] + res.[k] <- [sp] res spsets |> Seq.iter (fun kv -> - let spset = !kv.Value + let spset = kv.Value if not spset.IsEmpty then let spset = Array.ofList spset Array.sortInPlaceWith SequencePoint.orderByOffset spset @@ -635,7 +635,7 @@ let writePdbInfo showTimes f fpdb info cvChunk = (sp.Offset, sp.Line, sp.Column,sp.EndLine, sp.EndColumn)) // Use of alloca in implementation of pdbDefineSequencePoints can give stack overflow here if sps.Length < 5000 then - pdbDefineSequencePoints !pdbw (getDocument spset.[0].Document) sps) + pdbDefineSequencePoints pdbw (getDocument spset.[0].Document) sps) // Write the scopes let rec writePdbScope parent sco = @@ -645,21 +645,21 @@ let writePdbInfo showTimes f fpdb info cvChunk = match parent with | Some p -> sco.StartOffset <> p.StartOffset || sco.EndOffset <> p.EndOffset | None -> true - if nested then pdbOpenScope !pdbw sco.StartOffset - sco.Locals |> Array.iter (fun v -> pdbDefineLocalVariable !pdbw v.Name v.Signature v.Index) + if nested then pdbOpenScope pdbw sco.StartOffset + sco.Locals |> Array.iter (fun v -> pdbDefineLocalVariable pdbw v.Name v.Signature v.Index) sco.Children |> Array.iter (writePdbScope (if nested then Some sco else parent)) - if nested then pdbCloseScope !pdbw sco.EndOffset + if nested then pdbCloseScope pdbw sco.EndOffset match minfo.RootScope with | None -> () | Some rootscope -> writePdbScope None rootscope - pdbCloseMethod !pdbw + pdbCloseMethod pdbw end) reportTime showTimes "PDB: Wrote methods" - let res = pdbWriteDebugInfo !pdbw + let res = pdbWriteDebugInfo pdbw for pdbDoc in docs do pdbCloseDocument pdbDoc - pdbClose !pdbw f fpdb + pdbClose pdbw f fpdb reportTime showTimes "PDB: Closed" [| { iddCharacteristics = res.iddCharacteristics From b72c093c64848ce469469e9238b5fc78cad8d379 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 31 Dec 2019 13:38:19 -0800 Subject: [PATCH 2/9] Updates --- src/absil/ilread.fs | 66 +++++++++---------- src/fsharp/xlf/FSComp.txt.es.xlf | 2 +- ...osoft.VisualStudio.Editors.Designer.cs.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.de.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.es.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.fr.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.it.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.ja.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.ko.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.pl.xlf | 3 +- ...ft.VisualStudio.Editors.Designer.pt-BR.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.ru.xlf | 3 +- ...osoft.VisualStudio.Editors.Designer.tr.xlf | 3 +- ....VisualStudio.Editors.Designer.zh-Hans.xlf | 3 +- ....VisualStudio.Editors.Designer.zh-Hant.xlf | 3 +- 15 files changed, 60 insertions(+), 47 deletions(-) diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs index 7e2eed479c5..07b5cbefd3a 100644 --- a/src/absil/ilread.fs +++ b/src/absil/ilread.fs @@ -994,8 +994,8 @@ let seekReadTypeRefRow (ctxt: ILMetadataReader) mdv idx = /// Read Table ILTypeDef. let seekReadTypeDefRow (ctxt: ILMetadataReader) idx = ctxt.seekReadTypeDefRow idx -let seekReadTypeDefRowUncached (ctxtH: ILMetadataReader option ref) idx = - let ctxt = getHole ctxtH +let seekReadTypeDefRowUncached ctxtH idx = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let mutable addr = ctxt.rowAddr TableNames.TypeDef idx let flags = seekReadInt32Adv mdv &addr @@ -1050,8 +1050,8 @@ let seekReadMemberRefRow (ctxt: ILMetadataReader) mdv idx = /// Read Table Constant. let seekReadConstantRow (ctxt: ILMetadataReader) idx = ctxt.seekReadConstantRow idx -let seekReadConstantRowUncached (ctxtH: ILMetadataReader option ref) idx = - let ctxt = getHole ctxtH +let seekReadConstantRowUncached ctxtH idx = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let mutable addr = ctxt.rowAddr TableNames.Constant idx let kind = seekReadUInt16Adv mdv &addr @@ -1136,8 +1136,8 @@ let seekReadPropertyRow (ctxt: ILMetadataReader) mdv idx = /// Read Table MethodSemantics. let seekReadMethodSemanticsRow (ctxt: ILMetadataReader) idx = ctxt.seekReadMethodSemanticsRow idx -let seekReadMethodSemanticsRowUncached (ctxtH: ILMetadataReader option ref) idx = - let ctxt = getHole ctxtH +let seekReadMethodSemanticsRowUncached ctxtH idx = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let mutable addr = ctxt.rowAddr TableNames.MethodSemantics idx let flags = seekReadUInt16AsInt32Adv mdv &addr @@ -1270,15 +1270,15 @@ let seekReadMethodSpecRow (ctxt: ILMetadataReader) mdv idx = (mdorIdx, instIdx) -let readUserStringHeapUncached (ctxtH: ILMetadataReader option ref) idx = - let ctxt = getHole ctxtH +let readUserStringHeapUncached ctxtH idx = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() seekReadUserString mdv (ctxt.userStringsStreamPhysicalLoc + idx) let readUserStringHeap (ctxt: ILMetadataReader) idx = ctxt.readUserStringHeap idx -let readStringHeapUncached (ctxtH: ILMetadataReader option ref) idx = - let ctxt = getHole ctxtH +let readStringHeapUncached ctxtH idx = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() seekReadUTF8String mdv (ctxt.stringsStreamPhysicalLoc + idx) @@ -1288,8 +1288,8 @@ let readStringHeapOption (ctxt: ILMetadataReader) idx = if idx = 0 then None els let emptyByteArray: byte[] = [||] -let readBlobHeapUncached (ctxtH: ILMetadataReader option ref) idx = - let ctxt = getHole ctxtH +let readBlobHeapUncached ctxtH idx = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() // valid index lies in range [1..streamSize) // NOTE: idx cannot be 0 - Blob\String heap has first empty element that mdv one byte 0 @@ -1473,8 +1473,8 @@ and seekReadAssemblyManifest (ctxt: ILMetadataReader) pectxt idx = IgnoreSymbolStoreSequencePoints = 0 <> (flags &&& 0x2000) } and seekReadAssemblyRef (ctxt: ILMetadataReader) idx = ctxt.seekReadAssemblyRef idx -and seekReadAssemblyRefUncached (ctxtH: ILMetadataReader option ref) idx = - let ctxt = getHole ctxtH +and seekReadAssemblyRefUncached ctxtH idx = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let (v1, v2, v3, v4, flags, publicKeyOrTokenIdx, nameIdx, localeIdx, hashValueIdx) = seekReadAssemblyRefRow ctxt mdv idx let nm = readStringHeap ctxt nameIdx @@ -1628,8 +1628,8 @@ and seekReadInterfaceImpls (ctxt: ILMetadataReader) mdv numtypars tidx = and seekReadGenericParams ctxt numtypars (a, b): ILGenericParameterDefs = ctxt.seekReadGenericParams (GenericParamsIdx(numtypars, a, b)) -and seekReadGenericParamsUncached (ctxtH: ILMetadataReader option ref) (GenericParamsIdx(numtypars, a, b)) = - let ctxt = getHole ctxtH +and seekReadGenericParamsUncached ctxtH (GenericParamsIdx(numtypars, a, b)) = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let pars = seekReadIndexedRows @@ -1668,8 +1668,8 @@ and seekReadGenericParamConstraints (ctxt: ILMetadataReader) mdv numtypars gpidx and seekReadTypeDefAsType (ctxt: ILMetadataReader) boxity (ginst: ILTypes) idx = ctxt.seekReadTypeDefAsType (TypeDefAsTypIdx (boxity, ginst, idx)) -and seekReadTypeDefAsTypeUncached (ctxtH: ILMetadataReader option ref) (TypeDefAsTypIdx (boxity, ginst, idx)) = - let ctxt = getHole ctxtH +and seekReadTypeDefAsTypeUncached ctxtH (TypeDefAsTypIdx (boxity, ginst, idx)) = + let (ctxt: ILMetadataReader) = getHole ctxtH mkILTy boxity (ILTypeSpec.Create(seekReadTypeDefAsTypeRef ctxt idx, ginst)) and seekReadTypeDefAsTypeRef (ctxt: ILMetadataReader) idx = @@ -1693,8 +1693,8 @@ and seekReadTypeRefUncached (ctxtH: ILMetadataReader option ref) idx = ILTypeRef.Create(scope=scope, enclosing=enc, name = nm) and seekReadTypeRefAsType (ctxt: ILMetadataReader) boxity ginst idx = ctxt.seekReadTypeRefAsType (TypeRefAsTypIdx (boxity, ginst, idx)) -and seekReadTypeRefAsTypeUncached (ctxtH: ILMetadataReader option ref) (TypeRefAsTypIdx (boxity, ginst, idx)) = - let ctxt = getHole ctxtH +and seekReadTypeRefAsTypeUncached ctxtH (TypeRefAsTypIdx (boxity, ginst, idx)) = + let (ctxt: ILMetadataReader) = getHole ctxtH mkILTy boxity (ILTypeSpec.Create(seekReadTypeRef ctxt idx, ginst)) and seekReadTypeDefOrRef (ctxt: ILMetadataReader) numtypars boxity (ginst: ILTypes) (TaggedIndex(tag, idx) ) = @@ -1942,8 +1942,8 @@ and sigptrGetLocal (ctxt: ILMetadataReader) numtypars bytes sigptr = and readBlobHeapAsMethodSig (ctxt: ILMetadataReader) numtypars blobIdx = ctxt.readBlobHeapAsMethodSig (BlobAsMethodSigIdx (numtypars, blobIdx)) -and readBlobHeapAsMethodSigUncached (ctxtH: ILMetadataReader option ref) (BlobAsMethodSigIdx (numtypars, blobIdx)) = - let ctxt = getHole ctxtH +and readBlobHeapAsMethodSigUncached ctxtH (BlobAsMethodSigIdx (numtypars, blobIdx)) = + let (ctxt: ILMetadataReader) = getHole ctxtH let bytes = readBlobHeap ctxt blobIdx let sigptr = 0 let ccByte, sigptr = sigptrGetByte bytes sigptr @@ -1962,7 +1962,7 @@ and readBlobHeapAsType ctxt numtypars blobIdx = and readBlobHeapAsFieldSig ctxt numtypars blobIdx = ctxt.readBlobHeapAsFieldSig (BlobAsFieldSigIdx (numtypars, blobIdx)) -and readBlobHeapAsFieldSigUncached (ctxtH: ILMetadataReader option ref) (BlobAsFieldSigIdx (numtypars, blobIdx)) = +and readBlobHeapAsFieldSigUncached ctxtH (BlobAsFieldSigIdx (numtypars, blobIdx)) = let ctxt = getHole ctxtH let bytes = readBlobHeap ctxt blobIdx let sigptr = 0 @@ -1975,7 +1975,7 @@ and readBlobHeapAsFieldSigUncached (ctxtH: ILMetadataReader option ref) (BlobAsF and readBlobHeapAsPropertySig (ctxt: ILMetadataReader) numtypars blobIdx = ctxt.readBlobHeapAsPropertySig (BlobAsPropSigIdx (numtypars, blobIdx)) -and readBlobHeapAsPropertySigUncached (ctxtH: ILMetadataReader option ref) (BlobAsPropSigIdx (numtypars, blobIdx)) = +and readBlobHeapAsPropertySigUncached ctxtH (BlobAsPropSigIdx (numtypars, blobIdx)) = let ctxt = getHole ctxtH let bytes = readBlobHeap ctxt blobIdx let sigptr = 0 @@ -1991,7 +1991,7 @@ and readBlobHeapAsPropertySigUncached (ctxtH: ILMetadataReader option ref) (Blob and readBlobHeapAsLocalsSig (ctxt: ILMetadataReader) numtypars blobIdx = ctxt.readBlobHeapAsLocalsSig (BlobAsLocalSigIdx (numtypars, blobIdx)) -and readBlobHeapAsLocalsSigUncached (ctxtH: ILMetadataReader option ref) (BlobAsLocalSigIdx (numtypars, blobIdx)) = +and readBlobHeapAsLocalsSigUncached ctxtH (BlobAsLocalSigIdx (numtypars, blobIdx)) = let ctxt = getHole ctxtH let bytes = readBlobHeap ctxt blobIdx let sigptr = 0 @@ -2040,8 +2040,8 @@ and seekReadMemberRefAsMethDataNoVarArgs ctxt numtypars idx: MethodData = and seekReadMethodSpecAsMethodData (ctxt: ILMetadataReader) numtypars idx = ctxt.seekReadMethodSpecAsMethodData (MethodSpecAsMspecIdx (numtypars, idx)) -and seekReadMethodSpecAsMethodDataUncached (ctxtH: ILMetadataReader option ref) (MethodSpecAsMspecIdx (numtypars, idx)) = - let ctxt = getHole ctxtH +and seekReadMethodSpecAsMethodDataUncached ctxtH (MethodSpecAsMspecIdx (numtypars, idx)) = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let (mdorIdx, instIdx) = seekReadMethodSpecRow ctxt mdv idx let (VarArgMethodData(enclTy, cc, nm, argtys, varargs, retty, _)) = seekReadMethodDefOrRef ctxt numtypars mdorIdx @@ -2058,8 +2058,8 @@ and seekReadMethodSpecAsMethodDataUncached (ctxtH: ILMetadataReader option ref) and seekReadMemberRefAsFieldSpec (ctxt: ILMetadataReader) numtypars idx = ctxt.seekReadMemberRefAsFieldSpec (MemberRefAsFspecIdx (numtypars, idx)) -and seekReadMemberRefAsFieldSpecUncached (ctxtH: ILMetadataReader option ref) (MemberRefAsFspecIdx (numtypars, idx)) = - let ctxt = getHole ctxtH +and seekReadMemberRefAsFieldSpecUncached ctxtH (MemberRefAsFspecIdx (numtypars, idx)) = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let (mrpIdx, nameIdx, typeIdx) = seekReadMemberRefRow ctxt mdv idx let nm = readStringHeap ctxt nameIdx @@ -2076,8 +2076,8 @@ and seekReadMemberRefAsFieldSpecUncached (ctxtH: ILMetadataReader option ref) (M and seekReadMethodDefAsMethodData ctxt idx = ctxt.seekReadMethodDefAsMethodData idx -and seekReadMethodDefAsMethodDataUncached (ctxtH: ILMetadataReader option ref) idx = - let ctxt = getHole ctxtH +and seekReadMethodDefAsMethodDataUncached ctxtH idx = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() // Look for the method def parent. let tidx = @@ -2340,10 +2340,10 @@ and seekReadProperties (ctxt: ILMetadataReader) numtypars tidx = yield seekReadProperty ctxt mdv numtypars i ]) -and customAttrsReader (ctxtH: ILMetadataReader option ref) tag: ILAttributesStored = +and customAttrsReader ctxtH tag: ILAttributesStored = mkILCustomAttrsReader (fun idx -> - let ctxt = getHole ctxtH + let (ctxt: ILMetadataReader) = getHole ctxtH seekReadIndexedRows (ctxt.getNumRows TableNames.CustomAttribute, seekReadCustomAttributeRow ctxt, (fun (a, _, _) -> a), hcaCompare (TaggedIndex(tag,idx)), diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index ba91cf6400f..a94231bb012 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -159,7 +159,7 @@ All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. - Todas las ramas de una expresión de coincidencia de patrón deben devolver valores del mismo tipo. La primera rama devolvió un valor de tipo "{0}", pero esta rama devolvió un valor de tipo "\{1 \}". + All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf index b071e0c5f72..5340031907e 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.cs.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf index 4184f3edc59..2ca4bd450e9 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.de.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf index 4b1a5e0d904..394481ad696 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.es.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf index 99d34699194..821545638e2 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.fr.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf index 8902030751c..dd58cb9a119 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.it.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf index de4d65e71f8..c0221174d97 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ja.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf index e7191ac3c4a..6f540b54250 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ko.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf index 6936b8e97f5..f912b6b4c78 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pl.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf index fefd197867e..5a2b75dce09 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.pt-BR.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf index 355d363084e..2b5303d91de 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.ru.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf index 86ac32f4b37..73a72b806a2 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.tr.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf index 0537632d5fc..474f99a3dcd 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hans.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" diff --git a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf index 17c64ffefb9..16b7339b2a4 100644 --- a/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf +++ b/vsintegration/src/FSharp.ProjectSystem.PropertyPages/Resources/xlf/Microsoft.VisualStudio.Editors.Designer.zh-Hant.xlf @@ -1828,8 +1828,9 @@ CONSIDER: get this from CodeDom {0} x {1} - {0} x {1} + {0} x {1} Format string for showing a graphic's size + # {0} = width (as an integer) # {1} = height (as an integer) #Example, for a bitmap of width=123, height = 456, the English version of this string would be "123x456" From 38a7b883ff64b736d7e03757c3697c12853af92a Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 31 Dec 2019 13:46:56 -0800 Subject: [PATCH 3/9] build/diff --- src/absil/ilread.fs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs index 07b5cbefd3a..d0139acf6c0 100644 --- a/src/absil/ilread.fs +++ b/src/absil/ilread.fs @@ -1238,8 +1238,8 @@ let seekReadManifestResourceRow (ctxt: ILMetadataReader) mdv idx = /// Read Table Nested. let seekReadNestedRow (ctxt: ILMetadataReader) idx = ctxt.seekReadNestedRow idx -let seekReadNestedRowUncached (ctxtH: ILMetadataReader option ref) idx = - let ctxt = getHole ctxtH +let seekReadNestedRowUncached ctxtH idx = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let mutable addr = ctxt.rowAddr TableNames.Nested idx let nestedIdx = seekReadUntaggedIdx TableNames.TypeDef ctxt mdv &addr @@ -1563,10 +1563,10 @@ and seekReadPreTypeDef ctxt toponly (idx: int) = // Return the ILPreTypeDef Some (mkILPreTypeDefRead (ns, n, idx, ctxt.typeDefReader)) -and typeDefReader (ctxtH: ILMetadataReader option ref): ILTypeDefStored = +and typeDefReader ctxtH: ILTypeDefStored = mkILTypeDefReader (fun idx -> - let ctxt = getHole ctxtH + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() // Re-read so as not to save all these in the lazy closure - this suspension ctxt.is the largest // heavily allocated one in all of AbsIL @@ -1669,7 +1669,7 @@ and seekReadTypeDefAsType (ctxt: ILMetadataReader) boxity (ginst: ILTypes) idx = ctxt.seekReadTypeDefAsType (TypeDefAsTypIdx (boxity, ginst, idx)) and seekReadTypeDefAsTypeUncached ctxtH (TypeDefAsTypIdx (boxity, ginst, idx)) = - let (ctxt: ILMetadataReader) = getHole ctxtH + let ctxt = getHole ctxtH mkILTy boxity (ILTypeSpec.Create(seekReadTypeDefAsTypeRef ctxt idx, ginst)) and seekReadTypeDefAsTypeRef (ctxt: ILMetadataReader) idx = @@ -1684,8 +1684,8 @@ and seekReadTypeDefAsTypeRef (ctxt: ILMetadataReader) idx = ILTypeRef.Create(scope=ILScopeRef.Local, enclosing=enc, name = nm ) and seekReadTypeRef (ctxt: ILMetadataReader) idx = ctxt.seekReadTypeRef idx -and seekReadTypeRefUncached (ctxtH: ILMetadataReader option ref) idx = - let ctxt = getHole ctxtH +and seekReadTypeRefUncached ctxtH idx = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let scopeIdx, nameIdx, namespaceIdx = seekReadTypeRefRow ctxt mdv idx let scope, enc = seekReadTypeRefScope ctxt mdv scopeIdx @@ -1694,7 +1694,7 @@ and seekReadTypeRefUncached (ctxtH: ILMetadataReader option ref) idx = and seekReadTypeRefAsType (ctxt: ILMetadataReader) boxity ginst idx = ctxt.seekReadTypeRefAsType (TypeRefAsTypIdx (boxity, ginst, idx)) and seekReadTypeRefAsTypeUncached ctxtH (TypeRefAsTypIdx (boxity, ginst, idx)) = - let (ctxt: ILMetadataReader) = getHole ctxtH + let ctxt = getHole ctxtH mkILTy boxity (ILTypeSpec.Create(seekReadTypeRef ctxt idx, ginst)) and seekReadTypeDefOrRef (ctxt: ILMetadataReader) numtypars boxity (ginst: ILTypes) (TaggedIndex(tag, idx) ) = @@ -2022,8 +2022,8 @@ and byteAsCallConv b = and seekReadMemberRefAsMethodData ctxt numtypars idx: VarArgMethodData = ctxt.seekReadMemberRefAsMethodData (MemberRefAsMspecIdx (numtypars, idx)) -and seekReadMemberRefAsMethodDataUncached (ctxtH: ILMetadataReader option ref) (MemberRefAsMspecIdx (numtypars, idx)) = - let ctxt = getHole ctxtH +and seekReadMemberRefAsMethodDataUncached ctxtH (MemberRefAsMspecIdx (numtypars, idx)) = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let (mrpIdx, nameIdx, typeIdx) = seekReadMemberRefRow ctxt mdv idx let nm = readStringHeap ctxt nameIdx @@ -2116,8 +2116,8 @@ and seekReadMethodDefAsMethodDataUncached ctxtH idx = and seekReadFieldDefAsFieldSpec (ctxt: ILMetadataReader) idx = ctxt.seekReadFieldDefAsFieldSpec idx -and seekReadFieldDefAsFieldSpecUncached (ctxtH: ILMetadataReader option ref) idx = - let ctxt = getHole ctxtH +and seekReadFieldDefAsFieldSpecUncached ctxtH idx = + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let (_flags, nameIdx, typeIdx) = seekReadFieldRow ctxt mdv idx let nm = readStringHeap ctxt nameIdx @@ -2354,7 +2354,7 @@ and customAttrsReader ctxtH tag: ILAttributesStored = and seekReadCustomAttr ctxt (TaggedIndex(cat, idx), b) = ctxt.seekReadCustomAttr (CustomAttrIdx (cat, idx, b)) -and seekReadCustomAttrUncached (ctxtH: ILMetadataReader option ref) (CustomAttrIdx (cat, idx, valIdx)) = +and seekReadCustomAttrUncached ctxtH (CustomAttrIdx (cat, idx, valIdx)) = let ctxt = getHole ctxtH let method = seekReadCustomAttrType ctxt (TaggedIndex(cat, idx)) let data = @@ -2365,9 +2365,9 @@ and seekReadCustomAttrUncached (ctxtH: ILMetadataReader option ref) (CustomAttrI ILAttribute.Encoded (method, data, elements) and securityDeclsReader (ctxtH: ILMetadataReader option ref) tag = - let ctxt = getHole ctxtH mkILSecurityDeclsReader (fun idx -> + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() seekReadIndexedRows (ctxt.getNumRows TableNames.Permission, seekReadPermissionRow ctxt mdv, From 8394e4b13ba5bfea0261691116b51f5ec8beb7cb Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 31 Dec 2019 13:49:18 -0800 Subject: [PATCH 4/9] build/diff --- src/absil/ilread.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs index d0139acf6c0..e852c5c7b6b 100644 --- a/src/absil/ilread.fs +++ b/src/absil/ilread.fs @@ -1348,8 +1348,8 @@ let readNativeResources (pectxt: PEReader) = let getDataEndPointsDelayed (pectxt: PEReader) (ctxtH: ILMetadataReader option ref) = - let ctxt = getHole ctxtH lazy + let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() let dataStartPoints = let mutable res = [] @@ -2364,7 +2364,7 @@ and seekReadCustomAttrUncached ctxtH (CustomAttrIdx (cat, idx, valIdx)) = let elements = [] ILAttribute.Encoded (method, data, elements) -and securityDeclsReader (ctxtH: ILMetadataReader option ref) tag = +and securityDeclsReader ctxtH tag = mkILSecurityDeclsReader (fun idx -> let (ctxt: ILMetadataReader) = getHole ctxtH From 9751b8d0b8536a43c97003210ddbe1388f2ba092 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 31 Dec 2019 13:56:34 -0800 Subject: [PATCH 5/9] reduce diff --- src/absil/ilread.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs index e852c5c7b6b..a5d68e295f2 100644 --- a/src/absil/ilread.fs +++ b/src/absil/ilread.fs @@ -1347,7 +1347,7 @@ let readNativeResources (pectxt: PEReader) = yield ILNativeResource.In (pectxt.fileName, pectxt.nativeResourcesAddr, start, pectxt.nativeResourcesSize ) ] -let getDataEndPointsDelayed (pectxt: PEReader) (ctxtH: ILMetadataReader option ref) = +let getDataEndPointsDelayed (pectxt: PEReader) ctxtH = lazy let (ctxt: ILMetadataReader) = getHole ctxtH let mdv = ctxt.mdfile.GetView() From 7db4c2ce4d11a9da1332c44f930f0be5c707ae08 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 31 Dec 2019 14:09:41 -0800 Subject: [PATCH 6/9] Update FSComp.txt.es.xlf --- src/fsharp/xlf/FSComp.txt.es.xlf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/xlf/FSComp.txt.es.xlf b/src/fsharp/xlf/FSComp.txt.es.xlf index a94231bb012..d241c2953bf 100644 --- a/src/fsharp/xlf/FSComp.txt.es.xlf +++ b/src/fsharp/xlf/FSComp.txt.es.xlf @@ -159,7 +159,7 @@ All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. - All branches of a pattern match expression must return values of the same type as the first branch, which here is '{0}'. This branch returns a value of type '{1}'. + Todas las ramas de una expresión de coincidencia de patrón deben devolver valores del mismo tipo. La primera rama devolvió un valor de tipo "{0}", pero esta rama devolvió un valor de tipo "\{1 \}". @@ -7224,4 +7224,4 @@ - \ No newline at end of file + From f0a44eb6a1768965ee95b1c03f1a4f0ec6fcaea1 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 31 Dec 2019 14:10:01 -0800 Subject: [PATCH 7/9] Update FSComp.txt.es.xlf From 51af3bc9f152e7c39dc69da0074a595e2b89dfe7 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Tue, 31 Dec 2019 14:10:22 -0800 Subject: [PATCH 8/9] Update FSComp.txt.es.xlf From 0306c82ff862a06379b8d1b5e5fb6d6aa6812d91 Mon Sep 17 00:00:00 2001 From: Phillip Carter Date: Thu, 2 Jan 2020 15:22:21 -0800 Subject: [PATCH 9/9] more explicit type annotation --- src/absil/ilwrite.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 8c4b4b73727..27ee560fbbf 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -645,7 +645,7 @@ type ILTokenMappings = PropertyTokenMap: ILTypeDef list * ILTypeDef -> ILPropertyDef -> int32 EventTokenMap: ILTypeDef list * ILTypeDef -> ILEventDef -> int32 } -let recordRequiredDataFixup (requiredDataFixups: byref<('a * 'b) list>) (buf: ByteBuffer) pos lab = +let recordRequiredDataFixup (requiredDataFixups: byref<(int32 * (int * bool)) list>) (buf: ByteBuffer) pos lab = requiredDataFixups <- (pos, lab) :: requiredDataFixups // Write a special value in that we check later when applying the fixup buf.EmitInt32 0xdeaddddd