From cc2c9bb9c0ffda12492fe42b991cb1129dba7f78 Mon Sep 17 00:00:00 2001 From: Omar Tawfik Date: Tue, 2 Aug 2016 14:32:41 -0700 Subject: [PATCH] Added jitTracking option to the compiler to enable debugging without warnings --- src/absil/il.fs | 5 +++-- src/absil/il.fsi | 2 +- src/fsharp/CompileOps.fs | 3 +++ src/fsharp/CompileOps.fsi | 2 ++ src/fsharp/CompileOptions.fs | 13 +++++++------ src/fsharp/fsc.fs | 3 ++- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/absil/il.fs b/src/absil/il.fs index 211f6f5a0..c10e80002 100755 --- a/src/absil/il.fs +++ b/src/absil/il.fs @@ -3692,12 +3692,13 @@ type ILGlobals with mkILCustomAttribute this (mkSystemDiagnosticsDebuggableTypeRef this, [this.typ_Bool; this.typ_Bool], [ILAttribElem.Bool false; ILAttribElem.Bool jitOptimizerDisabled], []) - member this.mkDebuggableAttributeV2(ignoreSymbolStoreSequencePoints, jitOptimizerDisabled, enableEnC) = + member this.mkDebuggableAttributeV2(jitTracking, ignoreSymbolStoreSequencePoints, jitOptimizerDisabled, enableEnC) = let tref = mkSystemDiagnosticsDebuggableTypeRef this mkILCustomAttribute this (tref,[mkILNonGenericValueTy (tref_DebuggableAttribute_DebuggingModes this)], (* See System.Diagnostics.DebuggableAttribute.DebuggingModes *) - [ILAttribElem.Int32( (if jitOptimizerDisabled then 256 else 0) ||| + [ILAttribElem.Int32( (if jitTracking then 1 else 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 d61e3c24f..6afa99749 100644 --- a/src/absil/il.fsi +++ b/src/absil/il.fsi @@ -1624,7 +1624,7 @@ type ILGlobals = with 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 mkDebuggableAttributeV2 : bool (* jitTracking *) * 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 a0f9d1f4b..7d8d9a47d 100644 --- a/src/fsharp/CompileOps.fs +++ b/src/fsharp/CompileOps.fs @@ -2063,6 +2063,7 @@ type TcConfigBuilder = mutable onlyEssentialOptimizationData : bool mutable useOptimizationDataFile : bool mutable useSignatureDataFile : bool + mutable jitTracking : bool mutable portablePDB : bool mutable ignoreSymbolStoreSequencePoints : bool mutable internConstantStrings : bool @@ -2232,6 +2233,7 @@ type TcConfigBuilder = onlyEssentialOptimizationData = false useOptimizationDataFile = false useSignatureDataFile = false + jitTracking = true portablePDB = true ignoreSymbolStoreSequencePoints = false internConstantStrings = true @@ -2713,6 +2715,7 @@ 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 28f5d73eb..1d00cd89d 100755 --- a/src/fsharp/CompileOps.fsi +++ b/src/fsharp/CompileOps.fsi @@ -304,6 +304,7 @@ type TcConfigBuilder = mutable onlyEssentialOptimizationData : bool mutable useOptimizationDataFile : bool mutable useSignatureDataFile : bool + mutable jitTracking : bool mutable portablePDB : bool mutable ignoreSymbolStoreSequencePoints : bool mutable internConstantStrings : bool @@ -456,6 +457,7 @@ 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 b63775aa4..ee965f628 100644 --- a/src/fsharp/CompileOptions.fs +++ b/src/fsharp/CompileOptions.fs @@ -474,11 +474,11 @@ let SetDebugSwitch (tcConfigB : TcConfigBuilder) (dtype : string option) (s : Op match dtype with | Some(s) -> match s with - | "portable" -> tcConfigB.portablePDB <- true - | "pdbonly" -> tcConfigB.portablePDB <- false - | "full" -> tcConfigB.portablePDB <- false + | "portable" -> tcConfigB.portablePDB <- true ; tcConfigB.jitTracking <- false + | "pdbonly" -> tcConfigB.portablePDB <- false; tcConfigB.jitTracking <- false + | "full" -> tcConfigB.portablePDB <- false; tcConfigB.jitTracking <- true | _ -> error(Error(FSComp.SR.optsUnrecognizedDebugType(s), rangeCmdArgs)) - | None -> tcConfigB.portablePDB <- false + | None -> tcConfigB.portablePDB <- false; tcConfigB.jitTracking <- s = OptionSwitch.On; tcConfigB.debuginfo <- s = OptionSwitch.On let setOutFileName tcConfigB s = @@ -520,6 +520,7 @@ 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 @@ -910,8 +911,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 _ -> () ), Some(DeprecatedCommandLineOptionNoDescription("--jit-tracking", rangeCmdArgs)), None) - CompilerOption("no-jit-tracking", tagNone, OptionUnit (fun _ -> () ), Some(DeprecatedCommandLineOptionNoDescription("--no-jit-tracking", 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("progress", tagNone, OptionUnit (fun () -> progress := true), Some(DeprecatedCommandLineOptionNoDescription("--progress", rangeCmdArgs)), None) (compilingFsLibFlag tcConfigB) (compilingFsLib20Flag tcConfigB) diff --git a/src/fsharp/fsc.fs b/src/fsharp/fsc.fs index e17bad695..4af99753d 100755 --- a/src/fsharp/fsc.fs +++ b/src/fsharp/fsc.fs @@ -1054,7 +1054,7 @@ module MainModuleBuilder = yield! iattrs yield! codegenResults.ilAssemAttrs if Option.isSome pdbfile then - yield (tcGlobals.ilg.mkDebuggableAttributeV2 (tcConfig.ignoreSymbolStoreSequencePoints, disableJitOptimizations, false (* enableEnC *) )) + yield (tcGlobals.ilg.mkDebuggableAttributeV2 (tcConfig.jitTracking, tcConfig.ignoreSymbolStoreSequencePoints, disableJitOptimizations, false (* enableEnC *) )) yield! reflectedDefinitionAttrs ] // Make the manifest of the assembly @@ -1068,6 +1068,7 @@ module MainModuleBuilder = Some { man with Version= Some ver CustomAttrs = manifestAttrs DisableJitOptimizations=disableJitOptimizations + JitTracking= tcConfig.jitTracking SecurityDecls=secDecls } let resources = -- GitLab