Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,15 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str

$testResultsDir = "$ArtifactsDir\TestResults\$configuration"
$testBinLogPath = "$LogDir\${projectName}_$targetFramework.binlog"

# MTP requires --solution flag for .sln/.slnx files
$testTarget = if ($testProject.EndsWith('.sln') -or $testProject.EndsWith('.slnx')) { "--solution ""$testProject""" } else { "--project ""$testProject""" }

# Xunit XML report via XunitXml.TestLogger with CI-friendly filenames
$jobName = if ($env:SYSTEM_JOBNAME) { $env:SYSTEM_JOBNAME } else { "local" }
$xunitLogFileName = "{assembly}.{framework}.${jobName}.xml"
$reportArgs = "--report-spekt-xunit --report-spekt-xunit-filename ""$xunitLogFileName"""

$test_args = "test $testTarget -c $configuration -f $targetFramework $reportArgs --results-directory ""$testResultsDir"" /bl:$testBinLogPath"
# MTP HangDump extension replaces VSTest --blame-hang-timeout
$test_args += " --hangdump --hangdump-timeout 5m --hangdump-type Full"
Expand All @@ -401,7 +401,7 @@ function TestUsingMSBuild([string] $testProject, [string] $targetFramework, [str
$test_args += " $settings"

Write-Host("$test_args")

Exec-Console $dotnetExe $test_args
}

Expand Down
48 changes: 24 additions & 24 deletions src/Compiler/AbstractIL/ilread.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@

/// Binary reader. Read a .NET binary and concert it to Abstract IL data
/// structures.
///
///
/// NOTE:
/// - The metadata in the loaded modules will be relative to
/// those modules, e.g. ILScopeRef.Local will mean "local to
/// that module". You must use [rescopeILType] etc. if you want to include
/// (i.e. copy) the metadata into your own module.
/// - The metadata in the loaded modules will be relative to
/// those modules, e.g. ILScopeRef.Local will mean "local to
/// that module". You must use [rescopeILType] etc. if you want to include
/// (i.e. copy) the metadata into your own module.
///
/// - PDB (debug info) reading/folding:
/// The PDB reader is invoked if you give a PDB path
/// This indicates if you want to search for PDB files and have the
/// reader fold them in. You cannot currently name the pdb file
/// directly - you can only name the path. Giving "None" says
/// "do not read the PDB file even if one exists".
///
/// The debug info appears primarily as I_seqpoint annotations in
/// The PDB reader is invoked if you give a PDB path
/// This indicates if you want to search for PDB files and have the
/// reader fold them in. You cannot currently name the pdb file
/// directly - you can only name the path. Giving "None" says
/// "do not read the PDB file even if one exists".
///
/// The debug info appears primarily as I_seqpoint annotations in
/// the instruction streams. Unfortunately the PDB information does
/// not, for example, tell you how to map back from a class definition
/// to a source code line number - you will need to explicitly search
/// for a sequence point in the code for one of the methods of the
/// for a sequence point in the code for one of the methods of the
/// class. That is not particularly satisfactory, and it may be
/// a good idea to build a small library which extracts the information
/// you need.
module FSharp.Compiler.AbstractIL.ILBinaryReader
/// you need.
module FSharp.Compiler.AbstractIL.ILBinaryReader

open System.IO
open FSharp.Compiler.AbstractIL.IL
open FSharp.Compiler.AbstractIL.IL

/// Used to implement a Binary file over native memory, used by Roslyn integration
type ILReaderMetadataSnapshot = obj * nativeint * int
type ILReaderMetadataSnapshot = obj * nativeint * int
type ILReaderTryGetMetadataSnapshot = (* path: *) string * (* snapshotTimeStamp: *) System.DateTime -> ILReaderMetadataSnapshot option

[<RequireQualifiedAccess>]
Expand Down Expand Up @@ -64,29 +64,29 @@ type ILReaderOptions =
type public ILModuleReader =
abstract ILModuleDef: ILModuleDef
abstract ILAssemblyRefs: ILAssemblyRef list

// ILModuleReader objects only need to be explicitly disposed if memory mapping is used, i.e. reduceMemoryUsage = false
inherit System.IDisposable


/// Open a binary reader, except first copy the entire contents of the binary into
/// memory, close the file and ensure any subsequent reads happen from the in-memory store.
/// PDB files may not be read with this option.
/// Open a binary reader, except first copy the entire contents of the binary into
/// memory, close the file and ensure any subsequent reads happen from the in-memory store.
/// PDB files may not be read with this option.
/// Binary reader is internally cached.
val internal OpenILModuleReader: string -> ILReaderOptions -> ILModuleReader

val internal ClearAllILModuleReaderCache : unit -> unit

/// Open a binary reader based on the given bytes.
/// Open a binary reader based on the given bytes.
/// This binary reader is not internally cached.
val internal OpenILModuleReaderFromBytes: fileName:string -> assemblyContents: byte[] -> options: ILReaderOptions -> ILModuleReader

/// Open a binary reader based on the given stream.
/// Open a binary reader based on the given stream.
/// This binary reader is not internally cached.
/// The binary reader will own the given stream and the stream will be disposed when there are no references to the binary reader.
val internal OpenILModuleReaderFromStream: fileName:string -> peStream: Stream -> options: ILReaderOptions -> ILModuleReader

type internal Statistics =
type internal Statistics =
{ mutable rawMemoryFileCount : int
mutable memoryMapFileOpenedCount : int
mutable memoryMapFileClosedCount : int
Expand Down
58 changes: 29 additions & 29 deletions src/Compiler/AbstractIL/ilwrite.fs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ type cenv =

emitTailcalls: bool

deterministic: bool
deterministic: bool

desiredMetadataVersion: ILVersionInfo

Expand Down Expand Up @@ -691,7 +691,7 @@ let GetTypeNameAsElemPair cenv n =

let rec GenTypeDefPass1 enc cenv (tdef: ILTypeDef) =
ignore (cenv.typeDefs.AddUniqueEntry "type index" (fun (TdKey (_, n)) -> n) (TdKey (enc, tdef.Name)))

// Verify that the typedef contains fewer than maximumMethodsPerDotNetType
let count = tdef.Methods.AsArray().Length
if count > maximumMethodsPerDotNetType then
Expand Down Expand Up @@ -1101,7 +1101,7 @@ let GetMemberAccessFlags access =

exception MethodDefNotFound

let private MethodDefIdxExists cenv (mref: ILMethodRef) =
let private MethodDefIdxExists cenv (mref: ILMethodRef) =
let tref = mref.DeclaringTypeRef
if not (isTypeRefLocal tref) then
// Method referred to by method impl, event or property is not in a type defined in this module.
Expand Down Expand Up @@ -1328,7 +1328,7 @@ and GenTypeDefPass2 pidx enc cenv (tdef: ILTypeDef) =
// Now generate or assign index numbers for tables referenced by the maps.
// Don't yet generate contents of these tables - leave that to pass3, as
// code may need to embed these entries.
cenv.implementsIdxs[tidx] <- tdef.Implements.Value |> List.map (fun x -> GenImplementsPass2 cenv env tidx x.Type)
cenv.implementsIdxs[tidx] <- tdef.Implements.Value |> List.map (fun x -> GenImplementsPass2 cenv env tidx x.Type)

tdef.Fields.AsList() |> List.iter (GenFieldDefPass2 tdef cenv tidx)
tdef.Methods |> Seq.iter (GenMethodDefPass2 tdef cenv tidx)
Expand Down Expand Up @@ -1601,7 +1601,7 @@ type ExceptionClauseSpec = int * int * int * int * ExceptionClauseKind

/// Arbitrary value
[<Literal>]
let CodeBufferCapacity = 200
let CodeBufferCapacity = 200

/// Buffer to write results of emitting code into. Also record:
/// - branch sources (where fixups will occur)
Expand Down Expand Up @@ -2189,7 +2189,7 @@ module Codebuf =
StartOffset=startOffset
EndOffset=endOffset
Locals=
[| for x in ls do
[| for x in ls do
if x.LocalName <> "" then
{ Name=x.LocalName
Signature= (try localSigs[x.LocalIndex] with _ -> failwith ("local variable index "+string x.LocalIndex+"in debug info does not reference a valid local"))
Expand Down Expand Up @@ -2338,12 +2338,12 @@ module Codebuf =
applyBrFixups origCode origExnClauses origReqdStringFixups origAvailBrFixups origReqdBrFixups origSeqPoints origScopes

let rootScope =
{
{
Children= Array.ofList newScopes
StartOffset=0
EndOffset=newCode.Length
Locals=[| |]
Imports = importScope
Locals=[| |]
Imports = importScope
}

(newReqdStringFixups, newExnClauses, newCode, newSeqPoints, rootScope)
Expand All @@ -2357,7 +2357,7 @@ let GetFieldDefTypeAsBlobIdx cenv env ty =
GetBytesAsBlobIdx cenv bytes

let GenPdbImport (cenv: cenv) (input: ILDebugImport) =
match input with
match input with
| ILDebugImport.ImportType ty ->
let tspec = ty.TypeSpec
let tok = getTypeInfoAsTypeDefOrRefEncoded cenv (tspec.Scope, tspec.Enclosing, tspec.Name)
Expand All @@ -2366,13 +2366,13 @@ let GenPdbImport (cenv: cenv) (input: ILDebugImport) =
| ILDebugImport.ImportNamespace nsp -> PdbImport.ImportNamespace nsp

let rec GenPdbImports (cenv: cenv) (input: ILDebugImports option) =
match input with
match input with
| None -> None
| Some ilImports ->
| Some ilImports ->
match cenv.pdbImports.TryGetValue(ilImports) with
| true, v -> Some v
| _ ->
let v : PdbImports =
let v : PdbImports =
{ Imports = ilImports.Imports |> Array.map (GenPdbImport cenv)
Parent = GenPdbImports cenv ilImports.Parent }
cenv.pdbImports[ilImports] <- v
Expand Down Expand Up @@ -2541,7 +2541,7 @@ let rec GetGenericParamAsGenericParamRow cenv _env idx owner gp =
(if gp.HasNotNullableValueTypeConstraint then 0x0008 else 0x0000) |||
(if gp.HasDefaultConstructorConstraint then 0x0010 else 0x0000) |||
(if gp.HasAllowsRefStruct then 0x0020 else 0x0000)


let mdVersionMajor, _ = metadataSchemaVersionSupportedByCLRVersion cenv.desiredMetadataVersion
if (mdVersionMajor = 1) then
Expand Down Expand Up @@ -3113,7 +3113,7 @@ let generateIL (
generatePdb,
ilg: ILGlobals,
emitTailcalls,
deterministic,
deterministic,
referenceAssemblyOnly,
referenceAssemblyAttribOpt: ILAttribute option,
allGivenSources,
Expand Down Expand Up @@ -3154,7 +3154,7 @@ let generateIL (
MetadataTable.Unshared (MetadataTable<UnsharedRow>.New ("row table "+string i, EqualityComparer.Default)))
use cenv =
{ emitTailcalls=emitTailcalls
deterministic = deterministic
deterministic = deterministic
ilg = ilg
desiredMetadataVersion=desiredMetadataVersion
requiredDataFixups= requiredDataFixups
Expand Down Expand Up @@ -3271,7 +3271,7 @@ let writeILMetadataAndCode (
desiredMetadataVersion,
ilg,
emitTailcalls,
deterministic,
deterministic,
referenceAssemblyOnly,
referenceAssemblyAttribOpt,
allGivenSources,
Expand All @@ -3293,7 +3293,7 @@ let writeILMetadataAndCode (
generatePdb,
ilg,
emitTailcalls,
deterministic,
deterministic,
referenceAssemblyOnly,
referenceAssemblyAttribOpt,
allGivenSources,
Expand Down Expand Up @@ -3742,7 +3742,7 @@ let writeDirectory os dict =
let writeBytes (os: BinaryWriter) (chunk: byte[]) = os.Write(chunk, 0, chunk.Length)

let writePdb (
dumpDebugInfo,
dumpDebugInfo,
embeddedPDB,
pdbfile,
outfile,
Expand Down Expand Up @@ -3842,7 +3842,7 @@ let writePdb (
failwith ("Error while writing debug directory entry: " + exn.Message)
(try os2.Dispose(); FileSystem.FileDeleteShim outfile with _ -> ())
reraise()

reportTime "Finish"
pdbBytes

Expand All @@ -3859,7 +3859,7 @@ type options =
checksumAlgorithm: HashAlgorithm
signer: ILStrongNameSigner option
emitTailcalls: bool
deterministic: bool
deterministic: bool
dumpDebugInfo: bool
referenceAssemblyOnly: bool
referenceAssemblyAttribOpt: ILAttribute option
Expand Down Expand Up @@ -3991,7 +3991,7 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe
desiredMetadataVersion,
ilg,
options.emitTailcalls,
options.deterministic,
options.deterministic,
options.referenceAssemblyOnly,
options.referenceAssemblyAttribOpt,
options.allGivenSources,
Expand Down Expand Up @@ -4205,16 +4205,16 @@ let writeBinaryAux (stream: Stream, options: options, modul, normalizeAssemblyRe
| HashAlgorithm.Sha256 -> System.Security.Cryptography.SHA256.Create() :> System.Security.Cryptography.HashAlgorithm

let hCode = sha.ComputeHash code
let hData = sha.ComputeHash data
// Not yet suitable for the mvidsection optimization
let hData = sha.ComputeHash data
// Not yet suitable for the mvidsection optimization

let deterministicId =
let deterministicId =
[| hCode
hData
match options.referenceAssemblyOnly, options.referenceAssemblySignatureHash with
| true, Some impliedSigHash -> BitConverter.GetBytes(impliedSigHash)
| _ -> sha.ComputeHash metadata |]
|> Array.collect id
| _ -> sha.ComputeHash metadata |]
|> Array.collect id
|> sha.ComputeHash
let deterministicMvid () = deterministicId[0..15]
let pdbData =
Expand Down Expand Up @@ -4608,7 +4608,7 @@ let writeBinaryFiles (options: options, modul, normalizeAssemblyRefs) =
let reopenOutput () =
FileSystem.OpenFileForWriteShim(options.outfile, FileMode.Open, FileAccess.ReadWrite, FileShare.Read)

writePdb (options.dumpDebugInfo,
writePdb (options.dumpDebugInfo,
options.embeddedPDB,
options.pdbfile,
options.outfile,
Expand Down Expand Up @@ -4640,7 +4640,7 @@ let writeBinaryInMemory (options: options, modul, normalizeAssemblyRefs) =
stream

let pdbBytes =
writePdb (options.dumpDebugInfo,
writePdb (options.dumpDebugInfo,
options.embeddedPDB,
options.pdbfile,
options.outfile,
Expand Down
Loading
Loading