Skip to content

Commit 5cb4d92

Browse files
committed
Merge pull request #498 from dsyme/integrate-78
Integrate visualfsharp/master and fsharp/master --> master
2 parents 7fbc190 + 631a0e4 commit 5cb4d92

File tree

11 files changed

+340
-67
lines changed

11 files changed

+340
-67
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ lib/bootstrap/4.0/policy*
99
aclocal.m4
1010
src/*.userprefs
1111
src/fsharp/FSStrings.resources
12-
lkg
1312
packages
1413
src/fsharp/FSharp.Build/*.resx
1514
src/fsharp/FSharp.Build-proto/*.resx

CHANGELOG-fsharp.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
4.0.1.1
2+
* Integrate Microsoft\visualfsharp to 8111c63. See CHANGELOG-visualfsharp.md for changes from Microsoft\visualfsharp
3+
* 04cd959 - fix problem with loop optimization
4+
* d995c59 - Assume we are inside XBuild when 4.5/Mono.Posix.dll exists
5+
* Fix [#483](https://github.com/fsharp/fsharp/issues/483) - Call to Type.GetType for a missing type causes FSI on Mono to produce an erroneous error
6+
7+
4.0.0.4
8+
* Integrate Microsoft\visualfsharp to 2d413fb94. See CHANGELOG.md for changes from Microsoft\visualfsharp
9+
10+
4.0.0.3
11+
* Fix build problems
12+
13+
4.0.0.1
14+
* Integrate F# 4.0
15+
16+
3.1.1.25
17+
* Upstream fix: implement correct version number scheme for new PCL profiles
18+
19+
3.1.1.20
20+
* Upstream fix:: #! treated as a comment when it is at the start of an fsharp file
21+
* Upstream fix visualfsharp.codeplex.com issue #78 - allow space characters in active pattern case identifiers
22+
* Upstream fix visualfsharp.codeplex.com issue #78 - Adjust parser to disallow vertical pipes in active pattern case identifiers.
23+
* Upstream fix for visualfsharp.codeplex.com issue #69 - Invalid code generated when calling C# method with optional nullable args
24+
* Upstream fix for visualfsharp.codeplex.com issue #9 - XML doc comments on F# record type fields do not appear when accessing in C#
25+
26+
3.1.1.19
27+
* Added files for the nuget packages
28+
29+
3.1.1.18
30+
* Do not install FSharp.Build.dll in the GAC. It is not in the GAC on Windows.
31+
32+
3.1.1.17
33+
* Remove service components from FSharp.Compiler.dll since. All clients should now use FSharp.Compiler.Service.dll
34+
35+
3.1.1.15
36+
* Upstream 2d8ebcd43: XmlDoc generation bugfix: remove duplicate namespaces
37+
* Upstream 3bd52625b: Address-of optimizations for better performance on structs
38+
* Upstream c46aa237a: Perf improvement for Seq.windowed
39+
* Upstream 301a6f33: make it possible to set breakpoint inside quotation
40+
* FSharp.Core for portable profiles 7, 78, 259 if reference assemblies are present (delay-signed)
41+
42+
3.1.1.14
43+
* Change monotouch and monodroid FSharp.Core.dll to both use 2.3.98.1
44+
45+
3.1.1.12
46+
* Add build command "all-monotouch-monodroid"
47+
48+
3.1.1.11
49+
50+
* F# Interactive now uses .NET 4.5 profile
51+
* Fix for performance regression in 3.1 with extension members
52+
* Add query support to FSharp.Core portable profiles
53+
* Fix problem with building portable libraries (https://github.com/fsharp/fsharp/issues/299)
54+
55+
3.1.1.10
56+
* Include fixes from Microsoft included with Visual F# Tools 3.1.1
57+
58+
3.1.1.7
59+
* Build back versions of FSharp.Core 2.3.0.0, 2.3.5.0, 4.3.0.0 to include code generation fix.
60+
* Build Profile7 (portable47) FSharp.Core
61+
62+
3.0.30
63+
* Partial fix for allowing F# 3.1 projects to compile using xbuild (also
64+
requires xbuild fix)
65+
66+
* Remove a multitude of links in xbuild directories in favour of targets
67+
files which include the canonical targets
68+
69+
3.0.29
70+
71+
* Proper DESTDIR support (very useful for making custom deb/rpm packages)
72+
73+

CHANGELOG-visualfsharp.md

Lines changed: 231 additions & 0 deletions
Large diffs are not rendered by default.

samples/FsiExe/FsiExe.fsproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@
7474
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets</FSharpTargetsPath>
7575
</PropertyGroup>
7676
<Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')" />
77+
<!--
7778
<Target Name="BeforeBuild">
7879
<Copy SourceFiles="$(MSBuildExtensionsPath32)\..\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\$(TargetFSharpCoreVersion)\FSharp.Core.sigdata" DestinationFolder="$(OutputPath)" Condition="Exists('$(MSBuildExtensionsPath32)\..\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\$(TargetFSharpCoreVersion)\FSharp.Core.sigdata')" />
7980
<Copy SourceFiles="$(MSBuildExtensionsPath32)\..\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\$(TargetFSharpCoreVersion)\FSharp.Core.optdata" DestinationFolder="$(OutputPath)" Condition="Exists('$(MSBuildExtensionsPath32)\..\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\$(TargetFSharpCoreVersion)\FSharp.Core.optdata')" />
8081
<Copy SourceFiles="$(MSBuildExtensionsPath32)\..\lib\mono\4.5\FSharp.Core.dll" DestinationFolder="$(OutputPath)" Condition="Exists('$(MSBuildExtensionsPath32)\..\lib\mono\4.5\FSharp.Core.dll')" />
8182
<Copy SourceFiles="$(MSBuildExtensionsPath32)\..\lib\mono\4.5\FSharp.Core.sigdata" DestinationFolder="$(OutputPath)" Condition="Exists('$(MSBuildExtensionsPath32)\..\lib\mono\4.5\FSharp.Core.sigdata')" />
8283
<Copy SourceFiles="$(MSBuildExtensionsPath32)\..\lib\mono\4.5\FSharp.Core.optdata" DestinationFolder="$(OutputPath)" Condition="Exists('$(MSBuildExtensionsPath32)\..\lib\mono\4.5\FSharp.Core.optdata')" />
8384
</Target>
85+
-->
8486
</Project>

src/absil/ilread.fs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,6 @@ type MemoryMappedFile(hMap: MemoryMapping.HANDLE, start:nativeint) =
225225
type ByteFile(bytes:byte[]) =
226226
inherit BinaryFile()
227227

228-
static member OpenIn f = ByteFile(FileSystem.ReadAllBytesShim f)
229-
static member OpenBytes bytes = ByteFile(bytes)
230-
231228
override mc.ReadByte addr = bytes.[addr]
232229
override mc.ReadBytes addr len = Array.sub bytes addr len
233230
override m.CountUtf8String addr =
@@ -910,6 +907,8 @@ type ILModuleReader =
910907
dispose: unit -> unit }
911908
member x.ILModuleDef = x.modul
912909
member x.ILAssemblyRefs = x.ilAssemblyRefs.Force()
910+
interface IDisposable with
911+
member x.Dispose() = x.dispose()
913912

914913

915914
type MethodData = MethodData of ILType * ILCallingConv * string * ILTypes * ILType * ILTypes
@@ -3954,8 +3953,6 @@ let rec genOpenBinaryReader infile is opts =
39543953

39553954
ilModule,ilAssemblyRefs,pdb
39563955

3957-
let CloseILModuleReader x = x.dispose()
3958-
39593956
let mkDefault ilg =
39603957
{ optimizeForMemory=false;
39613958
pdbPath= None;
@@ -3980,7 +3977,7 @@ let OpenILModuleReader infile opts =
39803977
mmap.Close();
39813978
ClosePdbReader pdb) }
39823979
else
3983-
let mc = ByteFile.OpenIn infile
3980+
let mc = ByteFile(infile |> FileSystem.ReadAllBytesShim)
39843981
let modul,ilAssemblyRefs,pdb = genOpenBinaryReader infile mc opts
39853982
{ modul = modul;
39863983
ilAssemblyRefs = ilAssemblyRefs;
@@ -4006,7 +4003,7 @@ let OpenILModuleReaderAfterReadingAllBytes infile opts =
40064003
match cacheResult with
40074004
| Some(ilModuleReader) -> ilModuleReader
40084005
| None ->
4009-
let mc = ByteFile.OpenIn infile
4006+
let mc = ByteFile(infile |> FileSystem.ReadAllBytesShim)
40104007
let modul,ilAssemblyRefs,pdb = genOpenBinaryReader infile mc opts
40114008
let ilModuleReader =
40124009
{ modul = modul;
@@ -4018,7 +4015,7 @@ let OpenILModuleReaderAfterReadingAllBytes infile opts =
40184015

40194016
let OpenILModuleReaderFromBytes fileNameForDebugOutput bytes opts =
40204017
assert opts.pdbPath.IsNone
4021-
let mc = ByteFile.OpenBytes bytes
4018+
let mc = ByteFile(bytes)
40224019
let modul,ilAssemblyRefs,pdb = genOpenBinaryReader fileNameForDebugOutput mc opts
40234020
let ilModuleReader =
40244021
{ modul = modul;

src/absil/ilread.fsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,16 @@ type ILReaderOptions =
4141
val mkDefault : ILGlobals -> ILReaderOptions
4242

4343
// The non-memory resources (i.e. the file handle) associated with
44-
// the read can be recovered by calling CloseILModuleReader. Any remaining
44+
// the read can be recovered by calling Dispose. Any remaining
4545
// lazily-computed items in the metadata graph returned by MetadataOfILModuleReader
4646
// will no longer be valid.
4747
[<Sealed>]
4848
type ILModuleReader =
4949
member ILModuleDef : ILModuleDef
5050
member ILAssemblyRefs : ILAssemblyRef list
51+
interface System.IDisposable
5152

5253
val OpenILModuleReader: string -> ILReaderOptions -> ILModuleReader
53-
val CloseILModuleReader: ILModuleReader -> unit
5454

5555
/// Open a binary reader, except first copy the entire contents of the binary into
5656
/// memory, close the file and ensure any subsequent reads happen from the in-memory store.

src/fsharp/CompileOps.fs

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2381,11 +2381,8 @@ type AssemblyResolution =
23812381
| Some aref -> aref
23822382
| None ->
23832383
let readerSettings : ILBinaryReader.ILReaderOptions = {pdbPath=None;ilGlobals = EcmaILGlobals;optimizeForMemory=false} // ??
2384-
let reader = ILBinaryReader.OpenILModuleReaderAfterReadingAllBytes this.resolvedPath readerSettings
2385-
try
2386-
mkRefToILAssembly reader.ILModuleDef.ManifestOfAssembly
2387-
finally
2388-
ILBinaryReader.CloseILModuleReader reader
2384+
use reader = ILBinaryReader.OpenILModuleReaderAfterReadingAllBytes this.resolvedPath readerSettings
2385+
mkRefToILAssembly reader.ILModuleDef.ManifestOfAssembly
23892386
this.ilAssemblyRef := Some(assRef)
23902387
assRef
23912388

@@ -2469,21 +2466,17 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
24692466
let filename = ComputeMakePathAbsolute data.implicitIncludeDir primaryAssemblyFilename
24702467
try
24712468

2472-
let ilReader = OpenILBinary(filename,data.optimizeForMemory,data.openBinariesInMemory,None,None, data.primaryAssembly.Name, data.noDebugData, data.shadowCopyReferences)
2473-
try
2474-
let ilModule = ilReader.ILModuleDef
2469+
use ilReader = OpenILBinary(filename,data.optimizeForMemory,data.openBinariesInMemory,None,None, data.primaryAssembly.Name, data.noDebugData, data.shadowCopyReferences)
2470+
let ilModule = ilReader.ILModuleDef
24752471

2476-
match ilModule.ManifestOfAssembly.Version with
2477-
| Some(v1,v2,v3,_) ->
2478-
if v1 = 1us then
2479-
warning(Error(FSComp.SR.buildRequiresCLI2(filename),rangeStartup))
2480-
let clrRoot = Some(Path.GetDirectoryName(FileSystem.GetFullPathShim(filename)))
2481-
2482-
clrRoot, (int v1, sprintf "v%d.%d" v1 v2), (v1=5us && v2=0us && v3=5us) // SL5 mscorlib is 5.0.5.0
2483-
| _ ->
2484-
failwith (FSComp.SR.buildCouldNotReadVersionInfoFromMscorlib())
2485-
finally
2486-
ILBinaryReader.CloseILModuleReader ilReader
2472+
match ilModule.ManifestOfAssembly.Version with
2473+
| Some(v1,v2,v3,_) ->
2474+
if v1 = 1us then
2475+
warning(Error(FSComp.SR.buildRequiresCLI2(filename),rangeStartup))
2476+
let clrRoot = Some(Path.GetDirectoryName(FileSystem.GetFullPathShim(filename)))
2477+
clrRoot, (int v1, sprintf "v%d.%d" v1 v2), (v1=5us && v2=0us && v3=5us) // SL5 mscorlib is 5.0.5.0
2478+
| _ ->
2479+
failwith (FSComp.SR.buildCouldNotReadVersionInfoFromMscorlib())
24872480
with _ ->
24882481
error(Error(FSComp.SR.buildCannotReadAssembly(filename),rangeStartup))
24892482
| _ ->
@@ -2531,13 +2524,10 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
25312524
| Some(fslibFilename) ->
25322525
let filename = ComputeMakePathAbsolute data.implicitIncludeDir fslibFilename
25332526
try
2534-
let ilReader = OpenILBinary(filename,data.optimizeForMemory,data.openBinariesInMemory,None,None, data.primaryAssembly.Name, data.noDebugData, data.shadowCopyReferences)
2535-
try
2536-
checkFSharpBinaryCompatWithMscorlib filename ilReader.ILAssemblyRefs ilReader.ILModuleDef.ManifestOfAssembly.Version rangeStartup;
2537-
let fslibRoot = Path.GetDirectoryName(FileSystem.GetFullPathShim(filename))
2538-
fslibRoot (* , sprintf "v%d.%d" v1 v2 *)
2539-
finally
2540-
ILBinaryReader.CloseILModuleReader ilReader
2527+
use ilReader = OpenILBinary(filename,data.optimizeForMemory,data.openBinariesInMemory,None,None, data.primaryAssembly.Name, data.noDebugData, data.shadowCopyReferences)
2528+
checkFSharpBinaryCompatWithMscorlib filename ilReader.ILAssemblyRefs ilReader.ILModuleDef.ManifestOfAssembly.Version rangeStartup;
2529+
let fslibRoot = Path.GetDirectoryName(FileSystem.GetFullPathShim(filename))
2530+
fslibRoot (* , sprintf "v%d.%d" v1 v2 *)
25412531
with _ ->
25422532
error(Error(FSComp.SR.buildCannotReadAssembly(filename),rangeStartup))
25432533
| _ ->
@@ -2806,12 +2796,9 @@ type TcConfig private (data : TcConfigBuilder,validate:bool) =
28062796
else
28072797
try
28082798
let readerSettings : ILBinaryReader.ILReaderOptions = {pdbPath=None;ilGlobals = EcmaILGlobals;optimizeForMemory=false}
2809-
let reader = ILBinaryReader.OpenILModuleReaderAfterReadingAllBytes resolved readerSettings
2810-
try
2811-
let assRef = mkRefToILAssembly reader.ILModuleDef.ManifestOfAssembly
2812-
assRef.QualifiedName
2813-
finally
2814-
ILBinaryReader.CloseILModuleReader reader
2799+
use reader = ILBinaryReader.OpenILModuleReaderAfterReadingAllBytes resolved readerSettings
2800+
let assRef = mkRefToILAssembly reader.ILModuleDef.ManifestOfAssembly
2801+
assRef.QualifiedName
28152802
with e ->
28162803
""
28172804
Some
@@ -3851,7 +3838,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
38513838

38523839
let ilILBinaryReader = OpenILBinary(filename,tcConfig.optimizeForMemory,tcConfig.openBinariesInMemory,ilGlobalsOpt,pdbPathOption, tcConfig.primaryAssembly.Name, tcConfig.noDebugData, tcConfig.shadowCopyReferences)
38533840

3854-
tcImports.AttachDisposeAction(fun _ -> ILBinaryReader.CloseILModuleReader ilILBinaryReader)
3841+
tcImports.AttachDisposeAction(fun _ -> (ilILBinaryReader :> IDisposable).Dispose())
38553842
ilILBinaryReader.ILModuleDef, ilILBinaryReader.ILAssemblyRefs
38563843
with e ->
38573844
error(Error(FSComp.SR.buildErrorOpeningBinaryFile(filename, e.Message),m))

src/fsharp/TastOps.fs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7765,9 +7765,9 @@ let (|CompiledForEachExpr|_|) g expr =
77657765
when valRefEq g (mkLocalValRef enumerableVar) enumerableVar2 &&
77667766
enumerableVar.IsCompilerGenerated &&
77677767
enumeratorVar.IsCompilerGenerated &&
7768-
let fvs = (freeInExpr CollectLocals bodyExpr)
7769-
not (Zset.contains enumerableVar fvs.FreeLocals) &&
7770-
not (Zset.contains enumeratorVar fvs.FreeLocals) ->
7768+
(let fvs = (freeInExpr CollectLocals bodyExpr)
7769+
not (Zset.contains enumerableVar fvs.FreeLocals) &&
7770+
not (Zset.contains enumeratorVar fvs.FreeLocals)) ->
77717771

77727772
// Extract useful ranges
77737773
let m = enumerableExpr.Range
@@ -7788,7 +7788,6 @@ let (|CompiledInt32RangeForEachExpr|_|) g expr =
77887788
| _ -> None
77897789
| _ -> None
77907790

7791-
77927791
type OptimizeForExpressionOptions = OptimizeIntRangesOnly | OptimizeAllForExpressions
77937792

77947793
let DetectAndOptimizeForExpression g option expr =

src/fsharp/fsi/fsiAnyCPU.exe.config

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/fsharp/tast.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ open Microsoft.FSharp.Core.CompilerServices
3535
/// Unique name generator for stamps attached to lambdas and object expressions
3636
type Unique = int64
3737
//++GLOBAL MUTABLE STATE
38-
let newUnique = let i = ref 0L in fun () -> i := !i + 1L; !i
38+
let newUnique = let i = ref 0L in fun () -> System.Threading.Interlocked.Increment(i)
3939
type Stamp = int64
4040

4141
/// Unique name generator for stamps attached to to val_specs, tycon_specs etc.
4242
//++GLOBAL MUTABLE STATE
43-
let newStamp = let i = ref 0L in fun () -> i := !i + 1L; !i
43+
let newStamp = let i = ref 0L in fun () -> System.Threading.Interlocked.Increment(i)
4444

4545
/// A global generator of compiler generated names
4646
// ++GLOBAL MUTABLE STATE

0 commit comments

Comments
 (0)