From 620477107df0ca482d87eb3b19bf339da029dffc Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Wed, 2 Mar 2016 17:54:16 -0800 Subject: [PATCH 01/11] Merge with coreclr --- build.cmd | 25 +- packages.config | 4 + src/FSharpSource.targets | 5 + src/absil/ildiag.fs | 18 + src/absil/ildiag.fsi | 1 + src/absil/illib.fs | 1 + src/absil/ilsupp.fs | 4 +- src/absil/ilsupp.fsi | 9 +- src/absil/ilwrite.fs | 489 ++------------ src/absil/ilwrite.fsi | 4 +- src/absil/ilwritepdb.fs | 635 ++++++++++++++++++ src/absil/ilwritepdb.fsi | 91 +++ src/fsharp/CompileOps.fs | 3 + src/fsharp/CompileOps.fsi | 2 + src/fsharp/CompileOptions.fs | 13 +- src/fsharp/FSComp.txt | 2 +- src/fsharp/FSharp.Build/FSharp.Build.fsproj | 4 +- .../FSharp.Compiler-proto.fsproj | 18 +- .../FSharp.Compiler/FSharp.Compiler.fsproj | 14 +- src/fsharp/FSharp.Compiler/project.json | 8 +- src/fsharp/FSharp.Compiler/project.lock.json | 159 ++++- .../FSharp.LanguageService.Compiler.fsproj | 18 +- src/fsharp/Fsc/project.json | 1 + src/fsharp/Fsc/project.lock.json | 268 +++++++- src/fsharp/fsc.fs | 1 + src/fsharp/fsi/project.json | 1 + src/fsharp/fsi/project.lock.json | 266 ++++++++ tests/RunTests.cmd | 2 +- tests/fsharp/core/access/test.fsx | 1 + tests/fsharp/project.json | 2 +- tests/fsharp/project.lock.json | 18 +- .../testenv/src/deployProj/CompileProj.fsx | 2 +- .../Project/ProjectSystem.Base.csproj | 5 +- 33 files changed, 1603 insertions(+), 491 deletions(-) create mode 100644 src/absil/ilwritepdb.fs create mode 100644 src/absil/ilwritepdb.fsi diff --git a/build.cmd b/build.cmd index cc32dceba5c..98ca1a8adc2 100644 --- a/build.cmd +++ b/build.cmd @@ -174,7 +174,7 @@ echo BUILD_CONFIG_LOWERCASE=%BUILD_CONFIG_LOWERCASE% echo. if "%RestorePackages%"=="" ( - set RestorePackages=true + set RestorePackages=true ) @echo on @@ -210,10 +210,12 @@ set msbuildflags=/maxcpucount set _ngenexe="%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\ngen.exe" if not exist %_ngenexe% echo Error: Could not find ngen.exe. && goto :failure -%_ngenexe% install .\.nuget\NuGet.exe +if '%RestorePackages%' == 'true' ( + %_ngenexe% install .\.nuget\NuGet.exe -.\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget\nuget.config -@if ERRORLEVEL 1 echo Error: Nuget restore failed && goto :failure + .\.nuget\NuGet.exe restore packages.config -PackagesDirectory packages -ConfigFile .nuget\nuget.config + @if ERRORLEVEL 1 echo Error: Nuget restore failed && goto :failure +) set DOTNET_HOME .\packages\dotnet @@ -253,14 +255,14 @@ if '%BUILD_PROTO%' == '1' ( @if ERRORLEVEL 1 echo Error: NGen of proto failed && goto :failure ) -%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:Configuration=%BUILD_CONFIG% -@if ERRORLEVEL 1 echo Error: library build failed && goto :failure - -%_msbuildexe% %msbuildflags% src/fsharp-compiler-build.proj /p:Configuration=%BUILD_CONFIG% +%_msbuildexe% %msbuildflags% src/fsharp-compiler-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages% @if ERRORLEVEL 1 echo Error: compiler build failed && goto :failure +%_msbuildexe% %msbuildflags% src/fsharp-library-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages% +@if ERRORLEVEL 1 echo Error: library build failed && goto :failure + if '%BUILD_FSHARP_DATA_TYPEPROVIDERS%' == '1' ( - %_msbuildexe% %msbuildflags% src/fsharp-typeproviders-build.proj /p:Configuration=%BUILD_CONFIG% + %_msbuildexe% %msbuildflags% src/fsharp-typeproviders-build.proj /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages% @if ERRORLEVEL 1 echo Error: type provider build failed && goto :failure ) @@ -270,6 +272,11 @@ if '%BUILD_CORECLR%' == '1' ( %_msbuildexe% %msbuildflags% src/fsharp-compiler-build.proj /p:TargetFramework=coreclr /p:Configuration=%BUILD_CONFIG% /p:RestorePackages=%RestorePackages% @if ERRORLEVEL 1 echo Error: compiler coreclr build failed && goto :failure + + if '%TEST_CORECLR%' == '1' ( + %_msbuildexe% src/fsharp-library-unittests-build.proj /p:TargetFramework=coreclr /p:Configuration=%BUILD_CONFIG% + @if ERRORLEVEL 1 echo Error: library unittests build failed && goto :failure + ) ) if '%BUILD_PORTABLE%' == '1' ( diff --git a/packages.config b/packages.config index 3cb29500c3c..bcd9ed26015 100644 --- a/packages.config +++ b/packages.config @@ -7,4 +7,8 @@ + + + + diff --git a/src/FSharpSource.targets b/src/FSharpSource.targets index d2931b68f1a..3eddd823673 100644 --- a/src/FSharpSource.targets +++ b/src/FSharpSource.targets @@ -108,6 +108,11 @@ obj\$(Configuration)\$(TargetFramework)\ + + + $(OtherFlags) --debug:portable + + $(DefineConstants);OPEN_BUILD diff --git a/src/absil/ildiag.fs b/src/absil/ildiag.fs index 80151d339a7..29524fec595 100644 --- a/src/absil/ildiag.fs +++ b/src/absil/ildiag.fs @@ -23,3 +23,21 @@ let dprintfn (fmt: Format<_,_,_,_>) = Printf.kfprintf dflushn (match !diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt let setDiagnosticsChannel s = diagnosticsLog := s + +//--------------------------------------------------------------------- +// Library: ReportTime +//--------------------------------------------------------------------- + +let reportTime = + let tFirst = ref None + let tPrev = ref None + fun showTimes descr -> + if showTimes then + let t = System.Diagnostics.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 + dprintf "ilwrite: TIME %10.3f (total) %10.3f (delta) - %s\n" (t - first) (t - prev) descr + tPrev := Some t + + + diff --git a/src/absil/ildiag.fsi b/src/absil/ildiag.fsi index 1b4ff4dfdd7..02a5fee192b 100644 --- a/src/absil/ildiag.fsi +++ b/src/absil/ildiag.fsi @@ -20,3 +20,4 @@ val public dprintf: TextWriterFormat<'a> -> 'a val public dprintn: string -> unit +val reportTime : (bool -> string -> unit) \ No newline at end of file diff --git a/src/absil/illib.fs b/src/absil/illib.fs index 58e4b760526..29e9c35a639 100644 --- a/src/absil/illib.fs +++ b/src/absil/illib.fs @@ -25,6 +25,7 @@ let isNonNull (x : 'T) = match (x :> obj) with null -> false | _ -> true let nonNull msg x = if isNonNull x then x else failwith ("null: " ^ msg) let (===) x y = LanguagePrimitives.PhysicalEquality x y + //------------------------------------------------------------------------- // Library: projections //------------------------------------------------------------------------ diff --git a/src/absil/ilsupp.fs b/src/absil/ilsupp.fs index a0ba9581cae..85b4e81da9a 100644 --- a/src/absil/ilsupp.fs +++ b/src/absil/ilsupp.fs @@ -1018,13 +1018,13 @@ type ISymUnmanagedWriter2 = type PdbWriter = { symWriter : ISymUnmanagedWriter2 } type PdbDocumentWriter = { symDocWriter : ISymUnmanagedDocumentWriter } (* pointer to pDocumentWriter COM object *) -#endif type idd = { iddCharacteristics: int32; iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *) iddMinorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *) iddType: int32; iddData: byte[];} +#endif #if FX_NO_PDB_WRITER #else @@ -1147,7 +1147,7 @@ let pdbDefineSequencePoints (writer:PdbWriter) (docWriter: PdbDocumentWriter) (p let endColumns = (Array.map (fun (_,_,_,_,x) -> x) pts) writer.symWriter.DefineSequencePoints(docWriter.symDocWriter, pts.Length, offsets, lines, columns, endLines, endColumns) -let pdbGetDebugInfo (writer: PdbWriter) = +let pdbWriteDebugInfo (writer: PdbWriter) = let mutable iDD = new ImageDebugDirectory() let mutable length = 0 writer.symWriter.GetDebugInfo(&iDD, 0, &length, null) diff --git a/src/absil/ilsupp.fsi b/src/absil/ilsupp.fsi index 4cfc40e6950..006b485a463 100644 --- a/src/absil/ilsupp.fsi +++ b/src/absil/ilsupp.fsi @@ -102,19 +102,14 @@ val pdbVariableGetAddressAttributes: PdbVariable -> int32 (* kind *) * int32 (* //--------------------------------------------------------------------- type PdbDocumentWriter -#endif -#if FX_NO_LINKEDRESOURCES -#else type idd = { iddCharacteristics: int32; iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *) iddMinorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *) iddType: int32; iddData: byte[];} -#endif -#if FX_NO_PDB_WRITER -#else + val pdbInitialize: string (* .exe/.dll already written and closed *) -> string (* .pdb to write *) -> @@ -130,7 +125,7 @@ val pdbCloseScope: PdbWriter -> int -> unit val pdbDefineLocalVariable: PdbWriter -> string -> byte[] -> int32 -> unit val pdbSetMethodRange: PdbWriter -> PdbDocumentWriter -> int -> int -> PdbDocumentWriter -> int -> int -> unit val pdbDefineSequencePoints: PdbWriter -> PdbDocumentWriter -> (int * int * int * int * int) array -> unit -val pdbGetDebugInfo: PdbWriter -> idd +val pdbWriteDebugInfo: PdbWriter -> idd #endif //--------------------------------------------------------------------- diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index f8d5e9cb1c1..9c14f6618fc 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -12,9 +12,12 @@ open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Compiler.AbstractIL.Internal.BinaryConstants open Microsoft.FSharp.Compiler.AbstractIL.Internal.Support open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library +open Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter + #if FX_NO_CORHOST_SIGNER open Microsoft.FSharp.Compiler.AbstractIL.Internal.StrongNameSign #endif + open Microsoft.FSharp.Compiler.DiagnosticMessage open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Range @@ -26,21 +29,6 @@ open System.IO let showEntryLookups = false #endif -//--------------------------------------------------------------------- -// Library -//--------------------------------------------------------------------- - -let reportTime = - let tFirst = ref None - let tPrev = ref None - fun showTimes descr -> - if showTimes then - let t = System.Diagnostics.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 - dprintf "ilwrite: TIME %10.3f (total) %10.3f (delta) - %s\n" (t - first) (t - prev) descr - tPrev := Some t - //--------------------------------------------------------------------- // Byte, byte array fragments and other concrete representations // manipulations. @@ -74,7 +62,6 @@ let align alignment n = ((n + alignment - 1) / alignment) * alignment // Concrete token representations etc. used in PE files //--------------------------------------------------------------------- - type ByteBuffer with /// Z32 = compressed unsigned integer @@ -116,10 +103,10 @@ let getUncodedToken (tab:TableName) idx = ((tab.Index <<< 24) ||| idx) // From ECMA for UserStrings: // This final byte holds the value 1 if and only if any UTF16 character within the string has any bit set in its top byte, or its low byte is any of the following: -// 0x01–0x08, 0x0E–0x1F, 0x27, 0x2D, +// 0x01�0x08, 0x0E�0x1F, 0x27, 0x2D, // 0x7F. Otherwise, it holds 0. The 1 signifies Unicode characters that require handling beyond that normally provided for 8-bit encoding sets. -// HOWEVER, there is a discrepancy here between the ECMA spec and the Microsoft C# implementation. The code below follows the latter. We’ve raised the issue with both teams. See Dev10 bug 850073 for details. +// HOWEVER, there is a discrepancy here between the ECMA spec and the Microsoft C# implementation. The code below follows the latter. We�ve raised the issue with both teams. See Dev10 bug 850073 for details. let markerForUnicodeBytes (b:byte[]) = let len = b.Length @@ -156,331 +143,6 @@ let applyFixup32 (data:byte[]) offset v = data.[offset+2] <- b2 v data.[offset+3] <- b3 v -// -------------------------------------------------------------------- -// PDB data -// -------------------------------------------------------------------- - -type PdbDocumentData = ILSourceDocument - -type PdbLocalVar = - { Name: string - Signature: byte[] - /// the local index the name corresponds to - Index: int32 } - -type PdbMethodScope = - { Children: PdbMethodScope array - StartOffset: int - EndOffset: int - Locals: PdbLocalVar array - (* REVIEW open_namespaces: pdb_namespace array *) } - -type PdbSourceLoc = - { Document: int - Line: int - Column: int } - -type PdbSequencePoint = - { Document: int - Offset: int - Line: int - Column: int - EndLine: int - EndColumn: int } - override x.ToString() = sprintf "(%d,%d)-(%d,%d)" x.Line x.Column x.EndLine x.EndColumn - -type PdbMethodData = - { MethToken: int32 - MethName:string - Params: PdbLocalVar array - RootScope: PdbMethodScope - Range: (PdbSourceLoc * PdbSourceLoc) option - SequencePoints: PdbSequencePoint array } - -module SequencePoint = - let orderBySource sp1 sp2 = - let c1 = compare sp1.Document sp2.Document - if c1 <> 0 then c1 else - let c1 = compare sp1.Line sp2.Line - if c1 <> 0 then c1 else - compare sp1.Column sp2.Column - - let orderByOffset sp1 sp2 = - compare sp1.Offset sp2.Offset - -/// 28 is the size of the IMAGE_DEBUG_DIRECTORY in ntimage.h -let sizeof_IMAGE_DEBUG_DIRECTORY = 28 - -#if FX_NO_PDB_WRITER -#else -[] -type PdbData = - { EntryPoint: int32 option - // MVID of the generated .NET module (used by MDB files to identify debug info) - ModuleID: byte[] - Documents: PdbDocumentData[] - Methods: PdbMethodData[] } - -//--------------------------------------------------------------------- -// PDB Writer. The function [WritePdbInfo] abstracts the -// imperative calls to the Symbol Writer API. -//--------------------------------------------------------------------- - -let WritePdbInfo fixupOverlappingSequencePoints showTimes f fpdb info = - (try FileSystem.FileDelete fpdb with _ -> ()) - let pdbw = ref Unchecked.defaultof - - try - pdbw := pdbInitialize f fpdb - with _ -> error(Error(FSComp.SR.ilwriteErrorCreatingPdb(fpdb), rangeCmdArgs)) - - match info.EntryPoint with - | None -> () - | Some x -> pdbSetUserEntryPoint !pdbw x - - 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] - reportTime showTimes (sprintf "PDB: Defined %d documents" info.Documents.Length) - Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods - - reportTime showTimes (sprintf "PDB: Sorted %d methods" info.Methods.Length) - - // This next bit is a workaround. The sequence points we get - // from F# (which has nothing to do with this module) are actually expression - // marks, i.e. the source ranges they denote are typically - // nested, and each point indicates where the - // code for an expression with a particular range begins. - // This is in many ways a much more convenient form to emit. - // However, it is not the form that debug tools accept nicely. - // However, sequence points are really a non-overlapping, non-nested - // partition of the source code of a method. So here we shorten the - // length of all sequence point marks so they do not go further than - // the next sequence point in the source. - let spCounts = info.Methods |> Array.map (fun x -> x.SequencePoints.Length) - let allSps = Array.concat (Array.map (fun x -> x.SequencePoints) info.Methods |> Array.toList) - let allSps = Array.mapi (fun i sp -> (i,sp)) allSps - if fixupOverlappingSequencePoints then - // sort the sequence points into source order - Array.sortInPlaceWith (fun (_,sp1) (_,sp2) -> SequencePoint.orderBySource sp1 sp2) allSps - // shorten the ranges of any that overlap with following sequence points - // sort the sequence points back into offset order - for i = 0 to Array.length allSps - 2 do - let n,sp1 = allSps.[i] - let _,sp2 = allSps.[i+1] - if (sp1.Document = sp2.Document) && - (sp1.EndLine > sp2.Line || - (sp1.EndLine = sp2.Line && - sp1.EndColumn >= sp2.Column)) then - let adjustToPrevLine = (sp1.Line < sp2.Line) - allSps.[i] <- n,{sp1 with EndLine = (if adjustToPrevLine then sp2.Line-1 else sp2.Line) - EndColumn = (if adjustToPrevLine then 80 else sp2.Column) } - Array.sortInPlaceBy fst allSps - - let spOffset = ref 0 - info.Methods |> Array.iteri (fun i minfo -> - - 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 - - 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 = (Map.empty : Map) - let add res (_,sp) = - let k = sp.Document - match Map.tryFind k res with - Some xsR -> xsR := sp :: !xsR; res - | None -> Map.add k (ref [sp]) res - - let res = Array.fold add res sps - let res = Map.toList res // ordering may not be stable - List.map (fun (_,x) -> Array.ofList !x) res - - spsets |> List.iter (fun spset -> - if spset.Length > 0 then - Array.sortInPlaceWith SequencePoint.orderByOffset spset - let sps = - spset |> Array.map (fun sp -> - // Ildiag.dprintf "token 0x%08lx has an sp at offset 0x%08x\n" minfo.MethToken sp.Offset - (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) - - // Write the scopes - let rec writePdbScope top sco = - if top || sco.Locals.Length <> 0 || sco.Children.Length <> 0 then - pdbOpenScope !pdbw sco.StartOffset - sco.Locals |> Array.iter (fun v -> pdbDefineLocalVariable !pdbw v.Name v.Signature v.Index) - sco.Children |> Array.iter (writePdbScope false) - pdbCloseScope !pdbw sco.EndOffset - writePdbScope true minfo.RootScope - - pdbCloseMethod !pdbw - end) - reportTime showTimes "PDB: Wrote methods" - let res = pdbGetDebugInfo !pdbw - - for pdbDoc in docs do - pdbCloseDocument pdbDoc - - pdbClose !pdbw f fpdb; - reportTime showTimes "PDB: Closed" - res - -//--------------------------------------------------------------------- -// Support functions for calling 'Mono.CompilerServices.SymbolWriter' -// assembly dynamically if it is available to the compiler -//--------------------------------------------------------------------- - -open System.Reflection -open Microsoft.FSharp.Reflection - -// Dynamic invoke operator. Implements simple overload resolution based -// on the name and number of parameters only. -// Supports the following cases: -// obj?Foo() // call with no arguments -// obj?Foo(1, "a") // call with two arguments (extracted from tuple) -// NOTE: This doesn’t actually handle all overloads. It just picks first entry with right -// number of arguments. -let (?) this memb (args:'Args) : 'R = - // Get array of 'obj' arguments for the reflection call - let args = - if typeof<'Args> = typeof then [| |] - elif FSharpType.IsTuple typeof<'Args> then Microsoft.FSharp.Reflection.FSharpValue.GetTupleFields(args) - else [| box args |] - - // Get methods and perform overload resolution - let methods = this.GetType().GetMethods() - let bestMatch = methods |> Array.tryFind (fun mi -> mi.Name = memb && mi.GetParameters().Length = args.Length) - match bestMatch with - | Some(mi) -> unbox(mi.Invoke(this, args)) - | None -> error(Error(FSComp.SR.ilwriteMDBMemberMissing(memb), rangeCmdArgs)) - -// Creating instances of needed classes from 'Mono.CompilerServices.SymbolWriter' assembly - -let monoCompilerSvc = new AssemblyName("Mono.CompilerServices.SymbolWriter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756") -let ctor (asmName:AssemblyName) clsName (args:obj[]) = - let asm = Assembly.Load(asmName) - let ty = asm.GetType(clsName) - System.Activator.CreateInstance(ty, args) - -let createSourceMethodImpl (name:string) (token:int) (namespaceID:int) = - ctor monoCompilerSvc "Mono.CompilerServices.SymbolWriter.SourceMethodImpl" [| box name; box token; box namespaceID |] - -let createWriter (f:string) = - ctor monoCompilerSvc "Mono.CompilerServices.SymbolWriter.MonoSymbolWriter" [| box f |] - -//--------------------------------------------------------------------- -// MDB Writer. Generate debug symbols using the MDB format -//--------------------------------------------------------------------- - -let WriteMdbInfo fmdb f info = - // Note, if we can’t delete it code will fail later - (try FileSystem.FileDelete fmdb with _ -> ()) - - // Try loading the MDB symbol writer from an assembly available on Mono dynamically - // Report an error if the assembly is not available. - let wr = - try createWriter f - with e -> error(Error(FSComp.SR.ilwriteErrorCreatingMdb(), rangeCmdArgs)) - - // NOTE: MonoSymbolWriter doesn't need information about entrypoints, so 'info.EntryPoint' is unused here. - // Write information about Documents. Returns '(SourceFileEntry*CompileUnitEntry)[]' - let docs = - [| for doc in info.Documents do - let doc = wr?DefineDocument(doc.File) - let unit = wr?DefineCompilationUnit(doc) - yield doc, unit |] - - let getDocument i = - if i < 0 || i >= Array.length docs then failwith "getDocument: bad doc number" else docs.[i] - - // Sort methods and write them to the MDB file - Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods - for meth in info.Methods do - // Creates an instance of 'SourceMethodImpl' which is a private class that implements 'IMethodDef' interface - // We need this as an argument to 'OpenMethod' below. Using private class is ugly, but since we don't reference - // the assembly, the only way to implement 'IMethodDef' interface would be dynamically using Reflection.Emit... - let sm = createSourceMethodImpl meth.MethName meth.MethToken 0 - match meth.Range with - | Some(mstart, _) -> - // NOTE: 'meth.Params' is not needed, Mono debugger apparently reads this from meta-data - let _, cue = getDocument mstart.Document - wr?OpenMethod(cue, 0, sm) |> ignore - - // Write sequence points - for sp in meth.SequencePoints do - wr?MarkSequencePoint(sp.Offset, cue?get_SourceFile(), sp.Line, sp.Column, false) - - // Walk through the tree of scopes and write all variables - let rec writeScope (scope:PdbMethodScope) = - wr?OpenScope(scope.StartOffset) |> ignore - for local in scope.Locals do - wr?DefineLocalVariable(local.Index, local.Name) - for child in scope.Children do - writeScope(child) - wr?CloseScope(scope.EndOffset) - writeScope(meth.RootScope) - - // Finished generating debug information for the curretn method - wr?CloseMethod() - | _ -> () - - // Finalize - MDB requires the MVID of the generated .NET module - let moduleGuid = new System.Guid(info.ModuleID |> Array.map byte) - wr?WriteSymbolFile(moduleGuid) - -//--------------------------------------------------------------------- -// Dumps debug info into a text file for testing purposes -//--------------------------------------------------------------------- -open Printf - -let DumpDebugInfo (outfile:string) (info:PdbData) = - use sw = new StreamWriter(outfile + ".debuginfo") - - fprintfn sw "ENTRYPOINT\r\n %b\r\n" info.EntryPoint.IsSome - fprintfn sw "DOCUMENTS" - for i, doc in Seq.zip [0 .. info.Documents.Length-1] info.Documents do - fprintfn sw " [%d] %s" i doc.File - fprintfn sw " Type: %A" doc.DocumentType - fprintfn sw " Language: %A" doc.Language - fprintfn sw " Vendor: %A" doc.Vendor - - // Sort methods (because they are sorted in PDBs/MDBs too) - fprintfn sw "\r\nMETHODS" - Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods - for meth in info.Methods do - fprintfn sw " %s" meth.MethName - fprintfn sw " Params: %A" [ for p in meth.Params -> sprintf "%d: %s" p.Index p.Name ] - fprintfn sw " Range: %A" (meth.Range |> Option.map (fun (f, t) -> - sprintf "[%d,%d:%d] - [%d,%d:%d]" f.Document f.Line f.Column t.Document t.Line t.Column)) - fprintfn sw " Points:" - - for sp in meth.SequencePoints do - fprintfn sw " - Doc: %d Offset:%d [%d:%d]-[%d-%d]" sp.Document sp.Offset sp.Line sp.Column sp.EndLine sp.EndColumn - - // Walk through the tree of scopes and write all variables - fprintfn sw " Scopes:" - let rec writeScope offs (scope:PdbMethodScope) = - fprintfn sw " %s- [%d-%d]" offs scope.StartOffset scope.EndOffset - if scope.Locals.Length > 0 then - fprintfn sw " %s Locals: %A" offs [ for p in scope.Locals -> sprintf "%d: %s" p.Index p.Name ] - for child in scope.Children do writeScope (offs + " ") child - writeScope "" meth.RootScope - fprintfn sw "" - -#endif - //--------------------------------------------------------------------- // Strong name signing //--------------------------------------------------------------------- @@ -761,10 +423,10 @@ type MemberRefRow(mrp:RowElement,nmIdx:StringIndex,blobIdx:BlobIndex) = // This environment keeps track of how many generic parameters are in scope. // This lets us translate AbsIL type variable number to IL type variable numbering type ILTypeWriterEnv = { EnclosingTyparCount: int } -let envForTypeDef (td:ILTypeDef) = { EnclosingTyparCount=td.GenericParams.Length } -let envForMethodRef env (typ:ILType) = { EnclosingTyparCount=(match typ with ILType.Array _ -> env.EnclosingTyparCount | _ -> typ.GenericArgs.Length) } -let envForNonGenericMethodRef _mref = { EnclosingTyparCount=System.Int32.MaxValue } -let envForFieldSpec (fspec:ILFieldSpec) = { EnclosingTyparCount=fspec.EnclosingType.GenericArgs.Length } +let envForTypeDef (td:ILTypeDef) = { EnclosingTyparCount=td.GenericParams.Length } +let envForMethodRef env (typ:ILType) = { EnclosingTyparCount=(match typ with ILType.Array _ -> env.EnclosingTyparCount | _ -> typ.GenericArgs.Length) } +let envForNonGenericMethodRef _mref = { EnclosingTyparCount=System.Int32.MaxValue } +let envForFieldSpec (fspec:ILFieldSpec) = { EnclosingTyparCount=fspec.EnclosingType.GenericArgs.Length } let envForOverrideSpec (ospec:ILOverridesSpec) = { EnclosingTyparCount=ospec.EnclosingType.GenericArgs.Length } //--------------------------------------------------------------------- @@ -2641,7 +2303,7 @@ let GenILMethodBody mname cenv env (il: ILMethodBody) = methbuf.EmitByte (byte codeSize <<< 2 ||| e_CorILMethod_TinyFormat) methbuf.EmitBytes code methbuf.EmitPadding codePadding - (requiredStringFixups', methbuf.Close()), seqpoints, scopes + 0x0, (requiredStringFixups', methbuf.Close()), seqpoints, scopes else // Use Fat format let flags = @@ -2715,7 +2377,7 @@ let GenILMethodBody mname cenv env (il: ILMethodBody) = let requiredStringFixups' = (12,requiredStringFixups) - (requiredStringFixups', methbuf.Close()), seqpoints, scopes + localToken, (requiredStringFixups', methbuf.Close()), seqpoints, scopes // -------------------------------------------------------------------- // ILFieldDef --> FieldDef Row @@ -2930,13 +2592,14 @@ let GenMethodDefAsRow cenv env midx (md: ILMethodDef) = (match md.mdBody.Contents with | MethodBody.IL ilmbody -> let addr = cenv.nextCodeAddr - let (code, seqpoints, rootScope) = GenILMethodBody md.Name cenv env ilmbody + let (localToken, code, seqpoints, rootScope) = GenILMethodBody md.Name cenv env ilmbody // Now record the PDB record for this method - we write this out later. if cenv.generatePdb then cenv.pdbinfo.Add { MethToken=getUncodedToken TableNames.Method midx MethName=md.Name + LocalSignatureToken=localToken Params= [| |] (* REVIEW *) RootScope = rootScope Range= @@ -3303,6 +2966,8 @@ let SortTableRows tab (rows:IGenericRow[]) = else rows +let timestamp = absilWriteGetTimeStamp () + let GenModule (cenv : cenv) (modul: ILModuleDef) = let midx = AddUnsharedRow cenv TableNames.Module (GetModuleAsRow cenv modul) List.iter (GenResourcePass3 cenv) modul.Resources.AsList @@ -3372,15 +3037,14 @@ let generateIL requiredDataFixups (desiredMetadataVersion,generatePdb, ilg : ILG if not isDll then dprintn "warning: no entrypoint specified in executable binary" 0x0 -#if FX_NO_PDB_WRITER - let pdbData = () -#else let pdbData = { EntryPoint= (if isDll then None else Some entryPointToken) + Timestamp = timestamp ModuleID = cenv.moduleGuid Documents = cenv.documents.EntriesAsArray - Methods= cenv.pdbinfo.ToArray() } -#endif + Methods = cenv.pdbinfo.ToArray() + TableRowCounts = cenv.tables |> Seq.map(fun t -> t.Count) |> Seq.toArray } + let idxForNextedTypeDef (tds:ILTypeDef list, td:ILTypeDef) = let enc = tds |> List.map (fun td -> td.Name) GetIdxForTypeDef cenv (TdKey(enc, td.Name)) @@ -3417,7 +3081,6 @@ let generateIL requiredDataFixups (desiredMetadataVersion,generatePdb, ilg : ILG //===================================================================== // TABLES+BLOBS --> PHYSICAL METADATA+BLOBS //===================================================================== - type BinaryChunk = { size: int32 addr: int32 } @@ -3454,7 +3117,7 @@ module FileSystemUtilites = ignore filename #endif () - + let writeILMetadataAndCode (generatePdb,desiredMetadataVersion,ilg,emitTailcalls,showTimes) modul noDebugData cilStartAddress = // When we know the real RVAs of the data section we fixup the references for the FieldRVA table. @@ -3678,9 +3341,9 @@ let writeILMetadataAndCode (generatePdb,desiredMetadataVersion,ilg,emitTailcalls codedBigness 2 TableNames.ModuleRef || codedBigness 2 TableNames.AssemblyRef || codedBigness 2 TableNames.TypeRef - + let tablesBuf = ByteBuffer.Create 20000 - + // Now the coded tables themselves - first the schemata header tablesBuf.EmitIntsAsBytes [| 0x00; 0x00; 0x00; 0x00; @@ -3844,8 +3507,6 @@ let writeILMetadataAndCode (generatePdb,desiredMetadataVersion,ilg,emitTailcalls entryPointToken,code, codePadding,metadata,data,resources,!requiredDataFixups,pdbData,mappings - - //--------------------------------------------------------------------- // PHYSICAL METADATA+BLOBS --> PHYSICAL PE FORMAT //--------------------------------------------------------------------- @@ -3904,7 +3565,7 @@ let writeDirectory os dict = let writeBytes (os: BinaryWriter) (chunk:byte[]) = os.Write(chunk,0,chunk.Length) -let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: ILStrongNameSigner option, +let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: ILStrongNameSigner option, portable, fixupOverlappingSequencePoints, emitTailcalls, showTimes, dumpDebugInfo) modul noDebugData = // Store the public key from the signer into the manifest. This means it will be written // to the binary and also acts as an indicator to leave space for delay sign @@ -3944,22 +3605,15 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: end; { modul with Manifest = match modul.Manifest with None -> None | Some m -> Some {m with PublicKey = pubkey} } - let timestamp = absilWriteGetTimeStamp () - let os = try new BinaryWriter(FileSystem.FileStreamCreateShim(outfile)) with e -> failwith ("Could not open file for writing (binary mode): " + outfile) - -#if FX_NO_PDB_WRITER - let pdbData,mappings = -#else let pdbData,debugDirectoryChunk,debugDataChunk,textV2P,mappings = -#endif try - + let imageBaseReal = modul.ImageBase // FIXED CHOICE let alignVirt = modul.VirtualAlignment // FIXED CHOICE let alignPhys = modul.PhysicalAlignment // FIXED CHOICE @@ -3970,7 +3624,6 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: // HEADERS - let next = 0x0 let headerSectionPhysLoc = 0x0 let headerAddr = next @@ -4315,14 +3968,14 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: writeInt32 os textSectionSize // VirtualSize: Total size of the section when loaded into memory in bytes rounded to Section Alignment. If this value is greater than Size of Raw Data, the section is zero-padded. e.g. 0x00009584 writeInt32 os textSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x00020000 writeInt32 os textSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. 0x00009600 - writeInt32 os textSectionPhysLoc // PointerToRawData RVA to section’s first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 00000200 + writeInt32 os textSectionPhysLoc // PointerToRawData RVA to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 00000200 // 00000190 writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. writeInt32 os 0x00 // PointerToLinenumbers Always 0 (see Section 23.1). // 00000198 writeInt32AsUInt16 os 0x00// NumberOfRelocations Number of relocations, set to 0 if unused. writeInt32AsUInt16 os 0x00 // NumberOfLinenumbers Always 0 (see Section 23.1). - writeBytes os [| 0x20uy; 0x00uy; 0x00uy; 0x60uy |] // Characteristics Flags describing section’s characteristics, see below. IMAGE_SCN_CNT_CODE || IMAGE_SCN_MEM_EXECUTE || IMAGE_SCN_MEM_READ + writeBytes os [| 0x20uy; 0x00uy; 0x00uy; 0x60uy |] // Characteristics Flags describing section's characteristics, see below. IMAGE_SCN_CNT_CODE || IMAGE_SCN_MEM_EXECUTE || IMAGE_SCN_MEM_READ write (Some dataSectionHeaderChunk.addr) os "data section header" [| |] @@ -4333,7 +3986,7 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: writeInt32 os dataSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x0000c000 // 000001b0 writeInt32 os dataSectionPhysSize // SizeOfRawData Size of the initialized data on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized data, this field should be 0. e.g. 0x00000200 - writeInt32 os dataSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section’s first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 0x00009800 + writeInt32 os dataSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized data, this field should be 0. e.g. 0x00009800 // 000001b8 writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. writeInt32 os 0x00 // PointerToLinenumbers Always 0 (see Section 23.1). @@ -4349,7 +4002,7 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: writeInt32 os relocSectionAddr // VirtualAddress For executable images this is the address of the first byte of the section, when loaded into memory, relative to the image base. e.g. 0x0000c000 // 000001b0 writeInt32 os relocSectionPhysSize // SizeOfRawData Size of the initialized reloc on disk in bytes, shall be a multiple of FileAlignment from the PE header. If this is less than VirtualSize the remainder of the section is zero filled. Because this field is rounded while the VirtualSize field is not it is possible for this to be greater than VirtualSize as well. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00000200 - writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section’s first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00009800 + writeInt32 os relocSectionPhysLoc // PointerToRawData QUERY: Why does ECMA say "RVA" here? Offset to section's first page within the PE file. This shall be a multiple of FileAlignment from the optional header. When a section contains only uninitialized reloc, this field should be 0. e.g. 0x00009800 // 000001b8 writeInt32 os 0x00 // PointerToRelocations RVA of Relocation section. writeInt32 os 0x00 // PointerToLinenumbers Always 0 (see Section 23.1). @@ -4513,12 +4166,8 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: FileSystemUtilites.setExecutablePermission outfile with _ -> () -#if FX_NO_PDB_WRITER - pdbData,mappings -#else pdbData,debugDirectoryChunk,debugDataChunk,textV2P,mappings -#endif - + // Looks like a finally with e -> (try @@ -4528,14 +4177,8 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: reraise() reportTime showTimes "Writing Image" - -#if FX_NO_PDB_WRITER - ignore fixupOverlappingSequencePoints - ignore dumpDebugInfo - ignore pdbData -#else - if dumpDebugInfo then - DumpDebugInfo outfile pdbData + + if dumpDebugInfo then DumpDebugInfo outfile pdbData // Now we've done the bulk of the binary, do the PDB file and fixup the binary. begin match pdbfile with @@ -4546,34 +4189,36 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: #endif | Some fpdb -> try - let idd = WritePdbInfo fixupOverlappingSequencePoints showTimes outfile fpdb pdbData + let idd = +#if FX_NO_PDB_WRITER + ignore portable + WritePortablePdbInfo fixupOverlappingSequencePoints showTimes fpdb pdbData +#else + if portable then + WritePortablePdbInfo fixupOverlappingSequencePoints showTimes fpdb pdbData + else + WritePdbInfo fixupOverlappingSequencePoints showTimes outfile fpdb pdbData +#endif reportTime showTimes "Generate PDB Info" - - // Now we have the debug data we can go back and fill in the debug directory in the image + + // Now we have the debug data we can go back and fill in the debug directory in the image let fs2 = FileSystem.FileStreamWriteExistingShim(outfile) let os2 = new BinaryWriter(fs2) try // write the IMAGE_DEBUG_DIRECTORY os2.BaseStream.Seek (int64 (textV2P debugDirectoryChunk.addr), SeekOrigin.Begin) |> ignore - writeInt32 os2 idd.iddCharacteristics // IMAGE_DEBUG_DIRECTORY.Characteristics + writeInt32 os2 idd.iddCharacteristics // IMAGE_DEBUG_DIRECTORY.Characteristics writeInt32 os2 timestamp writeInt32AsUInt16 os2 idd.iddMajorVersion writeInt32AsUInt16 os2 idd.iddMinorVersion writeInt32 os2 idd.iddType - writeInt32 os2 idd.iddData.Length // IMAGE_DEBUG_DIRECTORY.SizeOfData - writeInt32 os2 debugDataChunk.addr // IMAGE_DEBUG_DIRECTORY.AddressOfRawData - writeInt32 os2 (textV2P debugDataChunk.addr)// IMAGE_DEBUG_DIRECTORY.PointerToRawData - - (* dprintf "idd.iddCharacteristics = %ld\n" idd.iddCharacteristics - dprintf "iddMajorVersion = %ld\n" idd.iddMajorVersion - dprintf "iddMinorVersion = %ld\n" idd.iddMinorVersion - dprintf "iddType = %ld\n" idd.iddType - dprintf "iddData = (%A) = %s\n" idd.iddData (System.Text.Encoding.UTF8.GetString idd.iddData) *) - + writeInt32 os2 idd.iddData.Length // IMAGE_DEBUG_DIRECTORY.SizeOfData + writeInt32 os2 debugDataChunk.addr // IMAGE_DEBUG_DIRECTORY.AddressOfRawData + writeInt32 os2 (textV2P debugDataChunk.addr) // IMAGE_DEBUG_DIRECTORY.PointerToRawData + // write the debug raw data as given us by the PDB writer os2.BaseStream.Seek (int64 (textV2P debugDataChunk.addr), SeekOrigin.Begin) |> ignore - if debugDataChunk.size < idd.iddData.Length then - failwith "Debug data area is not big enough. Debug info may not be usable" + if debugDataChunk.size < idd.iddData.Length then failwith "Debug data area is not big enough. Debug info may not be usable" writeBytes os2 idd.iddData os2.Dispose() with e -> @@ -4582,10 +4227,9 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: reraise() with e -> reraise() - + end reportTime showTimes "Finalize PDB" -#endif /// Sign the binary. No further changes to binary allowed past this point! match signer with @@ -4608,6 +4252,7 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: type options = { ilg: ILGlobals; pdbfile: string option + portable: bool signer: ILStrongNameSigner option fixupOverlappingSequencePoints: bool emitTailcalls : bool @@ -4616,7 +4261,7 @@ type options = let WriteILBinary (outfile, (args: options), modul, noDebugData) = - ignore (writeBinaryAndReportMappings (outfile, args.ilg, args.pdbfile, args.signer, + ignore (writeBinaryAndReportMappings (outfile, args.ilg, args.pdbfile, args.signer, args.portable, args.fixupOverlappingSequencePoints, args.emitTailcalls, args.showTimes, args.dumpDebugInfo) modul noDebugData) @@ -4624,37 +4269,37 @@ let WriteILBinary (outfile, (args: options), modul, noDebugData) = (****************************************************** ** Notes on supporting the Itanium ** ******************************************************* -IA64 codegen on the CLR isn’t documented, and getting it working involved a certain amount of reverse-engineering +IA64 codegen on the CLR isn't documented, and getting it working involved a certain amount of reverse-engineering peverify.exe and various binaries generated by ILAsm and other managed compiles. Here are some lessons learned, documented for posterity and the 0 other people writing managed compilers for the Itanium: -- Even if you’re not utilizing the global pointer in your Itanium binary, +- Even if you're not utilizing the global pointer in your Itanium binary, you should be setting aside space for it in .text. (Preferably near the native stub.) - PEVerify checks for two .reloc table entries on the Itanium - one for the native stub, and one -for the global pointer RVA. It doesn’t matter what you set these values to - +for the global pointer RVA. It doesn't matter what you set these values to - their addresses can be zeroed out, but they must have IMAGE_REL_BASED_DIR64 set! (So, yes, you may find yourself setting this flag on an empty, unnecessary table slot!) -- On the Itanium, it’s best to have your tables qword aligned. (Though, peverify checks for dword alignment.) +- On the Itanium, it's best to have your tables qword aligned. (Though, peverify checks for dword alignment.) - A different, weird set of DLL characteristics are necessary for the Itanium. -I won’t detail them here, but it’s interesting given that this field isn’t supposed to vary between platforms, +I won't detail them here, but it's interesting given that this field isn't supposed to vary between platforms, and is supposedly marked as deprecated. -- There are two schools to generating CLR binaries on for the Itanium - I’ll call them the “ALink” school -and the “ILAsm” school. - - The ALink school relies on some quirks in the CLR to omit a lot of stuff that, admittedly, isn’t necessary. The binaries are basically IL-only, with some flags set to make them nominally Itanium: +- There are two schools to generating CLR binaries on for the Itanium - I'll call them the 'ALink' school +and the 'ILAsm' school. + - The ALink school relies on some quirks in the CLR to omit a lot of stuff that, admittedly, is't necessary. The binaries are basically IL-only, with some flags set to make them nominally Itanium: - It omits the .reloc table - - It doesn’t set aside memory for global pointer storage - - There’s no native stub - - There’s no import table, mscoree reference / startup symbol hint + - It doesn't set aside memory for global pointer storage + - There's no native stub + - There's no import table, mscoree reference / startup symbol hint - A manifest is inserted by default. These omissions are understandable, given the platform/jitting/capabilities of the language, - but they’re basically relying on an idiosyncracy of the runtime to get away with creating a “bad” binary. + but they're basically relying on an idiosyncracy of the runtime to get away with creating a 'bad' binary. - The ILAsm school actually writes everything out: - It has a reloc table with the requisite two entries - - It sets aside memory for a global pointer, even if it doesn’t utilize one + - It sets aside memory for a global pointer, even if it doesn't utilize one - It actually inserts a native stub for the Itanium! (Though, I have no idea what - instructions, specifically, are emitted, and I couldn’t dig up the sources to ILAsm to + instructions, specifically, are emitted, and I couldn't dig up the sources to ILAsm to find out) - - There’s the requisite mscoree reference, etc. + - There's the requisite mscoree reference, etc. - No manifest is inserted *******************************************************) diff --git a/src/absil/ilwrite.fsi b/src/absil/ilwrite.fsi index 475aafbdb0a..10606ae5ac0 100644 --- a/src/absil/ilwrite.fsi +++ b/src/absil/ilwrite.fsi @@ -18,6 +18,7 @@ type ILStrongNameSigner = type options = { ilg: ILGlobals pdbfile: string option + portable: bool signer : ILStrongNameSigner option fixupOverlappingSequencePoints : bool emitTailcalls: bool @@ -26,6 +27,3 @@ type options = /// Write a binary to the file system. Extra configuration parameters can also be specified. val WriteILBinary: filename: string * options: options * input: ILModuleDef * noDebugData: bool -> unit - - - diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs new file mode 100644 index 00000000000..baad0d64010 --- /dev/null +++ b/src/absil/ilwritepdb.fs @@ -0,0 +1,635 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +module internal Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter + +open Internal.Utilities +open Microsoft.FSharp.Compiler.AbstractIL +open Microsoft.FSharp.Compiler.AbstractIL.ILAsciiWriter +open Microsoft.FSharp.Compiler.AbstractIL.IL +open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics +open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types +open Microsoft.FSharp.Compiler.AbstractIL.Internal +open Microsoft.FSharp.Compiler.AbstractIL.Internal.BinaryConstants +open Microsoft.FSharp.Compiler.AbstractIL.Internal.Support +open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library + +#if FX_NO_CORHOST_SIGNER +open Microsoft.FSharp.Compiler.AbstractIL.Internal.StrongNameSign +#endif + +open Microsoft.FSharp.Compiler.DiagnosticMessage +open Microsoft.FSharp.Compiler.ErrorLogger +open Microsoft.FSharp.Compiler.Range + +open System.Collections.Generic +open System.IO + +// -------------------------------------------------------------------- +// PDB types +// -------------------------------------------------------------------- +type PdbDocumentData = ILSourceDocument + +type PdbLocalVar = + { Name: string + Signature: byte[] + /// the local index the name corresponds to + Index: int32 } + +type PdbMethodScope = + { Children: PdbMethodScope array + StartOffset: int + EndOffset: int + Locals: PdbLocalVar array + (* REVIEW open_namespaces: pdb_namespace array *) } + +type PdbSourceLoc = + { Document: int + Line: int + Column: int } + +type PdbSequencePoint = + { Document: int + Offset: int + Line: int + Column: int + EndLine: int + EndColumn: int } + override x.ToString() = sprintf "(%d,%d)-(%d,%d)" x.Line x.Column x.EndLine x.EndColumn + +type PdbMethodData = + { MethToken: int32 + MethName:string + LocalSignatureToken: int32 + Params: PdbLocalVar array + RootScope: PdbMethodScope + Range: (PdbSourceLoc * PdbSourceLoc) option + SequencePoints: PdbSequencePoint array } + +module SequencePoint = + let orderBySource sp1 sp2 = + let c1 = compare sp1.Document sp2.Document + if c1 <> 0 then c1 else + let c1 = compare sp1.Line sp2.Line + if c1 <> 0 then c1 else + compare sp1.Column sp2.Column + + let orderByOffset sp1 sp2 = + compare sp1.Offset sp2.Offset + +/// 28 is the size of the IMAGE_DEBUG_DIRECTORY in ntimage.h +let sizeof_IMAGE_DEBUG_DIRECTORY = 28 + +[] +type PdbData = + { EntryPoint: int32 option + Timestamp: int32 + ModuleID: byte[] + Documents: PdbDocumentData[] + Methods: PdbMethodData[] + TableRowCounts: int[] } + +//--------------------------------------------------------------------- +// Portable PDB Writer +//--------------------------------------------------------------------- +open System +open System.Reflection +open System.Reflection.Metadata +open System.Reflection.Metadata.Ecma335 +open System.Reflection.Metadata.Ecma335.Blobs +open System.Reflection.PortableExecutable +open System.Collections.Generic +open System.Collections.Immutable + +type idd = + { iddCharacteristics: int32; + iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *) + iddMinorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *) + iddType: int32; + iddData: byte[];} + +let magicNumber = 0x53445352L +let pdbGetDebugInfo (mvid:byte[]) (filepath:string) = + let iddDataBuffer = + let path = (System.Text.Encoding.UTF8.GetBytes filepath) + let buffer = Array.zeroCreate (sizeof + mvid.Length + sizeof + path.Length + 1) + + let offset, size = 0, sizeof // Magic Number RSDS dword: 0x53445352L + Buffer.BlockCopy(BitConverter.GetBytes(magicNumber), 0, buffer, offset, size) + + let offset, size = offset + size, mvid.Length // mvid Guid + Buffer.BlockCopy(mvid, 0, buffer, offset, size) + + let offset, size = offset + size, sizeof // # of pdb files generated (1) + Buffer.BlockCopy(BitConverter.GetBytes(1), 0, buffer, offset, size) + + let offset = offset + size // Path to pdb string + Buffer.BlockCopy(path, 0, buffer, offset, path.Length) + buffer + + { iddCharacteristics = 0x0; // Reserved + iddMajorVersion = 0x0; // VersionMajor should be 0 + iddMinorVersion = 0x0; // VersionMinor should be 0 + iddType = 0x2; // IMAGE_DEBUG_TYPE_CODEVIEW + iddData = iddDataBuffer } // Path name to the pdb file when built + +// Document checksum algorithms +let guidSourceHashMD5 = System.Guid(0x406ea660u, 0x64cfus, 0x4c82us, 0xb6uy, 0xf0uy, 0x42uy, 0xd4uy, 0x81uy, 0x72uy, 0xa7uy, 0x99uy) //406ea660-64cf-4c82-b6f0-42d48172a799 +let hashSizeOfMD5 = 16 + +// If the FIPS algorithm policy is enabled on the computer (e.g., for US government employees and contractors) +// then obtaining the MD5 implementation in BCL will throw. +// In this case, catch the failure, and not set a checksum. +let checkSum (url:string) = + try + use file = FileSystem.FileStreamReadShim(url) + use md5 = System.Security.Cryptography.MD5.Create() + let checkSum = md5.ComputeHash(file) + Some (guidSourceHashMD5, checkSum) + with _ -> None + +//------------------------------------------------------------------------------ +// PDB Writer. The function [WritePdbInfo] abstracts the +// imperative calls to the Symbol Writer API. +//------------------------------------------------------------------------------ + +let sortMethods showTimes info = + reportTime showTimes (sprintf "PDB: Defined %d documents" info.Documents.Length) + Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods + reportTime showTimes (sprintf "PDB: Sorted %d methods" info.Methods.Length) + () + +let GetRowCounts tableRowCounts = + let builder = ImmutableArray.CreateBuilder(tableRowCounts |> Array.length) + tableRowCounts |> Seq.iter(fun x -> builder.Add(x)) + builder.MoveToImmutable() + +let fixupOverlappingSequencePoints fixupSPs showTimes methods = + // This next bit is a workaround. The sequence points we get + // from F# (which has nothing to do with this module) are actually expression + // marks, i.e. the source ranges they denote are typically + // nested, and each point indicates where the + // code for an expression with a particular range begins. + // This is in many ways a much more convenient form to emit. + // However, it is not the form that debug tools accept nicely. + // However, sequence points are really a non-overlapping, non-nested + // partition of the source code of a method. So here we shorten the + // length of all sequence point marks so they do not go further than + // the next sequence point in the source. + let spCounts = methods |> Array.map (fun x -> x.SequencePoints.Length) + let allSps = Array.concat (Array.map (fun x -> x.SequencePoints) methods |> Array.toList) + let allSps = Array.mapi (fun i sp -> (i,sp)) allSps + if fixupSPs then + // sort the sequence points into source order + Array.sortInPlaceWith (fun (_,sp1) (_,sp2) -> SequencePoint.orderBySource sp1 sp2) allSps + // shorten the ranges of any that overlap with following sequence points + // sort the sequence points back into offset order + for i = 0 to Array.length allSps - 2 do + let n,sp1 = allSps.[i] + let _,sp2 = allSps.[i+1] + if (sp1.Document = sp2.Document) && + (sp1.EndLine > sp2.Line || + (sp1.EndLine = sp2.Line && + sp1.EndColumn >= sp2.Column)) then + let adjustToPrevLine = (sp1.Line < sp2.Line) + allSps.[i] <- n,{sp1 with EndLine = (if adjustToPrevLine then sp2.Line-1 else sp2.Line) + EndColumn = (if adjustToPrevLine then 80 else sp2.Column) } + reportTime showTimes (sprintf "PDB: fixupOverlappingSequencePoints %d" (allSps |> Array.length) ) + Array.sortInPlaceBy fst allSps + spCounts, allSps + +let WritePortablePdbInfo fixupSPs showTimes fpdb (info:PdbData) = + + try FileSystem.FileDelete fpdb with _ -> () + sortMethods showTimes info + let _spCounts, _allSps = fixupOverlappingSequencePoints fixupSPs showTimes info.Methods + let externalRowCounts = GetRowCounts info.TableRowCounts + let docs = + if info.Documents = null then + Array.empty + else + info.Documents + + let metadata = MetadataBuilder() + let serializeDocumentName (name:string) = + let count s c = s |> Seq.filter(fun ch -> if c = ch then true else false) |> Seq.length + + let s1, s2 = '/', '\\' + let separator = if (count name s1) >= (count name s2) then s1 else s2 + + let writer = new BlobBuilder() + writer.WriteByte(byte(separator)) + + for part in name.Split( [| separator |] ) do + let partIndex = MetadataTokens.GetHeapOffset(BlobHandle.op_Implicit(metadata.GetBlobUtf8(part))) + writer.WriteCompressedInteger(int(partIndex)) + + metadata.GetBlob(writer); + + let corSymLanguageTypeFSharp = System.Guid(0xAB4F38C9u, 0xB6E6us, 0x43baus, 0xBEuy, 0x3Buy, 0x58uy, 0x08uy, 0x0Buy, 0x2Cuy, 0xCCuy, 0xE3uy) + let documentIndex = + let mutable index = new Dictionary() + metadata.SetCapacity(TableIndex.Document, docs.Length) + for doc in docs do + let handle = + match checkSum doc.File with + | Some (hashAlg, checkSum) -> + metadata.AddDocument(serializeDocumentName doc.File, + metadata.GetGuid(hashAlg), + metadata.GetBlob(checkSum.ToImmutableArray()), + metadata.GetGuid(corSymLanguageTypeFSharp)) + | None -> + metadata.AddDocument(serializeDocumentName doc.File, + metadata.GetGuid(System.Guid.Empty), + metadata.GetBlob(ImmutableArray.Empty), + metadata.GetGuid(corSymLanguageTypeFSharp)) + index.Add(doc.File, handle) + index + + metadata.SetCapacity(TableIndex.MethodDebugInformation, info.Methods.Length) + info.Methods |> Array.iteri (fun _i minfo -> + let docHandle, sequencePointBlob = + let sps = + if minfo.SequencePoints = null then + Array.empty + else + match minfo.Range with + | None -> Array.empty + | Some (_,_) -> minfo.SequencePoints + + let getDocumentName i = + if i < 0 || i > docs.Length then + failwith "getDocument: bad doc number" + else + docs.[i].File + + let getDocumentHandle d = + if docs.Length = 0 || d < 0 || d > docs.Length then + Unchecked.defaultof + else + match documentIndex.TryGetValue(getDocumentName d) with + | false, _ -> Unchecked.defaultof + | true, f -> f + + let tryGetSingleDocumentIndex = + let mutable singleDocumentIndex = 0 + for i in 1 .. sps.Length - 1 do + let index = sps.[i].Document + if index <> singleDocumentIndex then + singleDocumentIndex <- index + singleDocumentIndex + + if sps.Length = 0 then + Unchecked.defaultof, Unchecked.defaultof + else + let builder = new BlobBuilder() + builder.WriteCompressedInteger(minfo.LocalSignatureToken) + + let mutable previousNonHiddenStartLine = -1 + let mutable previousNonHiddenStartColumn = -1 + + let mutable previousDocumentIndex = -1 + let mutable singleDocumentIndex = tryGetSingleDocumentIndex + let mutable currentDocumentIndex = previousDocumentIndex + + for i in 0 .. (sps.Length - 1) do + + if previousDocumentIndex <> currentDocumentIndex then + // optional document in header or document record: + if previousDocumentIndex <> -1 then + // optional document in header or document record + builder.WriteCompressedInteger(0) + builder.WriteCompressedInteger(currentDocumentIndex) + previousDocumentIndex <- currentDocumentIndex + + // delta IL offset: + if i > 0 then + builder.WriteCompressedInteger(sps.[i].Offset - sps.[i - 1].Offset) + else + builder.WriteCompressedInteger(sps.[i].Offset) + + // F# does not support hidden sequence points yet !!! + // if (sequencePoints[i].IsHidden) + // { + // builder.WriteInt16(0); + // continue; + // } + + let deltaLines = sps.[i].EndLine - sps.[i].Line; + let deltaColumns = sps.[i].EndColumn - sps.[i].Column; + builder.WriteCompressedInteger(deltaLines); + + if deltaLines = 0 then + builder.WriteCompressedInteger(deltaColumns) + else + builder.WriteCompressedSignedInteger(deltaColumns) + + // delta Start Lines & Columns: + if previousNonHiddenStartLine < 0 then + builder.WriteCompressedInteger(sps.[i].Line) + builder.WriteCompressedInteger(sps.[i].Column) + else + builder.WriteCompressedSignedInteger(sps.[i].Line - previousNonHiddenStartLine) + builder.WriteCompressedSignedInteger(sps.[i].Column - previousNonHiddenStartColumn) + + previousNonHiddenStartLine <- sps.[i].Line + previousNonHiddenStartColumn <- sps.[i].Column + + getDocumentHandle singleDocumentIndex, metadata.GetBlob(builder) + + // Write the scopes + let mutable lastLocalVariableHandle = Unchecked.defaultof + let nextHandle handle = MetadataTokens.LocalVariableHandle(MetadataTokens.GetRowNumber(LocalVariableHandle.op_Implicit(handle)) + 1) + let rec writePdbScope top scope = + if top || scope.Locals.Length <> 0 || scope.Children.Length <> 0 then + lastLocalVariableHandle <- nextHandle lastLocalVariableHandle + metadata.AddLocalScope(MetadataTokens.MethodDefinitionHandle(minfo.MethToken), + Unchecked.defaultof, + lastLocalVariableHandle, + Unchecked.defaultof, + scope.StartOffset, + scope.EndOffset - scope.StartOffset) |>ignore + for localVariable in scope.Locals do + lastLocalVariableHandle <- metadata.AddLocalVariable(LocalVariableAttributes.None, localVariable.Index, metadata.GetString(localVariable.Name)) + scope.Children |> Array.iter (writePdbScope false) + + writePdbScope true minfo.RootScope + metadata.AddMethodDebugInformation(docHandle, sequencePointBlob) |> ignore) + + let entryPoint = + match info.EntryPoint with + | None -> MetadataTokens.MethodDefinitionHandle(0) + | Some x -> MetadataTokens.MethodDefinitionHandle(x) + + let pdbContentId = ContentId(info.ModuleID, BitConverter.GetBytes(info.Timestamp)) + let serializer = StandaloneDebugMetadataSerializer(metadata, externalRowCounts, entryPoint, false) + let blobBuilder = new BlobBuilder() + let _metadataContentId = serializer.SerializeMetadata(blobBuilder, (fun builder -> pdbContentId)) + + reportTime showTimes "PDB: Created" + use portablePdbStream = new FileStream(fpdb, FileMode.Create, FileAccess.ReadWrite) + blobBuilder.WriteContentTo(portablePdbStream) + reportTime showTimes "PDB: Closed" + pdbGetDebugInfo info.ModuleID fpdb + +#if FX_NO_PDB_WRITER +#else +//--------------------------------------------------------------------- +// PDB Writer. The function [WritePdbInfo] abstracts the +// imperative calls to the Symbol Writer API. +//--------------------------------------------------------------------- +let WritePdbInfo fixupOverlappingSequencePoints showTimes f fpdb info = + try FileSystem.FileDelete fpdb with _ -> () + let pdbw = ref Unchecked.defaultof + + try + pdbw := pdbInitialize f fpdb + with _ -> error(Error(FSComp.SR.ilwriteErrorCreatingPdb(fpdb), rangeCmdArgs)) + + match info.EntryPoint with + | None -> () + | Some x -> pdbSetUserEntryPoint !pdbw x + + 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] + reportTime showTimes (sprintf "PDB: Defined %d documents" info.Documents.Length) + Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods + reportTime showTimes (sprintf "PDB: Sorted %d methods" info.Methods.Length) + + // This next bit is a workaround. The sequence points we get + // from F# (which has nothing to do with this module) are actually expression + // marks, i.e. the source ranges they denote are typically + // nested, and each point indicates where the + // code for an expression with a particular range begins. + // This is in many ways a much more convenient form to emit. + // However, it is not the form that debug tools accept nicely. + // However, sequence points are really a non-overlapping, non-nested + // partition of the source code of a method. So here we shorten the + // length of all sequence point marks so they do not go further than + // the next sequence point in the source. + let spCounts = info.Methods |> Array.map (fun x -> x.SequencePoints.Length) + let allSps = Array.concat (Array.map (fun x -> x.SequencePoints) info.Methods |> Array.toList) + let allSps = Array.mapi (fun i sp -> (i,sp)) allSps + if fixupOverlappingSequencePoints then + // sort the sequence points into source order + Array.sortInPlaceWith (fun (_,sp1) (_,sp2) -> SequencePoint.orderBySource sp1 sp2) allSps + // shorten the ranges of any that overlap with following sequence points + // sort the sequence points back into offset order + for i = 0 to Array.length allSps - 2 do + let n,sp1 = allSps.[i] + let _,sp2 = allSps.[i+1] + if (sp1.Document = sp2.Document) && + (sp1.EndLine > sp2.Line || + (sp1.EndLine = sp2.Line && + sp1.EndColumn >= sp2.Column)) then + let adjustToPrevLine = (sp1.Line < sp2.Line) + allSps.[i] <- n,{sp1 with EndLine = (if adjustToPrevLine then sp2.Line-1 else sp2.Line) + EndColumn = (if adjustToPrevLine then 80 else sp2.Column) } + Array.sortInPlaceBy fst allSps + + let spOffset = ref 0 + info.Methods |> Array.iteri (fun i minfo -> + + 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 + + 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 = (Map.empty : Map) + let add res (_,sp) = + let k = sp.Document + match Map.tryFind k res with + | Some xsR -> xsR := sp :: !xsR; res + | None -> Map.add k (ref [sp]) res + + let res = Array.fold add res sps + let res = Map.toList res // ordering may not be stable + List.map (fun (_,x) -> Array.ofList !x) res + + spsets |> List.iter (fun spset -> + if spset.Length > 0 then + Array.sortInPlaceWith SequencePoint.orderByOffset spset + let sps = + spset |> Array.map (fun sp -> + // Ildiag.dprintf "token 0x%08lx has an sp at offset 0x%08x\n" minfo.MethToken sp.Offset + (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) + + // Write the scopes + let rec writePdbScope top sco = + if top || sco.Locals.Length <> 0 || sco.Children.Length <> 0 then + pdbOpenScope !pdbw sco.StartOffset + sco.Locals |> Array.iter (fun v -> pdbDefineLocalVariable !pdbw v.Name v.Signature v.Index) + sco.Children |> Array.iter (writePdbScope false) + pdbCloseScope !pdbw sco.EndOffset + writePdbScope true minfo.RootScope + + pdbCloseMethod !pdbw + end) + reportTime showTimes "PDB: Wrote methods" + + let res = pdbWriteDebugInfo !pdbw + for pdbDoc in docs do pdbCloseDocument pdbDoc + pdbClose !pdbw f fpdb; + + reportTime showTimes "PDB: Closed" + { iddCharacteristics = res.iddCharacteristics; + iddMajorVersion = res.iddMajorVersion; + iddMinorVersion = res.iddMinorVersion; + iddType = res.iddType; + iddData = res.iddData} +#endif + +#if ENABLE_MONO_SUPPORT +//--------------------------------------------------------------------- +// Support functions for calling 'Mono.CompilerServices.SymbolWriter' +// assembly dynamically if it is available to the compiler +//--------------------------------------------------------------------- + +open System.Reflection +open Microsoft.FSharp.Reflection + +// Dynamic invoke operator. Implements simple overload resolution based +// on the name and number of parameters only. +// Supports the following cases: +// obj?Foo() // call with no arguments +// obj?Foo(1, "a") // call with two arguments (extracted from tuple) +// NOTE: This doesn�t actually handle all overloads. It just picks first entry with right +// number of arguments. +let (?) this memb (args:'Args) : 'R = + // Get array of 'obj' arguments for the reflection call + let args = + if typeof<'Args> = typeof then [| |] + elif FSharpType.IsTuple typeof<'Args> then Microsoft.FSharp.Reflection.FSharpValue.GetTupleFields(args) + else [| box args |] + + // Get methods and perform overload resolution + let methods = this.GetType().GetMethods() + let bestMatch = methods |> Array.tryFind (fun mi -> mi.Name = memb && mi.GetParameters().Length = args.Length) + match bestMatch with + | Some(mi) -> unbox(mi.Invoke(this, args)) + | None -> error(Error(FSComp.SR.ilwriteMDBMemberMissing(memb), rangeCmdArgs)) + +// Creating instances of needed classes from 'Mono.CompilerServices.SymbolWriter' assembly + +let monoCompilerSvc = new AssemblyName("Mono.CompilerServices.SymbolWriter, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756") +let ctor (asmName:AssemblyName) clsName (args:obj[]) = + let asm = Assembly.Load(asmName) + let ty = asm.GetType(clsName) + System.Activator.CreateInstance(ty, args) + +let createSourceMethodImpl (name:string) (token:int) (namespaceID:int) = + ctor monoCompilerSvc "Mono.CompilerServices.SymbolWriter.SourceMethodImpl" [| box name; box token; box namespaceID |] + +let createWriter (f:string) = + ctor monoCompilerSvc "Mono.CompilerServices.SymbolWriter.MonoSymbolWriter" [| box f |] + +//--------------------------------------------------------------------- +// MDB Writer. Generate debug symbols using the MDB format +//--------------------------------------------------------------------- +let WriteMdbInfo fmdb f info = + // Note, if we can�t delete it code will fail later + try FileSystem.FileDelete fmdb with _ -> () + + // Try loading the MDB symbol writer from an assembly available on Mono dynamically + // Report an error if the assembly is not available. + let wr = + try createWriter f + with e -> error(Error(FSComp.SR.ilwriteErrorCreatingMdb(), rangeCmdArgs)) + + // NOTE: MonoSymbolWriter doesn't need information about entrypoints, so 'info.EntryPoint' is unused here. + // Write information about Documents. Returns '(SourceFileEntry*CompileUnitEntry)[]' + let docs = + [| for doc in info.Documents do + let doc = wr?DefineDocument(doc.File) + let unit = wr?DefineCompilationUnit(doc) + yield doc, unit |] + + let getDocument i = + if i < 0 || i >= Array.length docs then failwith "getDocument: bad doc number" else docs.[i] + + // Sort methods and write them to the MDB file + Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods + for meth in info.Methods do + // Creates an instance of 'SourceMethodImpl' which is a private class that implements 'IMethodDef' interface + // We need this as an argument to 'OpenMethod' below. Using private class is ugly, but since we don't reference + // the assembly, the only way to implement 'IMethodDef' interface would be dynamically using Reflection.Emit... + let sm = createSourceMethodImpl meth.MethName meth.MethToken 0 + match meth.Range with + | Some(mstart, _) -> + // NOTE: 'meth.Params' is not needed, Mono debugger apparently reads this from meta-data + let _, cue = getDocument mstart.Document + wr?OpenMethod(cue, 0, sm) |> ignore + + // Write sequence points + for sp in meth.SequencePoints do + wr?MarkSequencePoint(sp.Offset, cue?get_SourceFile(), sp.Line, sp.Column, false) + + // Walk through the tree of scopes and write all variables + let rec writeScope (scope:PdbMethodScope) = + wr?OpenScope(scope.StartOffset) |> ignore + for local in scope.Locals do + wr?DefineLocalVariable(local.Index, local.Name) + for child in scope.Children do + writeScope(child) + wr?CloseScope(scope.EndOffset) + writeScope(meth.RootScope) + + // Finished generating debug information for the curretn method + wr?CloseMethod() + | _ -> () + + // Finalize - MDB requires the MVID of the generated .NET module + let moduleGuid = new System.Guid(info.ModuleID |> Array.map byte) + wr?WriteSymbolFile(moduleGuid) +#endif + +//--------------------------------------------------------------------- +// Dumps debug info into a text file for testing purposes +//--------------------------------------------------------------------- +open Printf + +let DumpDebugInfo (outfile:string) (info:PdbData) = + use sw = new StreamWriter(new FileStream(outfile + ".debuginfo", FileMode.Create)) + + fprintfn sw "ENTRYPOINT\r\n %b\r\n" info.EntryPoint.IsSome + fprintfn sw "DOCUMENTS" + for i, doc in Seq.zip [0 .. info.Documents.Length-1] info.Documents do + fprintfn sw " [%d] %s" i doc.File + fprintfn sw " Type: %A" doc.DocumentType + fprintfn sw " Language: %A" doc.Language + fprintfn sw " Vendor: %A" doc.Vendor + + // Sort methods (because they are sorted in PDBs/MDBs too) + fprintfn sw "\r\nMETHODS" + Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods + for meth in info.Methods do + fprintfn sw " %s" meth.MethName + fprintfn sw " Params: %A" [ for p in meth.Params -> sprintf "%d: %s" p.Index p.Name ] + fprintfn sw " Range: %A" (meth.Range |> Option.map (fun (f, t) -> + sprintf "[%d,%d:%d] - [%d,%d:%d]" f.Document f.Line f.Column t.Document t.Line t.Column)) + fprintfn sw " Points:" + + for sp in meth.SequencePoints do + fprintfn sw " - Doc: %d Offset:%d [%d:%d]-[%d-%d]" sp.Document sp.Offset sp.Line sp.Column sp.EndLine sp.EndColumn + + // Walk through the tree of scopes and write all variables + fprintfn sw " Scopes:" + let rec writeScope offs (scope:PdbMethodScope) = + fprintfn sw " %s- [%d-%d]" offs scope.StartOffset scope.EndOffset + if scope.Locals.Length > 0 then + fprintfn sw " %s Locals: %A" offs [ for p in scope.Locals -> sprintf "%d: %s" p.Index p.Name ] + for child in scope.Children do writeScope (offs + " ") child + writeScope "" meth.RootScope + fprintfn sw "" diff --git a/src/absil/ilwritepdb.fsi b/src/absil/ilwritepdb.fsi new file mode 100644 index 00000000000..f8487f68a7d --- /dev/null +++ b/src/absil/ilwritepdb.fsi @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +/// The ILPdbWriter +module internal Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter + +open Internal.Utilities +open Microsoft.FSharp.Compiler.AbstractIL +open Microsoft.FSharp.Compiler.AbstractIL.ILAsciiWriter +open Microsoft.FSharp.Compiler.AbstractIL.IL +open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics +open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types +open Microsoft.FSharp.Compiler.AbstractIL.Internal +open Microsoft.FSharp.Compiler.AbstractIL.Internal.BinaryConstants +open Microsoft.FSharp.Compiler.AbstractIL.Internal.Support + +open Microsoft.FSharp.Compiler.DiagnosticMessage +open Microsoft.FSharp.Compiler.ErrorLogger +open Microsoft.FSharp.Compiler.Range + +open System.Collections.Generic +open System.IO + +type PdbDocumentData = ILSourceDocument + +type PdbLocalVar = + { Name: string + Signature: byte[] + /// the local index the name corresponds to + Index: int32 } + +type PdbMethodScope = + { Children: PdbMethodScope array + StartOffset: int + EndOffset: int + Locals: PdbLocalVar array + (* REVIEW open_namespaces: pdb_namespace array *) } + +type PdbSourceLoc = + { Document: int + Line: int + Column: int } + +type PdbSequencePoint = + { Document: int + Offset: int + Line: int + Column: int + EndLine: int + EndColumn: int } + override ToString: unit -> string + +type PdbMethodData = + { MethToken: int32 + MethName:string + LocalSignatureToken: int32 + Params: PdbLocalVar array + RootScope: PdbMethodScope + Range: (PdbSourceLoc * PdbSourceLoc) option + SequencePoints: PdbSequencePoint array } + +[] +type PdbData = + { EntryPoint: int32 option + Timestamp: int32 + ModuleID: byte[] // MVID of the generated .NET module (used by MDB files to identify debug info) + Documents: PdbDocumentData[] + Methods: PdbMethodData[] + TableRowCounts: int[] } + +/// 28 is the size of the IMAGE_DEBUG_DIRECTORY in ntimage.h +val sizeof_IMAGE_DEBUG_DIRECTORY : System.Int32 +val DumpDebugInfo : string -> PdbData -> unit + +#if ENABLE_MONO_SUPPORT +val WriteMdbInfo<'a> : string -> string -> PdbData -> 'a +#endif + +//#if FX_PORTABLEPDB_WRITER +type idd = + { iddCharacteristics: int32; + iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *) + iddMinorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *) + iddType: int32; + iddData: byte[]; } + +val WritePortablePdbInfo : fixupOverlappingSequencePoints:bool -> showTimes:bool -> fpdb:string -> info:PdbData -> idd +//#endif + +#if !FX_NO_PDB_WRITER +val WritePdbInfo : fixupOverlappingSequencePoints:bool -> showTimes:bool -> f:string -> fpdb:string -> info:PdbData -> idd +#endif diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index df1a50db689..82d881db8b8 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2012,6 +2012,7 @@ type TcConfigBuilder = mutable useOptimizationDataFile : bool mutable useSignatureDataFile : bool mutable jitTracking : bool + mutable portable : bool mutable ignoreSymbolStoreSequencePoints : bool mutable internConstantStrings : bool mutable extraOptimizationIterations : int @@ -2185,6 +2186,7 @@ type TcConfigBuilder = useOptimizationDataFile = false useSignatureDataFile = false jitTracking = true + portable = true ignoreSymbolStoreSequencePoints = false internConstantStrings = true extraOptimizationIterations = 0 @@ -2676,6 +2678,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) = member x.useOptimizationDataFile = data.useOptimizationDataFile member x.useSignatureDataFile = data.useSignatureDataFile member x.jitTracking = data.jitTracking + member x.portable = data.portable member x.ignoreSymbolStoreSequencePoints = data.ignoreSymbolStoreSequencePoints member x.internConstantStrings = data.internConstantStrings member x.extraOptimizationIterations = data.extraOptimizationIterations diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 2bd3671f141..78b67a97421 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -305,6 +305,7 @@ type TcConfigBuilder = mutable useOptimizationDataFile : bool mutable useSignatureDataFile : bool mutable jitTracking : bool + mutable portable : bool mutable ignoreSymbolStoreSequencePoints : bool mutable internConstantStrings : bool mutable extraOptimizationIterations : int @@ -457,6 +458,7 @@ type TcConfig = member useOptimizationDataFile : bool member useSignatureDataFile : bool member jitTracking : bool + member portable : bool member ignoreSymbolStoreSequencePoints : bool member internConstantStrings : bool member extraOptimizationIterations : int diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 4a117b7593a..c22bb8028cc 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -478,10 +478,11 @@ let SetDebugSwitch (tcConfigB : TcConfigBuilder) (dtype : string option) (s : Op match dtype with | Some(s) -> match s with - | "pdbonly" -> tcConfigB.jitTracking <- false - | "full" -> tcConfigB.jitTracking <- true + | "portable" -> tcConfigB.jitTracking <- true; tcConfigB.portable <- true + | "pdbonly" -> tcConfigB.jitTracking <- false; tcConfigB.portable <- false + | "full" -> tcConfigB.jitTracking <- true; tcConfigB.portable <- false | _ -> error(Error(FSComp.SR.optsUnrecognizedDebugType(s), rangeCmdArgs)) - | None -> tcConfigB.jitTracking <- s = OptionSwitch.On + | None -> tcConfigB.jitTracking <- s = OptionSwitch.On; tcConfigB.portable <- false tcConfigB.debuginfo <- s = OptionSwitch.On let setOutFileName tcConfigB s = @@ -502,7 +503,7 @@ let tagFileList = "" let tagDirList = "" let tagPathList = "" let tagResInfo = "" -let tagFullPDBOnly = "{full|pdbonly}" +let tagFullPDBOnlyPortable = "{full|pdbonly|portable}" let tagWarnList = "" let tagSymbolList = "" let tagAddress = "
" @@ -524,13 +525,13 @@ let PrintOptionInfo (tcConfigB:TcConfigBuilder) = printfn " doTLR . . . . . . . . : %+A" tcConfigB.doTLR printfn " doFinalSimplify. . . . : %+A" tcConfigB.doFinalSimplify printfn " jitTracking . . . . . : %+A" tcConfigB.jitTracking + printfn " portable . . . . . . . : %+A" tcConfigB.portable printfn " debuginfo . . . . . . : %+A" tcConfigB.debuginfo printfn " resolutionEnvironment : %+A" tcConfigB.resolutionEnvironment printfn " product . . . . . . . : %+A" tcConfigB.productNameForBannerText printfn " copyFSharpCore . . . . : %+A" tcConfigB.copyFSharpCore tcConfigB.includes |> List.sort |> List.iter (printfn " include . . . . . . . : %A") - // OptionBlock: Input files //------------------------- @@ -665,7 +666,7 @@ let codeGenerationFlags (tcConfigB : TcConfigBuilder) = CompilerOption("debug", tagNone, OptionSwitch (SetDebugSwitch tcConfigB None), None, Some (FSComp.SR.optsDebugPM())); - CompilerOption("debug", tagFullPDBOnly, OptionString (fun s -> SetDebugSwitch tcConfigB (Some(s)) OptionSwitch.On), None, + CompilerOption("debug", tagFullPDBOnlyPortable, OptionString (fun s -> SetDebugSwitch tcConfigB (Some(s)) OptionSwitch.On), None, Some (FSComp.SR.optsDebug())); CompilerOption("optimize", tagNone, OptionSwitch (SetOptimizeSwitch tcConfigB) , None, diff --git a/src/fsharp/FSComp.txt b/src/fsharp/FSComp.txt index 8d72a2f69e1..a88fd42424c 100644 --- a/src/fsharp/FSComp.txt +++ b/src/fsharp/FSComp.txt @@ -827,7 +827,7 @@ optsNowin32manifest,"Do not include the default Win32 manifest" optsResource,"Embed the specified managed resource" optsLinkresource,"Link the specified resource to this assembly where the resinfo format is [,[,public|private]]" optsDebugPM,"Emit debug information (Short form: -g)" -optsDebug,"Specify debugging type: full, pdbonly. ('full' is the default and enables attaching a debugger to a running program)." +optsDebug,"Specify debugging type: full, portable, pdbonly. ('full' is the default and enables attaching a debugger to a running program. 'portable' is a cross-platform format)." optsOptimize,"Enable optimizations (Short form: -O)" optsTailcalls,"Enable or disable tailcalls" optsCrossoptimize,"Enable or disable cross-module optimizations" diff --git a/src/fsharp/FSharp.Build/FSharp.Build.fsproj b/src/fsharp/FSharp.Build/FSharp.Build.fsproj index c27029bd255..bb4b0a530dc 100644 --- a/src/fsharp/FSharp.Build/FSharp.Build.fsproj +++ b/src/fsharp/FSharp.Build/FSharp.Build.fsproj @@ -47,8 +47,8 @@ - - + + {DED3BBD7-53F4-428A-8C9F-27968E768605} FSharp.Core diff --git a/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj b/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj index 509f3bbd0d1..da133952e64 100644 --- a/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj +++ b/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj @@ -226,6 +226,12 @@ ilwrite.fsi + + ilwritepdb.fsi + + + ilwritepdb.fs + ilwrite.fs @@ -437,14 +443,16 @@ - - - + + + - - + ..\..\..\packages\Microsoft.DiaSymReader.PortablePdb.1.3.20160301.3\lib\portable-net45+win8\Microsoft.DiaSymReader.PortablePdb.dll + ..\..\..\packages\Microsoft.DiaSymReader.1.0.7\lib\portable-net45+win8\Microsoft.DiaSymReader.dll + ..\..\..\packages\System.Reflection.Metadata.1.3.0-beta-23816\lib\portable-net45+win8\System.Reflection.Metadata.dll + ..\..\..\packages\System.Collections.Immutable.1.2.0-rc3-23805\lib\portable-net45+win8+wp8+wpa81 diff --git a/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj b/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj index 40833c5f91c..b1bb3fdba64 100644 --- a/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj +++ b/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj @@ -229,6 +229,12 @@ AbsIL\ilwrite.fsi + + AbsIL\ilwritepdb.fsi + + + AbsIL\ilwritepdb.fs + AbsIL\ilwrite.fs @@ -539,8 +545,12 @@ - - + + + ..\..\..\packages\Microsoft.DiaSymReader.PortablePdb.1.0.0-rc-60301\lib\portable-net45+win8\Microsoft.DiaSymReader.PortablePdb.dll + ..\..\..\packages\Microsoft.DiaSymReader\1.0.7\lib\portable-net45+win8\Microsoft.DiaSymReader.dll + ..\..\..\packages\System.Reflection.Metadata.1.3.0-beta-23816\lib\portable-net45+win8\System.Reflection.Metadata.dll + ..\..\..\packages\System.Collections.Immutable.1.2.0-rc3-23805\lib\portable-net45+win8+wp8+wpa81 diff --git a/src/fsharp/FSharp.Compiler/project.json b/src/fsharp/FSharp.Compiler/project.json index f55b93da635..06461c26539 100644 --- a/src/fsharp/FSharp.Compiler/project.json +++ b/src/fsharp/FSharp.Compiler/project.json @@ -10,7 +10,7 @@ "System.Net.Requests": "4.0.11-rc3-23805", "System.Reflection.Emit": "4.0.1-rc3-23805", "System.Reflection.Emit.ILGeneration": "4.0.1-rc3-23805", - "System.Reflection.Metadata": "1.2.0-rc3-23805", + "System.Reflection.Metadata": "1.3.0-beta-23816", "System.Runtime.InteropServices": "4.1.0-rc3-23805", "System.Runtime.InteropServices.PInvoke": "4.0.0-rc3-23805", "System.Runtime.Loader": "4.0.0-rc3-23805", @@ -20,6 +20,8 @@ "System.Threading.Tasks.Parallel": "4.0.1-rc3-23805", "System.Threading.Thread": "4.0.0-rc3-23805", "System.Threading.ThreadPool": "4.0.10-rc3-23805", + "Microsoft.DiaSymReader.PortablePdb": "1.0.0-rc-60301", + "Microsoft.DiaSymReader": "1.0.7", }, "runtimes": { "win7-x86": { }, @@ -28,7 +30,9 @@ "ubuntu.14.04-x64": { } }, "frameworks": { - "dnxcore50": { } + "dnxcore50": { + "imports": "portable-net45+win8" + } } } diff --git a/src/fsharp/FSharp.Compiler/project.lock.json b/src/fsharp/FSharp.Compiler/project.lock.json index 9287c2101d9..2636844e130 100644 --- a/src/fsharp/FSharp.Compiler/project.lock.json +++ b/src/fsharp/FSharp.Compiler/project.lock.json @@ -3,6 +3,29 @@ "version": 2, "targets": { "DNXCore,Version=v5.0": { + "Microsoft.DiaSymReader/1.0.7": { + "type": "package", + "compile": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.dll": {} + }, + "runtime": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.dll": {} + } + }, + "Microsoft.DiaSymReader.PortablePdb/1.0.0-rc-60301": { + "type": "package", + "dependencies": { + "Microsoft.DiaSymReader": "1.0.7", + "System.Collections.Immutable": "1.1.37", + "System.Reflection.Metadata": "1.2.0-rc2-23826" + }, + "compile": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} + }, + "runtime": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} + } + }, "Microsoft.DotNet.CoreHost/0.0.1-beta-00001": { "type": "package" }, @@ -464,7 +487,7 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { + "System.Reflection.Metadata/1.3.0-beta-23816": { "type": "package", "dependencies": { "System.Collections": "4.0.0", @@ -782,6 +805,29 @@ } }, "DNXCore,Version=v5.0/osx.10.10-x64": { + "Microsoft.DiaSymReader/1.0.7": { + "type": "package", + "compile": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.dll": {} + }, + "runtime": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.dll": {} + } + }, + "Microsoft.DiaSymReader.PortablePdb/1.0.0-rc-60301": { + "type": "package", + "dependencies": { + "Microsoft.DiaSymReader": "1.0.7", + "System.Collections.Immutable": "1.1.37", + "System.Reflection.Metadata": "1.2.0-rc2-23826" + }, + "compile": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} + }, + "runtime": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} + } + }, "Microsoft.DotNet.CoreHost/0.0.1-beta-00001": { "type": "package", "dependencies": { @@ -2009,7 +2055,7 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { + "System.Reflection.Metadata/1.3.0-beta-23816": { "type": "package", "dependencies": { "System.Collections": "4.0.0", @@ -2380,6 +2426,29 @@ } }, "DNXCore,Version=v5.0/ubuntu.14.04-x64": { + "Microsoft.DiaSymReader/1.0.7": { + "type": "package", + "compile": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.dll": {} + }, + "runtime": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.dll": {} + } + }, + "Microsoft.DiaSymReader.PortablePdb/1.0.0-rc-60301": { + "type": "package", + "dependencies": { + "Microsoft.DiaSymReader": "1.0.7", + "System.Collections.Immutable": "1.1.37", + "System.Reflection.Metadata": "1.2.0-rc2-23826" + }, + "compile": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} + }, + "runtime": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} + } + }, "Microsoft.DotNet.CoreHost/0.0.1-beta-00001": { "type": "package", "dependencies": { @@ -3609,7 +3678,7 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { + "System.Reflection.Metadata/1.3.0-beta-23816": { "type": "package", "dependencies": { "System.Collections": "4.0.0", @@ -3980,6 +4049,29 @@ } }, "DNXCore,Version=v5.0/win7-x64": { + "Microsoft.DiaSymReader/1.0.7": { + "type": "package", + "compile": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.dll": {} + }, + "runtime": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.dll": {} + } + }, + "Microsoft.DiaSymReader.PortablePdb/1.0.0-rc-60301": { + "type": "package", + "dependencies": { + "Microsoft.DiaSymReader": "1.0.7", + "System.Collections.Immutable": "1.1.37", + "System.Reflection.Metadata": "1.2.0-rc2-23826" + }, + "compile": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} + }, + "runtime": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} + } + }, "Microsoft.DotNet.CoreHost/0.0.1-beta-00001": { "type": "package", "dependencies": { @@ -5330,7 +5422,7 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { + "System.Reflection.Metadata/1.3.0-beta-23816": { "type": "package", "dependencies": { "System.Collections": "4.0.0", @@ -5764,6 +5856,29 @@ } }, "DNXCore,Version=v5.0/win7-x86": { + "Microsoft.DiaSymReader/1.0.7": { + "type": "package", + "compile": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.dll": {} + }, + "runtime": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.dll": {} + } + }, + "Microsoft.DiaSymReader.PortablePdb/1.0.0-rc-60301": { + "type": "package", + "dependencies": { + "Microsoft.DiaSymReader": "1.0.7", + "System.Collections.Immutable": "1.1.37", + "System.Reflection.Metadata": "1.2.0-rc2-23826" + }, + "compile": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} + }, + "runtime": { + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} + } + }, "Microsoft.DotNet.CoreHost/0.0.1-beta-00001": { "type": "package" }, @@ -7104,7 +7219,7 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { + "System.Reflection.Metadata/1.3.0-beta-23816": { "type": "package", "dependencies": { "System.Collections": "4.0.0", @@ -7539,6 +7654,30 @@ } }, "libraries": { + "Microsoft.DiaSymReader/1.0.7": { + "sha512": "4tPrkKu02w87HEvoubBGm7Hqjps69DucsBWQvGezwvDV5RJt+eZqdmdC/jNH1qn6hIem9JpJnLBK0abBzhErOg==", + "type": "package", + "files": [ + "Microsoft.DiaSymReader.1.0.7.nupkg.sha512", + "Microsoft.DiaSymReader.nuspec", + "lib/net20/Microsoft.DiaSymReader.dll", + "lib/net20/Microsoft.DiaSymReader.xml", + "lib/portable-net45+win8/Microsoft.DiaSymReader.dll", + "lib/portable-net45+win8/Microsoft.DiaSymReader.xml" + ] + }, + "Microsoft.DiaSymReader.PortablePdb/1.0.0-rc-60301": { + "sha512": "xgkCQFUZQ73Wpqoyt2C3hvSOEnYEDNsHHfffUs6m+UgycITJCz5F1VBnuIUSb3tJ8Oqr8lNDBoWNzukE6Rr+ug==", + "type": "package", + "files": [ + "Microsoft.DiaSymReader.PortablePdb.1.0.0-rc-60301.nupkg.sha512", + "Microsoft.DiaSymReader.PortablePdb.nuspec", + "lib/net45/Microsoft.DiaSymReader.PortablePdb.dll", + "lib/net45/Microsoft.DiaSymReader.PortablePdb.xml", + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll", + "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.xml" + ] + }, "Microsoft.DotNet.CoreHost/0.0.1-beta-00001": { "sha512": "8B1JNAz0dQPltBIonw8TTE16OeY+iUVw1bFLJlZ70zX3hf+18tyKiQmJK1adOTObxJ6uFEz18Mxt2Ue5LtgQXQ==", "type": "package", @@ -10918,11 +11057,11 @@ "runtime.json" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { - "sha512": "EUdvtSKTE9/tbkrSkgwdNbKw7vFuxzooAWNjk+tFXL4Tj2m4AlIScq0iNGqZVGW+EGyMn1XjPE4Jv1KQptcr+g==", + "System.Reflection.Metadata/1.3.0-beta-23816": { + "sha512": "6pn0tC1qbf7oZC/H5txVnOmbYkYI87xbLPXdncLPu65wVWt80yi0IEsqwYYmdmBEhv/g9ZmjMDX3VAfzUxCNyg==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23805.nupkg.sha512", + "System.Reflection.Metadata.1.3.0-beta-23816.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -12210,6 +12349,8 @@ }, "projectFileDependencyGroups": { "": [ + "Microsoft.DiaSymReader >= 1.0.7", + "Microsoft.DiaSymReader.PortablePdb >= 1.0.0-rc-60301", "Microsoft.NETCore.Platforms >= 1.0.1-rc3-23805", "NETStandard.Library >= 1.0.0-rc3-23805", "System.Collections.Immutable >= 1.2.0-rc3-23805", @@ -12220,7 +12361,7 @@ "System.Net.Requests >= 4.0.11-rc3-23805", "System.Reflection.Emit >= 4.0.1-rc3-23805", "System.Reflection.Emit.ILGeneration >= 4.0.1-rc3-23805", - "System.Reflection.Metadata >= 1.2.0-rc3-23805", + "System.Reflection.Metadata >= 1.3.0-beta-23816", "System.Runtime.InteropServices >= 4.1.0-rc3-23805", "System.Runtime.InteropServices.PInvoke >= 4.0.0-rc3-23805", "System.Runtime.Loader >= 4.0.0-rc3-23805", diff --git a/src/fsharp/FSharp.LanguageService.Compiler/FSharp.LanguageService.Compiler.fsproj b/src/fsharp/FSharp.LanguageService.Compiler/FSharp.LanguageService.Compiler.fsproj index bffe077be49..7ad7b330662 100644 --- a/src/fsharp/FSharp.LanguageService.Compiler/FSharp.LanguageService.Compiler.fsproj +++ b/src/fsharp/FSharp.LanguageService.Compiler/FSharp.LanguageService.Compiler.fsproj @@ -14,10 +14,6 @@ COMPILER;$(DefineConstants) COMPILED_AS_LANGUAGE_SERVICE_DLL;$(DefineConstants) INCLUDE_METADATA_READER;$(DefineConstants) - EXTENSIBLE_DUMPER;$(DefineConstants) - XXXX_NO_COMPILER_BACKEND;$(DefineConstants) - FX_NO_PDB_READER;$(DefineConstants) - FX_NO_PDB_WRITER;$(DefineConstants) NO_INLINE_IL_PARSER;$(DefineConstants) $(DefineConstants);PREFERRED_UI_LANG INCLUDE_METADATA_WRITER;$(DefineConstants) @@ -218,6 +214,12 @@ AbsIL\ilread.fs + + AbsIL/ilwritepdb.fsi + + + AbsIL/ilwritepdb.fs + AbsIL/ilwrite.fsi @@ -527,8 +529,12 @@ - - + + + ..\..\..\packages\Microsoft.DiaSymReader.PortablePdb.1.0.0-rc-60301\lib\portable-net45+win8\Microsoft.DiaSymReader.PortablePdb.dll + ..\..\..\packages\Microsoft.DiaSymReader\1.0.7\lib\portable-net45+win8\Microsoft.DiaSymReader.dll + ..\..\..\packages\System.Reflection.Metadata.1.3.0-beta-23816\lib\portable-net45+win8\System.Reflection.Metadata.dll + ..\..\..\packages\System.Collections.Immutable.1.2.0-rc3-23805\lib\portable-net45+win8+wp8+wpa81 {DED3BBD7-53F4-428A-8C9F-27968E768605} FSharp.Core diff --git a/src/fsharp/Fsc/project.json b/src/fsharp/Fsc/project.json index c34d931af84..aa1e04cd7c2 100644 --- a/src/fsharp/Fsc/project.json +++ b/src/fsharp/Fsc/project.json @@ -3,6 +3,7 @@ "Microsoft.NETCore.Platforms": "1.0.1-rc3-23805", "NETStandard.Library": "1.0.0-rc3-23805", "System.Linq.Expressions": "4.0.11-rc3-23805", + "System.Reflection.Metadata": "1.3.0-beta-23816 ", }, "runtimes": { "win7-x86": { }, diff --git a/src/fsharp/Fsc/project.lock.json b/src/fsharp/Fsc/project.lock.json index 03c608c6bfe..6e6fe55b379 100644 --- a/src/fsharp/Fsc/project.lock.json +++ b/src/fsharp/Fsc/project.lock.json @@ -134,6 +134,25 @@ "lib/dotnet5.4/System.Collections.Concurrent.dll": {} } }, + "System.Collections.Immutable/1.1.37": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Diagnostics.Debug": "4.0.0", + "System.Globalization": "4.0.0", + "System.Linq": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet/System.Collections.Immutable.dll": {} + }, + "runtime": { + "lib/dotnet/System.Collections.Immutable.dll": {} + } + }, "System.Console/4.0.0-rc3-23805": { "type": "package", "dependencies": { @@ -296,6 +315,32 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Collections.Immutable": "1.1.37", + "System.Diagnostics.Debug": "4.0.0", + "System.IO": "4.0.0", + "System.Linq": "4.0.0", + "System.Reflection": "4.0.0", + "System.Reflection.Extensions": "4.0.0", + "System.Reflection.Primitives": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Runtime.InteropServices": "4.0.0", + "System.Text.Encoding": "4.0.0", + "System.Text.Encoding.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + }, + "runtime": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + } + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -1047,6 +1092,25 @@ "lib/dotnet5.4/System.Collections.Concurrent.dll": {} } }, + "System.Collections.Immutable/1.2.0-rc3-23805": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Diagnostics.Debug": "4.0.0", + "System.Globalization": "4.0.0", + "System.Linq": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + }, + "runtime": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + } + }, "System.Collections.NonGeneric/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -1321,6 +1385,32 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Collections.Immutable": "1.1.37", + "System.Diagnostics.Debug": "4.0.0", + "System.IO": "4.0.0", + "System.Linq": "4.0.0", + "System.Reflection": "4.0.0", + "System.Reflection.Extensions": "4.0.0", + "System.Reflection.Primitives": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Runtime.InteropServices": "4.0.0", + "System.Text.Encoding": "4.0.0", + "System.Text.Encoding.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + }, + "runtime": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + } + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -2101,6 +2191,25 @@ "lib/dotnet5.4/System.Collections.Concurrent.dll": {} } }, + "System.Collections.Immutable/1.2.0-rc3-23805": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Diagnostics.Debug": "4.0.0", + "System.Globalization": "4.0.0", + "System.Linq": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + }, + "runtime": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + } + }, "System.Collections.NonGeneric/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -2375,6 +2484,32 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Collections.Immutable": "1.1.37", + "System.Diagnostics.Debug": "4.0.0", + "System.IO": "4.0.0", + "System.Linq": "4.0.0", + "System.Reflection": "4.0.0", + "System.Reflection.Extensions": "4.0.0", + "System.Reflection.Primitives": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Runtime.InteropServices": "4.0.0", + "System.Text.Encoding": "4.0.0", + "System.Text.Encoding.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + }, + "runtime": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + } + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -3249,6 +3384,25 @@ "lib/dotnet5.4/System.Collections.Concurrent.dll": {} } }, + "System.Collections.Immutable/1.2.0-rc3-23805": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Diagnostics.Debug": "4.0.0", + "System.Globalization": "4.0.0", + "System.Linq": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + }, + "runtime": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + } + }, "System.Collections.NonGeneric/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -3523,6 +3677,32 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Collections.Immutable": "1.1.37", + "System.Diagnostics.Debug": "4.0.0", + "System.IO": "4.0.0", + "System.Linq": "4.0.0", + "System.Reflection": "4.0.0", + "System.Reflection.Extensions": "4.0.0", + "System.Reflection.Primitives": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Runtime.InteropServices": "4.0.0", + "System.Text.Encoding": "4.0.0", + "System.Text.Encoding.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + }, + "runtime": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + } + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -4441,6 +4621,25 @@ "lib/dotnet5.4/System.Collections.Concurrent.dll": {} } }, + "System.Collections.Immutable/1.2.0-rc3-23805": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Diagnostics.Debug": "4.0.0", + "System.Globalization": "4.0.0", + "System.Linq": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + }, + "runtime": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + } + }, "System.Collections.NonGeneric/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -4715,6 +4914,32 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Collections.Immutable": "1.1.37", + "System.Diagnostics.Debug": "4.0.0", + "System.IO": "4.0.0", + "System.Linq": "4.0.0", + "System.Reflection": "4.0.0", + "System.Reflection.Extensions": "4.0.0", + "System.Reflection.Primitives": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Runtime.InteropServices": "4.0.0", + "System.Text.Encoding": "4.0.0", + "System.Text.Encoding.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + }, + "runtime": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + } + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -6423,6 +6648,32 @@ "ref/xamarinmac20/_._" ] }, + "System.Collections.Immutable/1.1.37": { + "sha512": "fTpqwZYBzoklTT+XjTRK8KxvmrGkYHzBiylCcKyQcxiOM8k+QvhNBxRvFHDWzy4OEP5f8/9n+xQ9mEgEXY+muA==", + "type": "package", + "files": [ + "System.Collections.Immutable.1.1.37.nupkg.sha512", + "System.Collections.Immutable.nuspec", + "lib/dotnet/System.Collections.Immutable.dll", + "lib/dotnet/System.Collections.Immutable.xml", + "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll", + "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" + ] + }, + "System.Collections.Immutable/1.2.0-rc3-23805": { + "sha512": "NL/gLZiofFGOK85YfcSo4JRI07YAX0pLQp6zjLSvwp9s6Gw4RI2o4dczi/jR5q146rpSneRcEc8ehs+HU7Jdvg==", + "type": "package", + "files": [ + "System.Collections.Immutable.1.2.0-rc3-23805.nupkg.sha512", + "System.Collections.Immutable.nuspec", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/dotnet5.1/System.Collections.Immutable.dll", + "lib/dotnet5.1/System.Collections.Immutable.xml", + "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll", + "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" + ] + }, "System.Collections.NonGeneric/4.0.1-rc3-23805": { "sha512": "zKpgi4o1x+fDwwyQs3THpowWw75/wB2hOVzlxAQHKV0PGAbso20Y9bO1jsRxlGPNCCNQuK9pgfXzyAxj2YOspA==", "type": "package", @@ -7412,6 +7663,20 @@ "runtime.json" ] }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "sha512": "6pn0tC1qbf7oZC/H5txVnOmbYkYI87xbLPXdncLPu65wVWt80yi0IEsqwYYmdmBEhv/g9ZmjMDX3VAfzUxCNyg==", + "type": "package", + "files": [ + "System.Reflection.Metadata.1.3.0-beta-23816.nupkg.sha512", + "System.Reflection.Metadata.nuspec", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/dotnet5.2/System.Reflection.Metadata.dll", + "lib/dotnet5.2/System.Reflection.Metadata.xml", + "lib/portable-net45+win8/System.Reflection.Metadata.dll", + "lib/portable-net45+win8/System.Reflection.Metadata.xml" + ] + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "sha512": "gw35+ceU7yB7ubfrMmBUtASz/vgCOmOScudJDYpOLV4JCUTVdpJfY0TdvAbTellyL4Emoq0DjvjGL7J23sD+ww==", "type": "package", @@ -8421,7 +8686,8 @@ "": [ "Microsoft.NETCore.Platforms >= 1.0.1-rc3-23805", "NETStandard.Library >= 1.0.0-rc3-23805", - "System.Linq.Expressions >= 4.0.11-rc3-23805" + "System.Linq.Expressions >= 4.0.11-rc3-23805", + "System.Reflection.Metadata >= 1.3.0-beta-23816" ], "DNXCore,Version=v5.0": [] } diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 68f60151267..7e3780868e8 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1761,6 +1761,7 @@ module FileWriter = pdbfile=pdbfile emitTailcalls = tcConfig.emitTailcalls showTimes = tcConfig.showTimes + portable = tcConfig.portable signer = GetSigner signingInfo fixupOverlappingSequencePoints = false dumpDebugInfo = tcConfig.dumpDebugInfo }, diff --git a/src/fsharp/fsi/project.json b/src/fsharp/fsi/project.json index 70c35d6ee3e..7d8c5df98c0 100644 --- a/src/fsharp/fsi/project.json +++ b/src/fsharp/fsi/project.json @@ -7,6 +7,7 @@ "System.Reflection.Emit": "4.0.1-rc3-23805", "System.Runtime.Loader": "4.0.0-rc3-23805", "System.Threading.Thread": "4.0.0-rc3-23805", + "System.Reflection.Metadata": "1.3.0-beta-23816 ", }, "runtimes": { "win7-x86": { }, diff --git a/src/fsharp/fsi/project.lock.json b/src/fsharp/fsi/project.lock.json index 1e405cfcd0d..537af1feec2 100644 --- a/src/fsharp/fsi/project.lock.json +++ b/src/fsharp/fsi/project.lock.json @@ -134,6 +134,25 @@ "lib/dotnet5.4/System.Collections.Concurrent.dll": {} } }, + "System.Collections.Immutable/1.1.37": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Diagnostics.Debug": "4.0.0", + "System.Globalization": "4.0.0", + "System.Linq": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet/System.Collections.Immutable.dll": {} + }, + "runtime": { + "lib/dotnet/System.Collections.Immutable.dll": {} + } + }, "System.Console/4.0.0-rc3-23805": { "type": "package", "dependencies": { @@ -338,6 +357,32 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Collections.Immutable": "1.1.37", + "System.Diagnostics.Debug": "4.0.0", + "System.IO": "4.0.0", + "System.Linq": "4.0.0", + "System.Reflection": "4.0.0", + "System.Reflection.Extensions": "4.0.0", + "System.Reflection.Primitives": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Runtime.InteropServices": "4.0.0", + "System.Text.Encoding": "4.0.0", + "System.Text.Encoding.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + }, + "runtime": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + } + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -1143,6 +1188,25 @@ "lib/dotnet5.4/System.Collections.Concurrent.dll": {} } }, + "System.Collections.Immutable/1.2.0-rc3-23805": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Diagnostics.Debug": "4.0.0", + "System.Globalization": "4.0.0", + "System.Linq": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + }, + "runtime": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + } + }, "System.Collections.NonGeneric/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -1430,6 +1494,32 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Collections.Immutable": "1.1.37", + "System.Diagnostics.Debug": "4.0.0", + "System.IO": "4.0.0", + "System.Linq": "4.0.0", + "System.Reflection": "4.0.0", + "System.Reflection.Extensions": "4.0.0", + "System.Reflection.Primitives": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Runtime.InteropServices": "4.0.0", + "System.Text.Encoding": "4.0.0", + "System.Text.Encoding.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + }, + "runtime": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + } + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -2264,6 +2354,25 @@ "lib/dotnet5.4/System.Collections.Concurrent.dll": {} } }, + "System.Collections.Immutable/1.2.0-rc3-23805": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Diagnostics.Debug": "4.0.0", + "System.Globalization": "4.0.0", + "System.Linq": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + }, + "runtime": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + } + }, "System.Collections.NonGeneric/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -2551,6 +2660,32 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Collections.Immutable": "1.1.37", + "System.Diagnostics.Debug": "4.0.0", + "System.IO": "4.0.0", + "System.Linq": "4.0.0", + "System.Reflection": "4.0.0", + "System.Reflection.Extensions": "4.0.0", + "System.Reflection.Primitives": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Runtime.InteropServices": "4.0.0", + "System.Text.Encoding": "4.0.0", + "System.Text.Encoding.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + }, + "runtime": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + } + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -3499,6 +3634,25 @@ "lib/dotnet5.4/System.Collections.Concurrent.dll": {} } }, + "System.Collections.Immutable/1.2.0-rc3-23805": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Diagnostics.Debug": "4.0.0", + "System.Globalization": "4.0.0", + "System.Linq": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + }, + "runtime": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + } + }, "System.Collections.NonGeneric/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -3786,6 +3940,32 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Collections.Immutable": "1.1.37", + "System.Diagnostics.Debug": "4.0.0", + "System.IO": "4.0.0", + "System.Linq": "4.0.0", + "System.Reflection": "4.0.0", + "System.Reflection.Extensions": "4.0.0", + "System.Reflection.Primitives": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Runtime.InteropServices": "4.0.0", + "System.Text.Encoding": "4.0.0", + "System.Text.Encoding.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + }, + "runtime": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + } + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -4791,6 +4971,25 @@ "lib/dotnet5.4/System.Collections.Concurrent.dll": {} } }, + "System.Collections.Immutable/1.2.0-rc3-23805": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Diagnostics.Debug": "4.0.0", + "System.Globalization": "4.0.0", + "System.Linq": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + }, + "runtime": { + "lib/dotnet5.1/System.Collections.Immutable.dll": {} + } + }, "System.Collections.NonGeneric/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -5078,6 +5277,32 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "type": "package", + "dependencies": { + "System.Collections": "4.0.0", + "System.Collections.Immutable": "1.1.37", + "System.Diagnostics.Debug": "4.0.0", + "System.IO": "4.0.0", + "System.Linq": "4.0.0", + "System.Reflection": "4.0.0", + "System.Reflection.Extensions": "4.0.0", + "System.Reflection.Primitives": "4.0.0", + "System.Resources.ResourceManager": "4.0.0", + "System.Runtime": "4.0.0", + "System.Runtime.Extensions": "4.0.0", + "System.Runtime.InteropServices": "4.0.0", + "System.Text.Encoding": "4.0.0", + "System.Text.Encoding.Extensions": "4.0.0", + "System.Threading": "4.0.0" + }, + "compile": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + }, + "runtime": { + "lib/dotnet5.2/System.Reflection.Metadata.dll": {} + } + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "type": "package", "dependencies": { @@ -6890,6 +7115,32 @@ "ref/xamarinmac20/_._" ] }, + "System.Collections.Immutable/1.1.37": { + "sha512": "fTpqwZYBzoklTT+XjTRK8KxvmrGkYHzBiylCcKyQcxiOM8k+QvhNBxRvFHDWzy4OEP5f8/9n+xQ9mEgEXY+muA==", + "type": "package", + "files": [ + "System.Collections.Immutable.1.1.37.nupkg.sha512", + "System.Collections.Immutable.nuspec", + "lib/dotnet/System.Collections.Immutable.dll", + "lib/dotnet/System.Collections.Immutable.xml", + "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll", + "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" + ] + }, + "System.Collections.Immutable/1.2.0-rc3-23805": { + "sha512": "NL/gLZiofFGOK85YfcSo4JRI07YAX0pLQp6zjLSvwp9s6Gw4RI2o4dczi/jR5q146rpSneRcEc8ehs+HU7Jdvg==", + "type": "package", + "files": [ + "System.Collections.Immutable.1.2.0-rc3-23805.nupkg.sha512", + "System.Collections.Immutable.nuspec", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/dotnet5.1/System.Collections.Immutable.dll", + "lib/dotnet5.1/System.Collections.Immutable.xml", + "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.dll", + "lib/portable-net45+win8+wp8+wpa81/System.Collections.Immutable.xml" + ] + }, "System.Collections.NonGeneric/4.0.1-rc3-23805": { "sha512": "zKpgi4o1x+fDwwyQs3THpowWw75/wB2hOVzlxAQHKV0PGAbso20Y9bO1jsRxlGPNCCNQuK9pgfXzyAxj2YOspA==", "type": "package", @@ -7949,6 +8200,20 @@ "runtime.json" ] }, + "System.Reflection.Metadata/1.3.0-beta-23816": { + "sha512": "6pn0tC1qbf7oZC/H5txVnOmbYkYI87xbLPXdncLPu65wVWt80yi0IEsqwYYmdmBEhv/g9ZmjMDX3VAfzUxCNyg==", + "type": "package", + "files": [ + "System.Reflection.Metadata.1.3.0-beta-23816.nupkg.sha512", + "System.Reflection.Metadata.nuspec", + "ThirdPartyNotices.txt", + "dotnet_library_license.txt", + "lib/dotnet5.2/System.Reflection.Metadata.dll", + "lib/dotnet5.2/System.Reflection.Metadata.xml", + "lib/portable-net45+win8/System.Reflection.Metadata.dll", + "lib/portable-net45+win8/System.Reflection.Metadata.xml" + ] + }, "System.Reflection.Primitives/4.0.1-rc3-23805": { "sha512": "gw35+ceU7yB7ubfrMmBUtASz/vgCOmOScudJDYpOLV4JCUTVdpJfY0TdvAbTellyL4Emoq0DjvjGL7J23sD+ww==", "type": "package", @@ -9026,6 +9291,7 @@ "System.Diagnostics.Process >= 4.1.0-rc3-23805", "System.Linq.Expressions >= 4.0.11-rc3-23805", "System.Reflection.Emit >= 4.0.1-rc3-23805", + "System.Reflection.Metadata >= 1.3.0-beta-23816", "System.Runtime.Loader >= 4.0.0-rc3-23805", "System.Threading.Thread >= 4.0.0-rc3-23805" ], diff --git a/tests/RunTests.cmd b/tests/RunTests.cmd index 785fd31aa13..68ca4db03ab 100644 --- a/tests/RunTests.cmd +++ b/tests/RunTests.cmd @@ -165,7 +165,7 @@ if errorlevel 1 ( ) echo perl %~dp0\fsharpqa\testenv\bin\runall.pl -resultsroot %RESULTSDIR% -results %RESULTFILE% -log %FAILFILE% -fail %FAILENV% -cleanup:yes %TTAGS_ARG% %NO_TTAGS_ARG% %PARALLEL_ARG% - perl %~dp0\fsharpqa\testenv\bin\runall.pl -resultsroot %RESULTSDIR% -results %RESULTFILE% -log %FAILFILE% -fail %FAILENV% -cleanup:yes %TTAGS_ARG% %NO_TTAGS_ARG% %PARALLEL_ARG% + perl %~dp0\fsharpqa\testenv\bin\runall.pl -resultsroot %RESULTSDIR% -results %RESULTFILE% -log %FAILFILE% -fail %FAILENV% -cleanup:yes %TTAGS_ARG% %NO_TTAGS_ARG% %PARALLEL_ARG% -savelog:all ) if errorlevel 1 ( type %RESULTSDIR%\%FAILFILE% diff --git a/tests/fsharp/core/access/test.fsx b/tests/fsharp/core/access/test.fsx index cbe25ae1f3c..8636fd9b2e4 100644 --- a/tests/fsharp/core/access/test.fsx +++ b/tests/fsharp/core/access/test.fsx @@ -8,6 +8,7 @@ open coreclrutilities #endif #light + let failures = ref false let report_failure () = stderr.WriteLine " NO"; failures := true diff --git a/tests/fsharp/project.json b/tests/fsharp/project.json index d5b23f557a7..278b215d97b 100644 --- a/tests/fsharp/project.json +++ b/tests/fsharp/project.json @@ -11,7 +11,7 @@ "System.Linq.Expressions": "4.0.11-rc3-23805", "System.Reflection.Emit": "4.0.1-rc3-23805", "System.Reflection.Emit.ILGeneration": "4.0.1-rc3-23805", - "System.Reflection.Metadata": "1.2.0-rc3-23805", + "System.Reflection.Metadata": "1.3.0-beta-23816", "System.Runtime.InteropServices": "4.1.0-rc3-23805", "System.Runtime.InteropServices.PInvoke": "4.0.0-rc3-23805", "System.Runtime.Loader": "4.0.0-rc3-23805", diff --git a/tests/fsharp/project.lock.json b/tests/fsharp/project.lock.json index ec5ba3b728c..6830bb3a07f 100644 --- a/tests/fsharp/project.lock.json +++ b/tests/fsharp/project.lock.json @@ -372,7 +372,7 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { + "System.Reflection.Metadata/1.3.0-beta-23816": { "type": "package", "dependencies": { "System.Collections": "4.0.0", @@ -1678,7 +1678,7 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { + "System.Reflection.Metadata/1.3.0-beta-23816": { "type": "package", "dependencies": { "System.Collections": "4.0.0", @@ -3002,7 +3002,7 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { + "System.Reflection.Metadata/1.3.0-beta-23816": { "type": "package", "dependencies": { "System.Collections": "4.0.0", @@ -4437,7 +4437,7 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { + "System.Reflection.Metadata/1.3.0-beta-23816": { "type": "package", "dependencies": { "System.Collections": "4.0.0", @@ -5929,7 +5929,7 @@ "ref/dotnet5.1/System.Reflection.Extensions.dll": {} } }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { + "System.Reflection.Metadata/1.3.0-beta-23816": { "type": "package", "dependencies": { "System.Collections": "4.0.0", @@ -9099,11 +9099,11 @@ "runtime.json" ] }, - "System.Reflection.Metadata/1.2.0-rc3-23805": { - "sha512": "EUdvtSKTE9/tbkrSkgwdNbKw7vFuxzooAWNjk+tFXL4Tj2m4AlIScq0iNGqZVGW+EGyMn1XjPE4Jv1KQptcr+g==", + "System.Reflection.Metadata/1.3.0-beta-23816": { + "sha512": "6pn0tC1qbf7oZC/H5txVnOmbYkYI87xbLPXdncLPu65wVWt80yi0IEsqwYYmdmBEhv/g9ZmjMDX3VAfzUxCNyg==", "type": "package", "files": [ - "System.Reflection.Metadata.1.2.0-rc3-23805.nupkg.sha512", + "System.Reflection.Metadata.1.3.0-beta-23816.nupkg.sha512", "System.Reflection.Metadata.nuspec", "ThirdPartyNotices.txt", "dotnet_library_license.txt", @@ -10294,7 +10294,7 @@ "System.Linq.Expressions >= 4.0.11-rc3-23805", "System.Reflection.Emit >= 4.0.1-rc3-23805", "System.Reflection.Emit.ILGeneration >= 4.0.1-rc3-23805", - "System.Reflection.Metadata >= 1.2.0-rc3-23805", + "System.Reflection.Metadata >= 1.3.0-beta-23816", "System.Runtime.InteropServices >= 4.1.0-rc3-23805", "System.Runtime.InteropServices.PInvoke >= 4.0.0-rc3-23805", "System.Runtime.Loader >= 4.0.0-rc3-23805", diff --git a/tests/fsharpqa/testenv/src/deployProj/CompileProj.fsx b/tests/fsharpqa/testenv/src/deployProj/CompileProj.fsx index eccec29a380..c54912fd9e6 100644 --- a/tests/fsharpqa/testenv/src/deployProj/CompileProj.fsx +++ b/tests/fsharpqa/testenv/src/deployProj/CompileProj.fsx @@ -94,7 +94,7 @@ let executeCompiler sources references = let addReferenceSwitch list = list |> Seq.map(fun i -> sprintf "--reference:%s" i) printfn ">%s<" (GetKeyFileOption) printfn ">%s<" (GetDelaySignOption) - let arguments = sprintf @"%s --noframework --simpleresolution --out:%s --define:BASIC_TEST --targetprofile:netcore --target:exe -g --times --win32manifest:%s %s -r:%s %s %s %s %s %s %s" + let arguments = sprintf @"%s --debug:portable --debug+ --noframework --simpleresolution --out:%s --define:BASIC_TEST --targetprofile:netcore --target:exe -g --times --win32manifest:%s %s -r:%s %s %s %s %s %s %s" (System.IO.Path.Combine(CompilerPath, "fsc.exe")) (Output) (Win32Manifest) diff --git a/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectSystem.Base.csproj b/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectSystem.Base.csproj index 06642a5663e..aecbce097a4 100644 --- a/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectSystem.Base.csproj +++ b/vsintegration/src/FSharp.ProjectSystem.Base/Project/ProjectSystem.Base.csproj @@ -41,8 +41,9 @@ - - + + + From 38631320321a59b7a086d6bdb5e0632db8697bda Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Fri, 4 Mar 2016 10:54:02 -0800 Subject: [PATCH 02/11] Fix jittracking for portable, help unit tests --- src/absil/ilwrite.fs | 10 ++-- src/absil/ilwritepdb.fs | 53 +++++++++---------- src/absil/ilwritepdb.fsi | 2 - src/fsharp/CompileOptions.fs | 2 +- src/fsharp/FSharp.Build/Fsc.fs | 5 +- .../fsc/help/help40.437.1033.bsl | 7 +-- .../fsi/help/help-nologo.437.1033.bsl | 7 +-- .../fsi/help/help.437.1033.bsl | 7 +-- .../fsi/help/help40-nologo.437.1033.bsl | 7 +-- .../fsi/help/help40.437.1033.bsl | 7 +-- tests/fsharpqa/Source/test.lst | 4 +- 11 files changed, 57 insertions(+), 54 deletions(-) diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index 9c14f6618fc..e5eec424431 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -2910,10 +2910,9 @@ and GetManifsetAsAssemblyRow cenv m = // Setting these causes peverify errors. Hence both ilread and ilwrite ignore them and refuse to set them. // Any debugging customattributes will automatically propagate // REVIEW: No longer appears to be the case... - (if m.JitTracking then 0x8000 else 0x0) ||| - (if m.DisableJitOptimizations then 0x4000 else 0x0) ||| - (match m.PublicKey with None -> 0x0000 | Some _ -> 0x0001) ||| - 0x0000) + (if m.JitTracking then 0x8000 else 0x0) ||| + (if m.DisableJitOptimizations then 0x4000 else 0x0) ||| + (match m.PublicKey with None -> 0x0000 | Some _ -> 0x0001) ||| 0x0000) (match m.PublicKey with None -> Blob 0 | Some x -> Blob (GetBytesAsBlobIdx cenv x)) StringE (GetStringHeapIdx cenv m.Name) (match m.Locale with None -> StringE 0 | Some x -> StringE (GetStringHeapIdx cenv x)) |] @@ -4228,7 +4227,8 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: with e -> reraise() - end + end + ignore debugDataChunk reportTime showTimes "Finalize PDB" /// Sign the binary. No further changes to binary allowed past this point! diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index baad0d64010..f4d30cb7f04 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -197,8 +197,7 @@ let fixupOverlappingSequencePoints fixupSPs showTimes methods = Array.sortInPlaceBy fst allSps spCounts, allSps -let WritePortablePdbInfo fixupSPs showTimes fpdb (info:PdbData) = - +let WritePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) = try FileSystem.FileDelete fpdb with _ -> () sortMethods showTimes info let _spCounts, _allSps = fixupOverlappingSequencePoints fixupSPs showTimes info.Methods @@ -208,23 +207,23 @@ let WritePortablePdbInfo fixupSPs showTimes fpdb (info:PdbData) = Array.empty else info.Documents - + let metadata = MetadataBuilder() let serializeDocumentName (name:string) = let count s c = s |> Seq.filter(fun ch -> if c = ch then true else false) |> Seq.length - + let s1, s2 = '/', '\\' let separator = if (count name s1) >= (count name s2) then s1 else s2 let writer = new BlobBuilder() writer.WriteByte(byte(separator)) - + for part in name.Split( [| separator |] ) do let partIndex = MetadataTokens.GetHeapOffset(BlobHandle.op_Implicit(metadata.GetBlobUtf8(part))) writer.WriteCompressedInteger(int(partIndex)) metadata.GetBlob(writer); - + let corSymLanguageTypeFSharp = System.Guid(0xAB4F38C9u, 0xB6E6us, 0x43baus, 0xBEuy, 0x3Buy, 0x58uy, 0x08uy, 0x0Buy, 0x2Cuy, 0xCCuy, 0xE3uy) let documentIndex = let mutable index = new Dictionary() @@ -244,7 +243,7 @@ let WritePortablePdbInfo fixupSPs showTimes fpdb (info:PdbData) = metadata.GetGuid(corSymLanguageTypeFSharp)) index.Add(doc.File, handle) index - + metadata.SetCapacity(TableIndex.MethodDebugInformation, info.Methods.Length) info.Methods |> Array.iteri (fun _i minfo -> let docHandle, sequencePointBlob = @@ -255,13 +254,13 @@ let WritePortablePdbInfo fixupSPs showTimes fpdb (info:PdbData) = match minfo.Range with | None -> Array.empty | Some (_,_) -> minfo.SequencePoints - + let getDocumentName i = if i < 0 || i > docs.Length then failwith "getDocument: bad doc number" else docs.[i].File - + let getDocumentHandle d = if docs.Length = 0 || d < 0 || d > docs.Length then Unchecked.defaultof @@ -269,7 +268,7 @@ let WritePortablePdbInfo fixupSPs showTimes fpdb (info:PdbData) = match documentIndex.TryGetValue(getDocumentName d) with | false, _ -> Unchecked.defaultof | true, f -> f - + let tryGetSingleDocumentIndex = let mutable singleDocumentIndex = 0 for i in 1 .. sps.Length - 1 do @@ -277,22 +276,22 @@ let WritePortablePdbInfo fixupSPs showTimes fpdb (info:PdbData) = if index <> singleDocumentIndex then singleDocumentIndex <- index singleDocumentIndex - + if sps.Length = 0 then Unchecked.defaultof, Unchecked.defaultof else let builder = new BlobBuilder() builder.WriteCompressedInteger(minfo.LocalSignatureToken) - + let mutable previousNonHiddenStartLine = -1 let mutable previousNonHiddenStartColumn = -1 let mutable previousDocumentIndex = -1 let mutable singleDocumentIndex = tryGetSingleDocumentIndex let mutable currentDocumentIndex = previousDocumentIndex - + for i in 0 .. (sps.Length - 1) do - + if previousDocumentIndex <> currentDocumentIndex then // optional document in header or document record: if previousDocumentIndex <> -1 then @@ -300,29 +299,29 @@ let WritePortablePdbInfo fixupSPs showTimes fpdb (info:PdbData) = builder.WriteCompressedInteger(0) builder.WriteCompressedInteger(currentDocumentIndex) previousDocumentIndex <- currentDocumentIndex - + // delta IL offset: if i > 0 then builder.WriteCompressedInteger(sps.[i].Offset - sps.[i - 1].Offset) else builder.WriteCompressedInteger(sps.[i].Offset) - + // F# does not support hidden sequence points yet !!! // if (sequencePoints[i].IsHidden) // { // builder.WriteInt16(0); // continue; // } - + let deltaLines = sps.[i].EndLine - sps.[i].Line; let deltaColumns = sps.[i].EndColumn - sps.[i].Column; builder.WriteCompressedInteger(deltaLines); - + if deltaLines = 0 then builder.WriteCompressedInteger(deltaColumns) else builder.WriteCompressedSignedInteger(deltaColumns) - + // delta Start Lines & Columns: if previousNonHiddenStartLine < 0 then builder.WriteCompressedInteger(sps.[i].Line) @@ -330,12 +329,12 @@ let WritePortablePdbInfo fixupSPs showTimes fpdb (info:PdbData) = else builder.WriteCompressedSignedInteger(sps.[i].Line - previousNonHiddenStartLine) builder.WriteCompressedSignedInteger(sps.[i].Column - previousNonHiddenStartColumn) - + previousNonHiddenStartLine <- sps.[i].Line previousNonHiddenStartColumn <- sps.[i].Column - + getDocumentHandle singleDocumentIndex, metadata.GetBlob(builder) - + // Write the scopes let mutable lastLocalVariableHandle = Unchecked.defaultof let nextHandle handle = MetadataTokens.LocalVariableHandle(MetadataTokens.GetRowNumber(LocalVariableHandle.op_Implicit(handle)) + 1) @@ -351,20 +350,20 @@ let WritePortablePdbInfo fixupSPs showTimes fpdb (info:PdbData) = for localVariable in scope.Locals do lastLocalVariableHandle <- metadata.AddLocalVariable(LocalVariableAttributes.None, localVariable.Index, metadata.GetString(localVariable.Name)) scope.Children |> Array.iter (writePdbScope false) - + writePdbScope true minfo.RootScope metadata.AddMethodDebugInformation(docHandle, sequencePointBlob) |> ignore) - + let entryPoint = match info.EntryPoint with | None -> MetadataTokens.MethodDefinitionHandle(0) | Some x -> MetadataTokens.MethodDefinitionHandle(x) - + let pdbContentId = ContentId(info.ModuleID, BitConverter.GetBytes(info.Timestamp)) let serializer = StandaloneDebugMetadataSerializer(metadata, externalRowCounts, entryPoint, false) let blobBuilder = new BlobBuilder() - let _metadataContentId = serializer.SerializeMetadata(blobBuilder, (fun builder -> pdbContentId)) - + serializer.SerializeMetadata(blobBuilder, (fun builder -> pdbContentId)) |> ignore + reportTime showTimes "PDB: Created" use portablePdbStream = new FileStream(fpdb, FileMode.Create, FileAccess.ReadWrite) blobBuilder.WriteContentTo(portablePdbStream) diff --git a/src/absil/ilwritepdb.fsi b/src/absil/ilwritepdb.fsi index f8487f68a7d..18b9bdb4e18 100644 --- a/src/absil/ilwritepdb.fsi +++ b/src/absil/ilwritepdb.fsi @@ -75,7 +75,6 @@ val DumpDebugInfo : string -> PdbData -> unit val WriteMdbInfo<'a> : string -> string -> PdbData -> 'a #endif -//#if FX_PORTABLEPDB_WRITER type idd = { iddCharacteristics: int32; iddMajorVersion: int32; (* actually u16 in IMAGE_DEBUG_DIRECTORY *) @@ -84,7 +83,6 @@ type idd = iddData: byte[]; } val WritePortablePdbInfo : fixupOverlappingSequencePoints:bool -> showTimes:bool -> fpdb:string -> info:PdbData -> idd -//#endif #if !FX_NO_PDB_WRITER val WritePdbInfo : fixupOverlappingSequencePoints:bool -> showTimes:bool -> f:string -> fpdb:string -> info:PdbData -> idd diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index c22bb8028cc..9fc1c17c8f0 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -478,7 +478,7 @@ let SetDebugSwitch (tcConfigB : TcConfigBuilder) (dtype : string option) (s : Op match dtype with | Some(s) -> match s with - | "portable" -> tcConfigB.jitTracking <- true; tcConfigB.portable <- true + | "portable" -> tcConfigB.jitTracking <- false; tcConfigB.portable <- true | "pdbonly" -> tcConfigB.jitTracking <- false; tcConfigB.portable <- false | "full" -> tcConfigB.jitTracking <- true; tcConfigB.portable <- false | _ -> error(Error(FSComp.SR.optsUnrecognizedDebugType(s), rangeCmdArgs)) diff --git a/src/fsharp/FSharp.Build/Fsc.fs b/src/fsharp/FSharp.Build/Fsc.fs index 3f27159e9af..69c01ba3e09 100644 --- a/src/fsharp/FSharp.Build/Fsc.fs +++ b/src/fsharp/FSharp.Build/Fsc.fs @@ -168,7 +168,7 @@ type [: Emit debugging information + // --debug : Emit debugging information member fsc.DebugType with get() = debugType and set(s) = debugType <- s @@ -384,9 +384,10 @@ type [ null + | "PORTABLE" -> "portable" | "PDBONLY" -> "pdbonly" | "FULL" -> "full" - | _ -> null) + | _ -> null) // NoFramework if noFramework then builder.AppendSwitch("--noframework") diff --git a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl index bbb562c8545..b9cdeedccad 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsc/help/help40.437.1033.bsl @@ -49,9 +49,10 @@ Copyright (c) Microsoft Corporation. All Rights Reserved. - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) ---debug:{full|pdbonly} Specify debugging type: full, pdbonly. ('full' - is the default and enables attaching a debugger - to a running program). +--debug:{full|pdbonly|portable} Specify debugging type: full, portable, pdbonly. + ('full' is the default and enables attaching a + debugger to a running program. 'portable' is a + cross-platform format). --optimize[+|-] Enable optimizations (Short form: -O) --tailcalls[+|-] Enable or disable tailcalls --crossoptimize[+|-] Enable or disable cross-module optimizations diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help-nologo.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help-nologo.437.1033.bsl index c94df3cff43..fef422e77b2 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help-nologo.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help-nologo.437.1033.bsl @@ -12,9 +12,10 @@ Usage: fsi.exe [script.fsx []] - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) ---debug:{full|pdbonly} Specify debugging type: full, pdbonly. ('full' - is the default and enables attaching a debugger - to a running program). +--debug:{full|pdbonly|portable} Specify debugging type: full, portable, pdbonly. + ('full' is the default and enables attaching a + debugger to a running program. 'portable' is a + cross-platform format). --optimize[+|-] Enable optimizations (Short form: -O) --tailcalls[+|-] Enable or disable tailcalls --crossoptimize[+|-] Enable or disable cross-module optimizations diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help.437.1033.bsl index 21500f6a7dd..19560e30d6e 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help.437.1033.bsl @@ -14,9 +14,10 @@ Usage: fsi.exe [script.fsx []] - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) ---debug:{full|pdbonly} Specify debugging type: full, pdbonly. ('full' - is the default and enables attaching a debugger - to a running program). +--debug:{full|pdbonly|portable} Specify debugging type: full, portable, pdbonly. + ('full' is the default and enables attaching a + debugger to a running program. 'portable' is a + cross-platform format). --optimize[+|-] Enable optimizations (Short form: -O) --tailcalls[+|-] Enable or disable tailcalls --crossoptimize[+|-] Enable or disable cross-module optimizations diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl index 0c35361c59d..1f3c40955f3 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40-nologo.437.1033.bsl @@ -12,9 +12,10 @@ Usage: Fsi.exe [script.fsx []] - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) ---debug:{full|pdbonly} Specify debugging type: full, pdbonly. ('full' - is the default and enables attaching a debugger - to a running program). +--debug:{full|pdbonly|portable} Specify debugging type: full, portable, pdbonly. + ('full' is the default and enables attaching a + debugger to a running program. 'portable' is a + cross-platform format). --optimize[+|-] Enable optimizations (Short form: -O) --tailcalls[+|-] Enable or disable tailcalls --crossoptimize[+|-] Enable or disable cross-module optimizations diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl index 79c4b942707..7863c44e924 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/help/help40.437.1033.bsl @@ -14,9 +14,10 @@ Usage: Fsi.exe [script.fsx []] - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) ---debug:{full|pdbonly} Specify debugging type: full, pdbonly. ('full' - is the default and enables attaching a debugger - to a running program). +--debug:{full|pdbonly|portable} Specify debugging type: full, portable, pdbonly. + ('full' is the default and enables attaching a + debugger to a running program. 'portable' is a + cross-platform format). --optimize[+|-] Enable optimizations (Short form: -O) --tailcalls[+|-] Enable or disable tailcalls --crossoptimize[+|-] Enable or disable cross-module optimizations diff --git a/tests/fsharpqa/Source/test.lst b/tests/fsharpqa/Source/test.lst index 624a477c9d2..3181d2994d0 100644 --- a/tests/fsharpqa/Source/test.lst +++ b/tests/fsharpqa/Source/test.lst @@ -40,7 +40,7 @@ CompilerOptions01,NoMT CompilerOptions\fsc\debug CompilerOptions01,NoMT CompilerOptions\fsc\dumpAllCommandLineOptions CompilerOptions01,NoMT CompilerOptions\fsc\flaterrors CompilerOptions02,NoMT CompilerOptions\fsc\gccerrors -CompilerOptions01,NoMT CompilerOptions\fsc\help +CompilerOptions01,NoMT,help CompilerOptions\fsc\help CompilerOptions01,NoMT CompilerOptions\fsc\highentropyva CompilerOptions01,NoMT CompilerOptions\fsc\lib CompilerOptions01,NoMT CompilerOptions\fsc\noframework @@ -61,7 +61,7 @@ CompilerOptions01,NoMT CompilerOptions\fsc\warn CompilerOptions01,NoMT CompilerOptions\fsc\warnaserror CompilerOptions01,NoMT CompilerOptions\fsc\warnon CompilerOptions01,NoMT CompilerOptions\fsc\responsefile -CompilerOptions01,NoMT CompilerOptions\fsi\help +CompilerOptions01,NoMT,help CompilerOptions\fsi\help CompilerOptions01,NoMT CompilerOptions\fsi\highentropyva CompilerOptions01,NoMT CompilerOptions\fsi\nologo CompilerOptions01,NoMT CompilerOptions\fsi\subsystemversion From eb5e797c554e917cddd8e39b6ab9d1457cd00a7f Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Fri, 4 Mar 2016 11:47:19 -0800 Subject: [PATCH 03/11] Update fsi add exename test baseline to include portable pdb switch --- .../Source/CompilerOptions/fsi/exename/help40.437.1033.bsl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl b/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl index ed3ddc1c1e1..a18d704a47a 100644 --- a/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl +++ b/tests/fsharpqa/Source/CompilerOptions/fsi/exename/help40.437.1033.bsl @@ -12,9 +12,10 @@ Usage: fsharpi [script.fsx []] - CODE GENERATION - --debug[+|-] Emit debug information (Short form: -g) ---debug:{full|pdbonly} Specify debugging type: full, pdbonly. ('full' - is the default and enables attaching a debugger - to a running program). +--debug:{full|pdbonly|portable} Specify debugging type: full, portable, pdbonly. + ('full' is the default and enables attaching a + debugger to a running program. 'portable' is a + cross-platform format). --optimize[+|-] Enable optimizations (Short form: -O) --tailcalls[+|-] Enable or disable tailcalls --crossoptimize[+|-] Enable or disable cross-module optimizations From 0796ce438eefd26b6327a3fc2211a8ebf32a4a61 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Fri, 4 Mar 2016 15:43:39 -0800 Subject: [PATCH 04/11] Remove linger fsharp.core from gac early --- build.cmd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.cmd b/build.cmd index 98ca1a8adc2..184eb731962 100644 --- a/build.cmd +++ b/build.cmd @@ -173,6 +173,9 @@ echo BUILD_CONFIG=%BUILD_CONFIG% echo BUILD_CONFIG_LOWERCASE=%BUILD_CONFIG_LOWERCASE% echo. +REM Remove lingering copies of the OSS FSharp.Core from the GAC +gacutil /u "FSharp.Core, Version=4.4.1.9055, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" + if "%RestorePackages%"=="" ( set RestorePackages=true ) @@ -325,9 +328,6 @@ if '%BUILD_VS%' == '1' ( @echo on call src\update.cmd %BUILD_CONFIG_LOWERCASE% -ngen -REM Remove lingering copies of the OSS FSharp.Core from the GAC -gacutil /u "FSharp.Core, Version=4.4.1.9055, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" - REM This clobbers the installed F# SDK on the machine REM call vsintegration\update-vsintegration.cmd %BUILD_CONFIG_LOWERCASE% pushd tests From 9a0d15bc7f407415676e73dc7372bcff2c5518dd Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Sun, 6 Mar 2016 21:06:09 -0800 Subject: [PATCH 05/11] Feedback --- src/absil/ilwrite.fs | 12 +- src/absil/ilwrite.fsi | 2 +- src/absil/ilwritepdb.fs | 110 +++++++++---------- src/fsharp/CompileOps.fs | 6 +- src/fsharp/CompileOps.fsi | 4 +- src/fsharp/CompileOptions.fs | 10 +- src/fsharp/FSharp.Compiler/project.lock.json | 12 +- src/fsharp/fsc.fs | 2 +- 8 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/absil/ilwrite.fs b/src/absil/ilwrite.fs index e5eec424431..989ce5840b2 100644 --- a/src/absil/ilwrite.fs +++ b/src/absil/ilwrite.fs @@ -103,7 +103,7 @@ let getUncodedToken (tab:TableName) idx = ((tab.Index <<< 24) ||| idx) // From ECMA for UserStrings: // This final byte holds the value 1 if and only if any UTF16 character within the string has any bit set in its top byte, or its low byte is any of the following: -// 0x01�0x08, 0x0E�0x1F, 0x27, 0x2D, +// 0x01-0x08, 0x0E-0x1F, 0x27, 0x2D, // 0x7F. Otherwise, it holds 0. The 1 signifies Unicode characters that require handling beyond that normally provided for 8-bit encoding sets. // HOWEVER, there is a discrepancy here between the ECMA spec and the Microsoft C# implementation. The code below follows the latter. We�ve raised the issue with both teams. See Dev10 bug 850073 for details. @@ -3564,7 +3564,7 @@ let writeDirectory os dict = let writeBytes (os: BinaryWriter) (chunk:byte[]) = os.Write(chunk,0,chunk.Length) -let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: ILStrongNameSigner option, portable, +let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: ILStrongNameSigner option, portablePDB, fixupOverlappingSequencePoints, emitTailcalls, showTimes, dumpDebugInfo) modul noDebugData = // Store the public key from the signer into the manifest. This means it will be written // to the binary and also acts as an indicator to leave space for delay sign @@ -4190,10 +4190,10 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: try let idd = #if FX_NO_PDB_WRITER - ignore portable + ignore portablePDB WritePortablePdbInfo fixupOverlappingSequencePoints showTimes fpdb pdbData #else - if portable then + if portablePDB then WritePortablePdbInfo fixupOverlappingSequencePoints showTimes fpdb pdbData else WritePdbInfo fixupOverlappingSequencePoints showTimes outfile fpdb pdbData @@ -4252,7 +4252,7 @@ let writeBinaryAndReportMappings (outfile, ilg, pdbfile: string option, signer: type options = { ilg: ILGlobals; pdbfile: string option - portable: bool + portablePDB: bool signer: ILStrongNameSigner option fixupOverlappingSequencePoints: bool emitTailcalls : bool @@ -4261,7 +4261,7 @@ type options = let WriteILBinary (outfile, (args: options), modul, noDebugData) = - ignore (writeBinaryAndReportMappings (outfile, args.ilg, args.pdbfile, args.signer, args.portable, + ignore (writeBinaryAndReportMappings (outfile, args.ilg, args.pdbfile, args.signer, args.portablePDB, args.fixupOverlappingSequencePoints, args.emitTailcalls, args.showTimes, args.dumpDebugInfo) modul noDebugData) diff --git a/src/absil/ilwrite.fsi b/src/absil/ilwrite.fsi index 10606ae5ac0..771b7d483ab 100644 --- a/src/absil/ilwrite.fsi +++ b/src/absil/ilwrite.fsi @@ -18,7 +18,7 @@ type ILStrongNameSigner = type options = { ilg: ILGlobals pdbfile: string option - portable: bool + portablePDB: bool signer : ILStrongNameSigner option fixupOverlappingSequencePoints : bool emitTailcalls: bool diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index f4d30cb7f04..7b8b6d88651 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -2,6 +2,13 @@ module internal Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter +open System +open System.Collections.Immutable +open System.Reflection +open System.Reflection.Metadata +open System.Reflection.Metadata.Ecma335 +open System.Reflection.Metadata.Ecma335.Blobs +open System.Reflection.PortableExecutable open Internal.Utilities open Microsoft.FSharp.Compiler.AbstractIL open Microsoft.FSharp.Compiler.AbstractIL.ILAsciiWriter @@ -91,14 +98,6 @@ type PdbData = //--------------------------------------------------------------------- // Portable PDB Writer //--------------------------------------------------------------------- -open System -open System.Reflection -open System.Reflection.Metadata -open System.Reflection.Metadata.Ecma335 -open System.Reflection.Metadata.Ecma335.Blobs -open System.Reflection.PortableExecutable -open System.Collections.Generic -open System.Collections.Immutable type idd = { iddCharacteristics: int32; @@ -176,8 +175,9 @@ let fixupOverlappingSequencePoints fixupSPs showTimes methods = // length of all sequence point marks so they do not go further than // the next sequence point in the source. let spCounts = methods |> Array.map (fun x -> x.SequencePoints.Length) - let allSps = Array.concat (Array.map (fun x -> x.SequencePoints) methods |> Array.toList) - let allSps = Array.mapi (fun i sp -> (i,sp)) allSps + let allSps = methods |> Array.map (fun x -> x.SequencePoints) + |> Array.concat + |> Array.mapi (fun i sp -> i, sp) if fixupSPs then // sort the sequence points into source order Array.sortInPlaceWith (fun (_,sp1) (_,sp2) -> SequencePoint.orderBySource sp1 sp2) allSps @@ -198,7 +198,9 @@ let fixupOverlappingSequencePoints fixupSPs showTimes methods = spCounts, allSps let WritePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) = + try FileSystem.FileDelete fpdb with _ -> () + sortMethods showTimes info let _spCounts, _allSps = fixupOverlappingSequencePoints fixupSPs showTimes info.Methods let externalRowCounts = GetRowCounts info.TableRowCounts @@ -207,43 +209,44 @@ let WritePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) = Array.empty else info.Documents - + let metadata = MetadataBuilder() let serializeDocumentName (name:string) = let count s c = s |> Seq.filter(fun ch -> if c = ch then true else false) |> Seq.length - + let s1, s2 = '/', '\\' let separator = if (count name s1) >= (count name s2) then s1 else s2 let writer = new BlobBuilder() writer.WriteByte(byte(separator)) - + for part in name.Split( [| separator |] ) do let partIndex = MetadataTokens.GetHeapOffset(BlobHandle.op_Implicit(metadata.GetBlobUtf8(part))) writer.WriteCompressedInteger(int(partIndex)) - + metadata.GetBlob(writer); - + let corSymLanguageTypeFSharp = System.Guid(0xAB4F38C9u, 0xB6E6us, 0x43baus, 0xBEuy, 0x3Buy, 0x58uy, 0x08uy, 0x0Buy, 0x2Cuy, 0xCCuy, 0xE3uy) let documentIndex = - let mutable index = new Dictionary() + let mutable index = new Dictionary(docs.Length) metadata.SetCapacity(TableIndex.Document, docs.Length) for doc in docs do let handle = match checkSum doc.File with | Some (hashAlg, checkSum) -> - metadata.AddDocument(serializeDocumentName doc.File, - metadata.GetGuid(hashAlg), - metadata.GetBlob(checkSum.ToImmutableArray()), - metadata.GetGuid(corSymLanguageTypeFSharp)) + serializeDocumentName doc.File, + metadata.GetGuid(hashAlg), + metadata.GetBlob(checkSum.ToImmutableArray()), + metadata.GetGuid(corSymLanguageTypeFSharp) | None -> - metadata.AddDocument(serializeDocumentName doc.File, - metadata.GetGuid(System.Guid.Empty), - metadata.GetBlob(ImmutableArray.Empty), - metadata.GetGuid(corSymLanguageTypeFSharp)) + serializeDocumentName doc.File, + metadata.GetGuid(System.Guid.Empty), + metadata.GetBlob(ImmutableArray.Empty), + metadata.GetGuid(corSymLanguageTypeFSharp) + |> metadata.AddDocument index.Add(doc.File, handle) index - + metadata.SetCapacity(TableIndex.MethodDebugInformation, info.Methods.Length) info.Methods |> Array.iteri (fun _i minfo -> let docHandle, sequencePointBlob = @@ -268,7 +271,7 @@ let WritePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) = match documentIndex.TryGetValue(getDocumentName d) with | false, _ -> Unchecked.defaultof | true, f -> f - + let tryGetSingleDocumentIndex = let mutable singleDocumentIndex = 0 for i in 1 .. sps.Length - 1 do @@ -276,22 +279,21 @@ let WritePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) = if index <> singleDocumentIndex then singleDocumentIndex <- index singleDocumentIndex - + if sps.Length = 0 then Unchecked.defaultof, Unchecked.defaultof else let builder = new BlobBuilder() builder.WriteCompressedInteger(minfo.LocalSignatureToken) - + let mutable previousNonHiddenStartLine = -1 let mutable previousNonHiddenStartColumn = -1 - let mutable previousDocumentIndex = -1 let mutable singleDocumentIndex = tryGetSingleDocumentIndex let mutable currentDocumentIndex = previousDocumentIndex - + for i in 0 .. (sps.Length - 1) do - + if previousDocumentIndex <> currentDocumentIndex then // optional document in header or document record: if previousDocumentIndex <> -1 then @@ -299,29 +301,29 @@ let WritePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) = builder.WriteCompressedInteger(0) builder.WriteCompressedInteger(currentDocumentIndex) previousDocumentIndex <- currentDocumentIndex - + // delta IL offset: if i > 0 then builder.WriteCompressedInteger(sps.[i].Offset - sps.[i - 1].Offset) else builder.WriteCompressedInteger(sps.[i].Offset) - + // F# does not support hidden sequence points yet !!! // if (sequencePoints[i].IsHidden) // { // builder.WriteInt16(0); // continue; // } - + let deltaLines = sps.[i].EndLine - sps.[i].Line; let deltaColumns = sps.[i].EndColumn - sps.[i].Column; builder.WriteCompressedInteger(deltaLines); - + if deltaLines = 0 then builder.WriteCompressedInteger(deltaColumns) else builder.WriteCompressedSignedInteger(deltaColumns) - + // delta Start Lines & Columns: if previousNonHiddenStartLine < 0 then builder.WriteCompressedInteger(sps.[i].Line) @@ -329,12 +331,12 @@ let WritePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) = else builder.WriteCompressedSignedInteger(sps.[i].Line - previousNonHiddenStartLine) builder.WriteCompressedSignedInteger(sps.[i].Column - previousNonHiddenStartColumn) - + previousNonHiddenStartLine <- sps.[i].Line previousNonHiddenStartColumn <- sps.[i].Column - + getDocumentHandle singleDocumentIndex, metadata.GetBlob(builder) - + // Write the scopes let mutable lastLocalVariableHandle = Unchecked.defaultof let nextHandle handle = MetadataTokens.LocalVariableHandle(MetadataTokens.GetRowNumber(LocalVariableHandle.op_Implicit(handle)) + 1) @@ -350,20 +352,20 @@ let WritePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) = for localVariable in scope.Locals do lastLocalVariableHandle <- metadata.AddLocalVariable(LocalVariableAttributes.None, localVariable.Index, metadata.GetString(localVariable.Name)) scope.Children |> Array.iter (writePdbScope false) - + writePdbScope true minfo.RootScope metadata.AddMethodDebugInformation(docHandle, sequencePointBlob) |> ignore) - + let entryPoint = match info.EntryPoint with | None -> MetadataTokens.MethodDefinitionHandle(0) | Some x -> MetadataTokens.MethodDefinitionHandle(x) - + let pdbContentId = ContentId(info.ModuleID, BitConverter.GetBytes(info.Timestamp)) let serializer = StandaloneDebugMetadataSerializer(metadata, externalRowCounts, entryPoint, false) let blobBuilder = new BlobBuilder() serializer.SerializeMetadata(blobBuilder, (fun builder -> pdbContentId)) |> ignore - + reportTime showTimes "PDB: Created" use portablePdbStream = new FileStream(fpdb, FileMode.Create, FileAccess.ReadWrite) blobBuilder.WriteContentTo(portablePdbStream) @@ -379,7 +381,7 @@ let WritePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) = let WritePdbInfo fixupOverlappingSequencePoints showTimes f fpdb info = try FileSystem.FileDelete fpdb with _ -> () let pdbw = ref Unchecked.defaultof - + try pdbw := pdbInitialize f fpdb with _ -> error(Error(FSComp.SR.ilwriteErrorCreatingPdb(fpdb), rangeCmdArgs)) @@ -495,8 +497,6 @@ let WritePdbInfo fixupOverlappingSequencePoints showTimes f fpdb info = // Support functions for calling 'Mono.CompilerServices.SymbolWriter' // assembly dynamically if it is available to the compiler //--------------------------------------------------------------------- - -open System.Reflection open Microsoft.FSharp.Reflection // Dynamic invoke operator. Implements simple overload resolution based @@ -554,10 +554,10 @@ let WriteMdbInfo fmdb f info = let doc = wr?DefineDocument(doc.File) let unit = wr?DefineCompilationUnit(doc) yield doc, unit |] - + let getDocument i = if i < 0 || i >= Array.length docs then failwith "getDocument: bad doc number" else docs.[i] - + // Sort methods and write them to the MDB file Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods for meth in info.Methods do @@ -570,11 +570,11 @@ let WriteMdbInfo fmdb f info = // NOTE: 'meth.Params' is not needed, Mono debugger apparently reads this from meta-data let _, cue = getDocument mstart.Document wr?OpenMethod(cue, 0, sm) |> ignore - + // Write sequence points for sp in meth.SequencePoints do wr?MarkSequencePoint(sp.Offset, cue?get_SourceFile(), sp.Line, sp.Column, false) - + // Walk through the tree of scopes and write all variables let rec writeScope (scope:PdbMethodScope) = wr?OpenScope(scope.StartOffset) |> ignore @@ -584,11 +584,11 @@ let WriteMdbInfo fmdb f info = writeScope(child) wr?CloseScope(scope.EndOffset) writeScope(meth.RootScope) - + // Finished generating debug information for the curretn method wr?CloseMethod() | _ -> () - + // Finalize - MDB requires the MVID of the generated .NET module let moduleGuid = new System.Guid(info.ModuleID |> Array.map byte) wr?WriteSymbolFile(moduleGuid) @@ -609,7 +609,7 @@ let DumpDebugInfo (outfile:string) (info:PdbData) = fprintfn sw " Type: %A" doc.DocumentType fprintfn sw " Language: %A" doc.Language fprintfn sw " Vendor: %A" doc.Vendor - + // Sort methods (because they are sorted in PDBs/MDBs too) fprintfn sw "\r\nMETHODS" Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods @@ -619,10 +619,10 @@ let DumpDebugInfo (outfile:string) (info:PdbData) = fprintfn sw " Range: %A" (meth.Range |> Option.map (fun (f, t) -> sprintf "[%d,%d:%d] - [%d,%d:%d]" f.Document f.Line f.Column t.Document t.Line t.Column)) fprintfn sw " Points:" - + for sp in meth.SequencePoints do fprintfn sw " - Doc: %d Offset:%d [%d:%d]-[%d-%d]" sp.Document sp.Offset sp.Line sp.Column sp.EndLine sp.EndColumn - + // Walk through the tree of scopes and write all variables fprintfn sw " Scopes:" let rec writeScope offs (scope:PdbMethodScope) = diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 82d881db8b8..1620d62f7ba 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2012,7 +2012,7 @@ type TcConfigBuilder = mutable useOptimizationDataFile : bool mutable useSignatureDataFile : bool mutable jitTracking : bool - mutable portable : bool + mutable portablePDB : bool mutable ignoreSymbolStoreSequencePoints : bool mutable internConstantStrings : bool mutable extraOptimizationIterations : int @@ -2186,7 +2186,7 @@ type TcConfigBuilder = useOptimizationDataFile = false useSignatureDataFile = false jitTracking = true - portable = true + portablePDB = true ignoreSymbolStoreSequencePoints = false internConstantStrings = true extraOptimizationIterations = 0 @@ -2678,7 +2678,7 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) = member x.useOptimizationDataFile = data.useOptimizationDataFile member x.useSignatureDataFile = data.useSignatureDataFile member x.jitTracking = data.jitTracking - member x.portable = data.portable + member x.portablePDB = data.portablePDB member x.ignoreSymbolStoreSequencePoints = data.ignoreSymbolStoreSequencePoints member x.internConstantStrings = data.internConstantStrings member x.extraOptimizationIterations = data.extraOptimizationIterations diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index 78b67a97421..ca86996b66b 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -305,7 +305,7 @@ type TcConfigBuilder = mutable useOptimizationDataFile : bool mutable useSignatureDataFile : bool mutable jitTracking : bool - mutable portable : bool + mutable portablePDB : bool mutable ignoreSymbolStoreSequencePoints : bool mutable internConstantStrings : bool mutable extraOptimizationIterations : int @@ -458,7 +458,7 @@ type TcConfig = member useOptimizationDataFile : bool member useSignatureDataFile : bool member jitTracking : bool - member portable : bool + member portablePDB : bool member ignoreSymbolStoreSequencePoints : bool member internConstantStrings : bool member extraOptimizationIterations : int diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 9fc1c17c8f0..98ac8a72819 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -478,11 +478,11 @@ let SetDebugSwitch (tcConfigB : TcConfigBuilder) (dtype : string option) (s : Op match dtype with | Some(s) -> match s with - | "portable" -> tcConfigB.jitTracking <- false; tcConfigB.portable <- true - | "pdbonly" -> tcConfigB.jitTracking <- false; tcConfigB.portable <- false - | "full" -> tcConfigB.jitTracking <- true; tcConfigB.portable <- false + | "portable" -> tcConfigB.jitTracking <- false; tcConfigB.portablePDB <- true + | "pdbonly" -> tcConfigB.jitTracking <- false; tcConfigB.portablePDB <- false + | "full" -> tcConfigB.jitTracking <- true; tcConfigB.portablePDB <- false | _ -> error(Error(FSComp.SR.optsUnrecognizedDebugType(s), rangeCmdArgs)) - | None -> tcConfigB.jitTracking <- s = OptionSwitch.On; tcConfigB.portable <- false + | None -> tcConfigB.jitTracking <- s = OptionSwitch.On; tcConfigB.portablePDB <- false tcConfigB.debuginfo <- s = OptionSwitch.On let setOutFileName tcConfigB s = @@ -525,7 +525,7 @@ let PrintOptionInfo (tcConfigB:TcConfigBuilder) = printfn " doTLR . . . . . . . . : %+A" tcConfigB.doTLR printfn " doFinalSimplify. . . . : %+A" tcConfigB.doFinalSimplify printfn " jitTracking . . . . . : %+A" tcConfigB.jitTracking - printfn " portable . . . . . . . : %+A" tcConfigB.portable + printfn " portablePDB. . . . . . : %+A" tcConfigB.portablePDB printfn " debuginfo . . . . . . : %+A" tcConfigB.debuginfo printfn " resolutionEnvironment : %+A" tcConfigB.resolutionEnvironment printfn " product . . . . . . . : %+A" tcConfigB.productNameForBannerText diff --git a/src/fsharp/FSharp.Compiler/project.lock.json b/src/fsharp/FSharp.Compiler/project.lock.json index 2636844e130..dc323602347 100644 --- a/src/fsharp/FSharp.Compiler/project.lock.json +++ b/src/fsharp/FSharp.Compiler/project.lock.json @@ -17,7 +17,7 @@ "dependencies": { "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc2-23826" + "System.Reflection.Metadata": "1.2.0-rc3-23811" }, "compile": { "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} @@ -819,7 +819,7 @@ "dependencies": { "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc2-23826" + "System.Reflection.Metadata": "1.2.0-rc3-23811" }, "compile": { "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} @@ -2440,7 +2440,7 @@ "dependencies": { "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc2-23826" + "System.Reflection.Metadata": "1.2.0-rc3-23811" }, "compile": { "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} @@ -4063,7 +4063,7 @@ "dependencies": { "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc2-23826" + "System.Reflection.Metadata": "1.2.0-rc3-23811" }, "compile": { "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} @@ -5870,7 +5870,7 @@ "dependencies": { "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc2-23826" + "System.Reflection.Metadata": "1.2.0-rc3-23811" }, "compile": { "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} @@ -7667,7 +7667,7 @@ ] }, "Microsoft.DiaSymReader.PortablePdb/1.0.0-rc-60301": { - "sha512": "xgkCQFUZQ73Wpqoyt2C3hvSOEnYEDNsHHfffUs6m+UgycITJCz5F1VBnuIUSb3tJ8Oqr8lNDBoWNzukE6Rr+ug==", + "sha512": "kxhV2ONRooXh3bFbOU8DJ9WyOoqFmNYkMWpSAdsa3H9JxmyjbDI/RdKxuqvbczoeBYLrrETXu3Ls3/v+gJp0+w==", "type": "package", "files": [ "Microsoft.DiaSymReader.PortablePdb.1.0.0-rc-60301.nupkg.sha512", diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index 7e3780868e8..c93a105e161 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1761,7 +1761,7 @@ module FileWriter = pdbfile=pdbfile emitTailcalls = tcConfig.emitTailcalls showTimes = tcConfig.showTimes - portable = tcConfig.portable + portablePDB = tcConfig.portablePDB signer = GetSigner signingInfo fixupOverlappingSequencePoints = false dumpDebugInfo = tcConfig.dumpDebugInfo }, From d19cc37d5ccb061c7518ee881290e282e69b4f1a Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Mon, 7 Mar 2016 10:39:18 -0800 Subject: [PATCH 06/11] Remove jittracking support from the compiler --- src/absil/il.fs | 10 +++++----- src/absil/il.fsi | 6 +++--- src/fsharp/CompileOps.fs | 3 --- src/fsharp/CompileOps.fsi | 2 -- src/fsharp/CompileOptions.fs | 13 ++++++------- src/fsharp/FSharp.Compiler/project.lock.json | 12 ++++++------ src/fsharp/fsc.fs | 3 +-- 7 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/absil/il.fs b/src/absil/il.fs index 9d1e40904c0..8a800e64a9b 100755 --- a/src/absil/il.fs +++ b/src/absil/il.fs @@ -4504,17 +4504,17 @@ type ILGlobals with | Some res -> res member this.mkDebuggerStepThroughAttribute() = mkILCustomAttribute this (mkSystemDiagnosticsDebugTypeRef this tname_DebuggerStepThroughAttribute, [], [], []) - member this.mkDebuggableAttribute (jitTracking, jitOptimizerDisabled) = - mkILCustomAttribute this (mkSystemDiagnosticsDebuggableTypeRef this, [this.typ_Bool; this.typ_Bool], [ILAttribElem.Bool jitTracking; ILAttribElem.Bool jitOptimizerDisabled], []) + member this.mkDebuggableAttribute (jitOptimizerDisabled) = + mkILCustomAttribute this (mkSystemDiagnosticsDebuggableTypeRef this, [this.typ_Bool; this.typ_Bool], [ILAttribElem.Bool false; ILAttribElem.Bool jitOptimizerDisabled], []) - member this.mkDebuggableAttributeV2(jitTracking, ignoreSymbolStoreSequencePoints, jitOptimizerDisabled,enableEnC) = + member this.mkDebuggableAttributeV2(ignoreSymbolStoreSequencePoints, jitOptimizerDisabled, enableEnC) = let tref = mkSystemDiagnosticsDebuggableTypeRef this mkILCustomAttribute this (tref,[mkILNonGenericValueTy (tref_DebuggableAttribute_DebuggingModes this)], - [ILAttribElem.Int32( + [ILAttribElem.Int32( (* See System.Diagnostics.DebuggableAttribute.DebuggingModes *) - (if jitTracking then 1 else 0) ||| + (0) ||| (if jitOptimizerDisabled then 256 else 0) ||| (if ignoreSymbolStoreSequencePoints then 2 else 0) ||| (if enableEnC then 4 else 0))],[]) diff --git a/src/absil/il.fsi b/src/absil/il.fsi index cc0cbaa28c7..e66e1afade7 100644 --- a/src/absil/il.fsi +++ b/src/absil/il.fsi @@ -1775,9 +1775,9 @@ type ILGlobals = mutable debuggerTypeProxyAttributeCache : ILAttribute option } with - member mkDebuggableAttribute: bool (* debug tracking *) * bool (* disable JIT optimizations *) -> ILAttribute - /// Some commonly used custom attibutes - member mkDebuggableAttributeV2 : bool (* jitTracking *) * bool (* ignoreSymbolStoreSequencePoints *) * bool (* disable JIT optimizations *) * bool (* enable EnC *) -> ILAttribute + member mkDebuggableAttribute: bool (* disable JIT optimizations *) -> ILAttribute + /// Some commonly used custom attibutes + member mkDebuggableAttributeV2 : bool (* ignoreSymbolStoreSequencePoints *) * bool (* disable JIT optimizations *) * bool (* enable EnC *) -> ILAttribute member mkCompilerGeneratedAttribute : unit -> ILAttribute member mkDebuggerNonUserCodeAttribute : unit -> ILAttribute member mkDebuggerStepThroughAttribute : unit -> ILAttribute diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 1620d62f7ba..5c5a431bd02 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2011,7 +2011,6 @@ type TcConfigBuilder = mutable onlyEssentialOptimizationData : bool mutable useOptimizationDataFile : bool mutable useSignatureDataFile : bool - mutable jitTracking : bool mutable portablePDB : bool mutable ignoreSymbolStoreSequencePoints : bool mutable internConstantStrings : bool @@ -2185,7 +2184,6 @@ type TcConfigBuilder = onlyEssentialOptimizationData = false useOptimizationDataFile = false useSignatureDataFile = false - jitTracking = true portablePDB = true ignoreSymbolStoreSequencePoints = false internConstantStrings = true @@ -2677,7 +2675,6 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) = member x.onlyEssentialOptimizationData = data.onlyEssentialOptimizationData member x.useOptimizationDataFile = data.useOptimizationDataFile member x.useSignatureDataFile = data.useSignatureDataFile - member x.jitTracking = data.jitTracking member x.portablePDB = data.portablePDB member x.ignoreSymbolStoreSequencePoints = data.ignoreSymbolStoreSequencePoints member x.internConstantStrings = data.internConstantStrings diff --git a/src/fsharp/CompileOps.fsi b/src/fsharp/CompileOps.fsi index ca86996b66b..2be6d7cb14b 100644 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -304,7 +304,6 @@ type TcConfigBuilder = mutable onlyEssentialOptimizationData : bool mutable useOptimizationDataFile : bool mutable useSignatureDataFile : bool - mutable jitTracking : bool mutable portablePDB : bool mutable ignoreSymbolStoreSequencePoints : bool mutable internConstantStrings : bool @@ -457,7 +456,6 @@ type TcConfig = member onlyEssentialOptimizationData : bool member useOptimizationDataFile : bool member useSignatureDataFile : bool - member jitTracking : bool member portablePDB : bool member ignoreSymbolStoreSequencePoints : bool member internConstantStrings : bool diff --git a/src/fsharp/CompileOptions.fs b/src/fsharp/CompileOptions.fs index 98ac8a72819..7cd1341e0f5 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -478,11 +478,11 @@ let SetDebugSwitch (tcConfigB : TcConfigBuilder) (dtype : string option) (s : Op match dtype with | Some(s) -> match s with - | "portable" -> tcConfigB.jitTracking <- false; tcConfigB.portablePDB <- true - | "pdbonly" -> tcConfigB.jitTracking <- false; tcConfigB.portablePDB <- false - | "full" -> tcConfigB.jitTracking <- true; tcConfigB.portablePDB <- false + | "portable" -> tcConfigB.portablePDB <- true + | "pdbonly" -> tcConfigB.portablePDB <- false + | "full" -> tcConfigB.portablePDB <- false | _ -> error(Error(FSComp.SR.optsUnrecognizedDebugType(s), rangeCmdArgs)) - | None -> tcConfigB.jitTracking <- s = OptionSwitch.On; tcConfigB.portablePDB <- false + | None -> tcConfigB.portablePDB <- false tcConfigB.debuginfo <- s = OptionSwitch.On let setOutFileName tcConfigB s = @@ -524,7 +524,6 @@ let PrintOptionInfo (tcConfigB:TcConfigBuilder) = printfn " doDetuple . . . . . . : %+A" tcConfigB.doDetuple printfn " doTLR . . . . . . . . : %+A" tcConfigB.doTLR printfn " doFinalSimplify. . . . : %+A" tcConfigB.doFinalSimplify - printfn " jitTracking . . . . . : %+A" tcConfigB.jitTracking printfn " portablePDB. . . . . . : %+A" tcConfigB.portablePDB printfn " debuginfo . . . . . . : %+A" tcConfigB.debuginfo printfn " resolutionEnvironment : %+A" tcConfigB.resolutionEnvironment @@ -915,8 +914,8 @@ let deprecatedFlagsFsc tcConfigB = cliRootFlag tcConfigB; CompilerOption("jit-optimize", tagNone, OptionUnit (fun _ -> tcConfigB.optSettings <- { tcConfigB.optSettings with jitOptUser = Some true }), Some(DeprecatedCommandLineOptionNoDescription("--jit-optimize", rangeCmdArgs)), None); CompilerOption("no-jit-optimize", tagNone, OptionUnit (fun _ -> tcConfigB.optSettings <- { tcConfigB.optSettings with jitOptUser = Some false }), Some(DeprecatedCommandLineOptionNoDescription("--no-jit-optimize", rangeCmdArgs)), None); - CompilerOption("jit-tracking", tagNone, OptionUnit (fun _ -> tcConfigB.jitTracking <- true), Some(DeprecatedCommandLineOptionNoDescription("--jit-tracking", rangeCmdArgs)), None); - CompilerOption("no-jit-tracking", tagNone, OptionUnit (fun _ -> tcConfigB.jitTracking <- false), Some(DeprecatedCommandLineOptionNoDescription("--no-jit-tracking", rangeCmdArgs)), None); + CompilerOption("jit-tracking", tagNone, OptionUnit (fun _ -> () ), Some(DeprecatedCommandLineOptionNoDescription("--jit-tracking", rangeCmdArgs)), None); + CompilerOption("no-jit-tracking", tagNone, OptionUnit (fun _ -> () ), Some(DeprecatedCommandLineOptionNoDescription("--no-jit-tracking", rangeCmdArgs)), None); CompilerOption("progress", tagNone, OptionUnit (fun () -> progress := true), Some(DeprecatedCommandLineOptionNoDescription("--progress", rangeCmdArgs)), None); (compilingFsLibFlag tcConfigB) ; (compilingFsLib20Flag tcConfigB) ; diff --git a/src/fsharp/FSharp.Compiler/project.lock.json b/src/fsharp/FSharp.Compiler/project.lock.json index dc323602347..2636844e130 100644 --- a/src/fsharp/FSharp.Compiler/project.lock.json +++ b/src/fsharp/FSharp.Compiler/project.lock.json @@ -17,7 +17,7 @@ "dependencies": { "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "compile": { "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} @@ -819,7 +819,7 @@ "dependencies": { "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "compile": { "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} @@ -2440,7 +2440,7 @@ "dependencies": { "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "compile": { "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} @@ -4063,7 +4063,7 @@ "dependencies": { "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "compile": { "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} @@ -5870,7 +5870,7 @@ "dependencies": { "Microsoft.DiaSymReader": "1.0.7", "System.Collections.Immutable": "1.1.37", - "System.Reflection.Metadata": "1.2.0-rc3-23811" + "System.Reflection.Metadata": "1.2.0-rc2-23826" }, "compile": { "lib/portable-net45+win8/Microsoft.DiaSymReader.PortablePdb.dll": {} @@ -7667,7 +7667,7 @@ ] }, "Microsoft.DiaSymReader.PortablePdb/1.0.0-rc-60301": { - "sha512": "kxhV2ONRooXh3bFbOU8DJ9WyOoqFmNYkMWpSAdsa3H9JxmyjbDI/RdKxuqvbczoeBYLrrETXu3Ls3/v+gJp0+w==", + "sha512": "xgkCQFUZQ73Wpqoyt2C3hvSOEnYEDNsHHfffUs6m+UgycITJCz5F1VBnuIUSb3tJ8Oqr8lNDBoWNzukE6Rr+ug==", "type": "package", "files": [ "Microsoft.DiaSymReader.PortablePdb.1.0.0-rc-60301.nupkg.sha512", diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index c93a105e161..0ca690f2c70 100644 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1067,7 +1067,7 @@ module MainModuleBuilder = yield! iattrs yield! codegenResults.ilAssemAttrs if Option.isSome pdbfile then - yield (tcGlobals.ilg.mkDebuggableAttributeV2 (tcConfig.jitTracking, tcConfig.ignoreSymbolStoreSequencePoints, disableJitOptimizations, false (* enableEnC *) )) + yield (tcGlobals.ilg.mkDebuggableAttributeV2 (tcConfig.ignoreSymbolStoreSequencePoints, disableJitOptimizations, false (* enableEnC *) )) yield! reflectedDefinitionAttrs ] // Make the manifest of the assembly @@ -1081,7 +1081,6 @@ module MainModuleBuilder = Some { man with Version= Some ver; CustomAttrs = manifestAttrs; DisableJitOptimizations=disableJitOptimizations; - JitTracking= tcConfig.jitTracking; SecurityDecls=secDecls } let resources = From 8c224bb6fc5e16bd267fdbbdce258fe54b491e12 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Mon, 7 Mar 2016 11:21:59 -0800 Subject: [PATCH 07/11] More feedback --- src/absil/ilwritepdb.fs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 7b8b6d88651..1c55787f54a 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -258,20 +258,16 @@ let WritePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) = | None -> Array.empty | Some (_,_) -> minfo.SequencePoints - let getDocumentName i = - if i < 0 || i > docs.Length then - failwith "getDocument: bad doc number" - else - docs.[i].File - let getDocumentHandle d = if docs.Length = 0 || d < 0 || d > docs.Length then Unchecked.defaultof else - match documentIndex.TryGetValue(getDocumentName d) with + match documentIndex.TryGetValue(docs.[d].File) with | false, _ -> Unchecked.defaultof | true, f -> f + // Return a document that the entire method body is declared within. + // If part of the method body is in another document returns nil handle. let tryGetSingleDocumentIndex = let mutable singleDocumentIndex = 0 for i in 1 .. sps.Length - 1 do From 7106d4db0f13e66fa5e7dfbcac76be255f30d646 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Mon, 7 Mar 2016 14:39:46 -0800 Subject: [PATCH 08/11] Clean up some includes --- src/absil/ilwritepdb.fs | 21 +++++---------------- src/absil/ilwritepdb.fsi | 12 ------------ 2 files changed, 5 insertions(+), 28 deletions(-) diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 1c55787f54a..16a37928290 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -3,34 +3,21 @@ module internal Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter open System +open System.Collections.Generic open System.Collections.Immutable +open System.IO open System.Reflection open System.Reflection.Metadata open System.Reflection.Metadata.Ecma335 open System.Reflection.Metadata.Ecma335.Blobs open System.Reflection.PortableExecutable -open Internal.Utilities -open Microsoft.FSharp.Compiler.AbstractIL -open Microsoft.FSharp.Compiler.AbstractIL.ILAsciiWriter open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics -open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types -open Microsoft.FSharp.Compiler.AbstractIL.Internal -open Microsoft.FSharp.Compiler.AbstractIL.Internal.BinaryConstants open Microsoft.FSharp.Compiler.AbstractIL.Internal.Support open Microsoft.FSharp.Compiler.AbstractIL.Internal.Library - -#if FX_NO_CORHOST_SIGNER -open Microsoft.FSharp.Compiler.AbstractIL.Internal.StrongNameSign -#endif - -open Microsoft.FSharp.Compiler.DiagnosticMessage open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Range -open System.Collections.Generic -open System.IO - // -------------------------------------------------------------------- // PDB types // -------------------------------------------------------------------- @@ -374,8 +361,10 @@ let WritePortablePdbInfo (fixupSPs:bool) showTimes fpdb (info:PdbData) = // PDB Writer. The function [WritePdbInfo] abstracts the // imperative calls to the Symbol Writer API. //--------------------------------------------------------------------- -let WritePdbInfo fixupOverlappingSequencePoints showTimes f fpdb info = +let WritePdbInfo fixupOverlappingSequencePoints showTimes f fpdb info = + try FileSystem.FileDelete fpdb with _ -> () + let pdbw = ref Unchecked.defaultof try diff --git a/src/absil/ilwritepdb.fsi b/src/absil/ilwritepdb.fsi index 18b9bdb4e18..463b244b9e4 100644 --- a/src/absil/ilwritepdb.fsi +++ b/src/absil/ilwritepdb.fsi @@ -3,22 +3,10 @@ /// The ILPdbWriter module internal Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter -open Internal.Utilities -open Microsoft.FSharp.Compiler.AbstractIL -open Microsoft.FSharp.Compiler.AbstractIL.ILAsciiWriter open Microsoft.FSharp.Compiler.AbstractIL.IL -open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics -open Microsoft.FSharp.Compiler.AbstractIL.Extensions.ILX.Types -open Microsoft.FSharp.Compiler.AbstractIL.Internal -open Microsoft.FSharp.Compiler.AbstractIL.Internal.BinaryConstants -open Microsoft.FSharp.Compiler.AbstractIL.Internal.Support - -open Microsoft.FSharp.Compiler.DiagnosticMessage open Microsoft.FSharp.Compiler.ErrorLogger open Microsoft.FSharp.Compiler.Range - open System.Collections.Generic -open System.IO type PdbDocumentData = ILSourceDocument From 3dc0d05935d5b5b61e6f22b32ea5796fee0d6802 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Mon, 7 Mar 2016 15:28:25 -0800 Subject: [PATCH 09/11] Some symbol related cleanup --- src/absil/ilsupp.fs | 10 ---------- src/absil/ilsupp.fsi | 5 ----- src/absil/ilwritepdb.fs | 10 ++++++++++ src/absil/ilwritepdb.fsi | 4 ++++ src/fsharp/CompileOps.fs | 18 ++++-------------- 5 files changed, 18 insertions(+), 29 deletions(-) diff --git a/src/absil/ilsupp.fs b/src/absil/ilsupp.fs index 85b4e81da9a..e23a9cd1675 100644 --- a/src/absil/ilsupp.fs +++ b/src/absil/ilsupp.fs @@ -41,16 +41,6 @@ let check _action (hresult) = System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(hresult) //printf "action = %s, hresult = 0x%nx \n" action hresult -// Depending on the configuration, we may want to include the output file extension in the name -// of the debug symbols file. This function takes output file name and returns debug file name. -let getDebugFileName outfile = -#if ENABLE_MONO_SUPPORT - if IL.runningOnMono then - outfile+".mdb" - else -#endif - (Filename.chopExtension outfile)+".pdb" - type PEFileType = X86 | X64 let MAX_PATH = 260 diff --git a/src/absil/ilsupp.fsi b/src/absil/ilsupp.fsi index 006b485a463..44ec65dcc4e 100644 --- a/src/absil/ilsupp.fsi +++ b/src/absil/ilsupp.fsi @@ -20,7 +20,6 @@ val pdbReadClose: PdbReader -> unit val absilWriteGetTimeStamp: unit -> int32 - open System open System.Runtime.InteropServices #if FX_NO_SYMBOLSTORE @@ -37,10 +36,6 @@ open Microsoft.FSharp.Compiler.AbstractIL.IL type IStream = System.Runtime.InteropServices.ComTypes.IStream #endif - -/// Takes the output file name and returns debug file name. -val getDebugFileName: string -> string - /// Unmanaged resource file linker - for native resources (not managed ones). /// The function may be called twice, once with a zero-RVA and /// arbitrary buffer, and once with the real buffer. The size of the diff --git a/src/absil/ilwritepdb.fs b/src/absil/ilwritepdb.fs index 16a37928290..f9d496c0571 100644 --- a/src/absil/ilwritepdb.fs +++ b/src/absil/ilwritepdb.fs @@ -11,6 +11,7 @@ open System.Reflection.Metadata open System.Reflection.Metadata.Ecma335 open System.Reflection.Metadata.Ecma335.Blobs open System.Reflection.PortableExecutable +open Internal.Utilities open Microsoft.FSharp.Compiler.AbstractIL.IL open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics open Microsoft.FSharp.Compiler.AbstractIL.Internal.Support @@ -138,6 +139,15 @@ let checkSum (url:string) = // imperative calls to the Symbol Writer API. //------------------------------------------------------------------------------ +// This function takes output file name and returns debug file name. +let getDebugFileName outfile = +#if ENABLE_MONO_SUPPORT + if IL.runningOnMono then + outfile + ".mdb" + else +#endif + (Filename.chopExtension outfile) + ".pdb" + let sortMethods showTimes info = reportTime showTimes (sprintf "PDB: Defined %d documents" info.Documents.Length) Array.sortInPlaceBy (fun x -> x.MethToken) info.Methods diff --git a/src/absil/ilwritepdb.fsi b/src/absil/ilwritepdb.fsi index 463b244b9e4..acbe2ace0e4 100644 --- a/src/absil/ilwritepdb.fsi +++ b/src/absil/ilwritepdb.fsi @@ -55,6 +55,10 @@ type PdbData = Methods: PdbMethodData[] TableRowCounts: int[] } + +/// Takes the output file name and returns debug file name. +val getDebugFileName: string -> string + /// 28 is the size of the IMAGE_DEBUG_DIRECTORY in ntimage.h val sizeof_IMAGE_DEBUG_DIRECTORY : System.Int32 val DumpDebugInfo : string -> PdbData -> unit diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index 5c5a431bd02..b95f67f64f7 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2265,17 +2265,7 @@ type TcConfigBuilder = (fileNameWithoutExtension baseName) let pdbfile = - if tcConfigB.debuginfo then -#if FX_NO_PDB_WRITER - Some (match tcConfigB.debugSymbolFile with None -> (Filename.chopExtension outfile) + ( -#if ENABLE_MONO_SUPPORT - if runningOnMono then - ".mdb" - else -#endif - ".pdb") | Some f -> f) -#else Some (match tcConfigB.debugSymbolFile with | None -> Microsoft.FSharp.Compiler.AbstractIL.Internal.Support.getDebugFileName outfile #if ENABLE_MONO_SUPPORT @@ -2285,12 +2275,12 @@ type TcConfigBuilder = Microsoft.FSharp.Compiler.AbstractIL.Internal.Support.getDebugFileName outfile #endif | Some f -> f) -#endif elif (tcConfigB.debugSymbolFile <> None) && (not (tcConfigB.debuginfo)) then - error(Error(FSComp.SR.buildPdbRequiresDebug(),rangeStartup)) - else None + error(Error(FSComp.SR.buildPdbRequiresDebug(),rangeStartup)) + else + None tcConfigB.outputFile <- Some(outfile) - outfile,pdbfile,assemblyName + outfile, pdbfile, assemblyName member tcConfigB.TurnWarningOff(m,s:string) = use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind (BuildPhase.Parameter) From 1ad5d6462a801df00e72a4632707ed2b56130048 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Mon, 7 Mar 2016 16:44:54 -0800 Subject: [PATCH 10/11] Fix minor namespace issue --- src/fsharp/CompileOps.fs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsharp/CompileOps.fs b/src/fsharp/CompileOps.fs index b95f67f64f7..2faae2e7ad2 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2267,12 +2267,12 @@ type TcConfigBuilder = let pdbfile = if tcConfigB.debuginfo then Some (match tcConfigB.debugSymbolFile with - | None -> Microsoft.FSharp.Compiler.AbstractIL.Internal.Support.getDebugFileName outfile + | None -> Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter.getDebugFileName outfile #if ENABLE_MONO_SUPPORT | Some _ when runningOnMono -> // On Mono, the name of the debug file has to be ".mdb" so specifying it explicitly is an error warning(Error(FSComp.SR.ilwriteMDBFileNameCannotBeChangedWarning(),rangeCmdArgs)) ; () - Microsoft.FSharp.Compiler.AbstractIL.Internal.Support.getDebugFileName outfile + Microsoft.FSharp.Compiler.AbstractIL.ILPdbWriter.getDebugFileName outfile #endif | Some f -> f) elif (tcConfigB.debugSymbolFile <> None) && (not (tcConfigB.debuginfo)) then From 794a3c48de8db147e4c888e907564cad82c5ab43 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 8 Mar 2016 12:26:15 -0800 Subject: [PATCH 11/11] More cleanup + handle more feedback --- src/absil/il.fs | 10 +++---- src/absil/ildiag.fs | 28 ++----------------- src/absil/ildiag.fsi | 4 --- src/absil/illib.fs | 14 ++++++++++ src/absil/ilread.fs | 7 +++-- .../FSharp.Compiler-proto.fsproj | 12 ++++---- .../FSharp.Compiler/FSharp.Compiler.fsproj | 12 ++++---- .../FSharp.LanguageService.Compiler.fsproj | 12 ++++---- 8 files changed, 43 insertions(+), 56 deletions(-) diff --git a/src/absil/il.fs b/src/absil/il.fs index 8a800e64a9b..088b89157f6 100755 --- a/src/absil/il.fs +++ b/src/absil/il.fs @@ -4512,12 +4512,10 @@ type ILGlobals with let tref = mkSystemDiagnosticsDebuggableTypeRef this mkILCustomAttribute this (tref,[mkILNonGenericValueTy (tref_DebuggableAttribute_DebuggingModes this)], - [ILAttribElem.Int32( - (* See System.Diagnostics.DebuggableAttribute.DebuggingModes *) - (0) ||| - (if jitOptimizerDisabled then 256 else 0) ||| - (if ignoreSymbolStoreSequencePoints then 2 else 0) ||| - (if enableEnC then 4 else 0))],[]) + (* See System.Diagnostics.DebuggableAttribute.DebuggingModes *) + [ILAttribElem.Int32( (if jitOptimizerDisabled then 256 else 0) ||| + (if ignoreSymbolStoreSequencePoints then 2 else 0) ||| + (if enableEnC then 4 else 0))],[]) member this.mkCompilerGeneratedAttribute () = mkILCustomAttribute this (tref_CompilerGeneratedAttribute this, [], [], []) diff --git a/src/absil/ildiag.fs b/src/absil/ildiag.fs index 29524fec595..44d0713c55d 100644 --- a/src/absil/ildiag.fs +++ b/src/absil/ildiag.fs @@ -1,20 +1,16 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -/// Configurable AppDomain-global diagnostics channel for the Abstract IL library -/// -/// REVIEW: review if we should just switch to System.Diagnostics +/// Configurable Diagnostics channel for the Abstract IL library + module internal Microsoft.FSharp.Compiler.AbstractIL.Diagnostics open Internal.Utilities -open Microsoft.FSharp.Compiler.AbstractIL -open Microsoft.FSharp.Compiler.AbstractIL.Internal - let diagnosticsLog = ref (Some stdout) 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 @@ -23,21 +19,3 @@ let dprintfn (fmt: Format<_,_,_,_>) = Printf.kfprintf dflushn (match !diagnosticsLog with None -> System.IO.TextWriter.Null | Some d -> d) fmt let setDiagnosticsChannel s = diagnosticsLog := s - -//--------------------------------------------------------------------- -// Library: ReportTime -//--------------------------------------------------------------------- - -let reportTime = - let tFirst = ref None - let tPrev = ref None - fun showTimes descr -> - if showTimes then - let t = System.Diagnostics.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 - dprintf "ilwrite: TIME %10.3f (total) %10.3f (delta) - %s\n" (t - first) (t - prev) descr - tPrev := Some t - - - diff --git a/src/absil/ildiag.fsi b/src/absil/ildiag.fsi index 02a5fee192b..682cab7bdb1 100644 --- a/src/absil/ildiag.fsi +++ b/src/absil/ildiag.fsi @@ -9,8 +9,6 @@ module internal Microsoft.FSharp.Compiler.AbstractIL.Diagnostics open System.IO -open Microsoft.FSharp.Compiler.AbstractIL -open Microsoft.FSharp.Compiler.AbstractIL.Internal open Microsoft.FSharp.Core.Printf val public setDiagnosticsChannel: TextWriter option -> unit @@ -19,5 +17,3 @@ val public dprintfn: TextWriterFormat<'a> -> 'a val public dprintf: TextWriterFormat<'a> -> 'a val public dprintn: string -> unit - -val reportTime : (bool -> string -> unit) \ No newline at end of file diff --git a/src/absil/illib.fs b/src/absil/illib.fs index 29e9c35a639..1e9cc18341b 100644 --- a/src/absil/illib.fs +++ b/src/absil/illib.fs @@ -9,6 +9,7 @@ open System.Collections open System.Collections.Generic open Internal.Utilities open Internal.Utilities.Collections +open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics // Logical shift right treating int32 as unsigned integer. // Code that uses this should probably be adjusted to use unsigned integer types. @@ -25,6 +26,19 @@ let isNonNull (x : 'T) = match (x :> obj) with null -> false | _ -> true let nonNull msg x = if isNonNull x then x else failwith ("null: " ^ msg) let (===) x y = LanguagePrimitives.PhysicalEquality x y +//--------------------------------------------------------------------- +// Library: ReportTime +//--------------------------------------------------------------------- +let reportTime = + let tFirst = ref None + let tPrev = ref None + fun showTimes descr -> + if showTimes then + let t = System.Diagnostics.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 + dprintf "ilwrite: TIME %10.3f (total) %10.3f (delta) - %s\n" (t - first) (t - prev) descr + tPrev := Some t //------------------------------------------------------------------------- // Library: projections diff --git a/src/absil/ilread.fs b/src/absil/ilread.fs index 41791f34871..041d6bb811f 100644 --- a/src/absil/ilread.fs +++ b/src/absil/ilread.fs @@ -1460,7 +1460,7 @@ let readBlobHeapAsDouble ctxt vidx = fst (sigptrGetDouble (readBlobHeap ctxt vid // (e) the start of the native resources attached to the binary if any // ----------------------------------------------------------------------*) -#if FX_NO_PDB_READER +#if FX_NO_LINKEDRESOURCES let readNativeResources _ctxt = [] #else let readNativeResources ctxt = @@ -3959,10 +3959,11 @@ let mkDefault ilg = pdbPath= None; ilGlobals = ilg } +let ClosePdbReader pdb = #if FX_NO_PDB_READER -let ClosePdbReader _x = () + ignore pdb + () #else -let ClosePdbReader pdb = match pdb with | Some (pdbr,_) -> pdbReadClose pdbr | None -> () diff --git a/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj b/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj index da133952e64..a01b57f9932 100644 --- a/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj +++ b/src/fsharp/FSharp.Compiler-proto/FSharp.Compiler-proto.fsproj @@ -107,6 +107,12 @@ FlatList.fs + + Utilities\ildiag.fsi + + + Utilities\ildiag.fs + illib.fs @@ -134,12 +140,6 @@ bytes.fs - - ildiag.fsi - - - ildiag.fs - ReferenceResolution.fsi diff --git a/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj b/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj index b1bb3fdba64..295911dfcc8 100644 --- a/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj +++ b/src/fsharp/FSharp.Compiler/FSharp.Compiler.fsproj @@ -87,6 +87,12 @@ Utilities\FlatList.fs + + Utilities\ildiag.fsi + + + Utilities\ildiag.fs + Utilities\illib.fs @@ -114,12 +120,6 @@ Utilities\bytes.fs - - Utilities\ildiag.fsi - - - Utilities\ildiag.fs - Utilities\InternalCollections.fsi diff --git a/src/fsharp/FSharp.LanguageService.Compiler/FSharp.LanguageService.Compiler.fsproj b/src/fsharp/FSharp.LanguageService.Compiler/FSharp.LanguageService.Compiler.fsproj index 7ad7b330662..3c453f56238 100644 --- a/src/fsharp/FSharp.LanguageService.Compiler/FSharp.LanguageService.Compiler.fsproj +++ b/src/fsharp/FSharp.LanguageService.Compiler/FSharp.LanguageService.Compiler.fsproj @@ -84,6 +84,12 @@ Utilities\QueueList.fs + + Utilities\ildiag.fsi + + + Utilities\ildiag.fs + Utilities\illib.fs @@ -111,12 +117,6 @@ Utilities\bytes.fs - - Utilities\ildiag.fsi - - - Utilities\ildiag.fs - Utilities\lib.fs