Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/absil/il.fs
Original file line number Diff line number Diff line change
Expand Up @@ -914,9 +914,6 @@ type ILAttribElem =
type ILAttributeNamedArg = (string * ILType * bool * ILAttribElem)
type ILAttribute =
{ Method: ILMethodSpec;
#if FX_REFLECTION_EMITS_CUSTOM_ATTRIBUTES_USING_BUILDER
Arguments: ILAttribElem list * ILAttributeNamedArg list
#endif
Data: byte[] }

[<NoEquality; NoComparison>]
Expand Down Expand Up @@ -4416,9 +4413,6 @@ let mkILCustomAttribMethRef (ilg: ILGlobals) (mspec:ILMethodSpec, fixedArgs: lis
yield! encodeCustomAttrNamedArg ilg namedArg |]

{ Method = mspec;
#if FX_REFLECTION_EMITS_CUSTOM_ATTRIBUTES_USING_BUILDER
Arguments = fixedArgs, namedArgs
#endif
Data = args }

let mkILCustomAttribute ilg (tref,argtys,argvs,propvs) =
Expand Down
3 changes: 0 additions & 3 deletions src/absil/il.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -1028,9 +1028,6 @@ type ILAttributeNamedArg = string * ILType * bool * ILAttribElem
/// to ILAttribElem's as best as possible.
type ILAttribute =
{ Method: ILMethodSpec;
#if FX_REFLECTION_EMITS_CUSTOM_ATTRIBUTES_USING_BUILDER
Arguments: ILAttribElem list * ILAttributeNamedArg list
#endif
Data: byte[] }

[<NoEquality; NoComparison; Sealed>]
Expand Down
102 changes: 0 additions & 102 deletions src/absil/illib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -628,27 +628,6 @@ module Eventually =
let force e = Option.get (forceWhile (fun () -> true) e)

/// Keep running the computation bit by bit until a time limit is reached.
#if FX_NO_SYSTEM_DIAGNOSTICS_STOPWATCH
// There is no Stopwatch on Silverlight, so use DateTime.Now. I'm not sure of the pros and cons of this.
// An alternative is just to always force the computation all the way to the end.
//let repeatedlyProgressUntilDoneOrTimeShareOver _timeShareInMilliseconds runner e =
// Done (runner (fun () -> force e))
let repeatedlyProgressUntilDoneOrTimeShareOver (timeShareInMilliseconds:int64) runner e =
let rec runTimeShare e =
runner (fun () ->
let sw = System.DateTime.Now
let rec loop e =
match e with
| Done _ -> e
| NotYetDone (work) ->
let ts = System.DateTime.Now - sw
if ts.TotalMilliseconds > float timeShareInMilliseconds then
NotYetDone(fun () -> runTimeShare e)
else
loop(work())
loop e)
runTimeShare e
#else
/// The runner gets called each time the computation is restarted
let repeatedlyProgressUntilDoneOrTimeShareOver timeShareInMilliseconds runner e =
let sw = new System.Diagnostics.Stopwatch()
Expand All @@ -667,7 +646,6 @@ module Eventually =
loop(work())
loop(e))
runTimeShare e
#endif

let rec bind k e =
match e with
Expand Down Expand Up @@ -990,81 +968,6 @@ module Shim =
abstract AssemblyLoadFrom: fileName:string -> System.Reflection.Assembly
abstract AssemblyLoad: assemblyName:System.Reflection.AssemblyName -> System.Reflection.Assembly

#if FX_FILE_SYSTEM_USES_ISOLATED_STORAGE
open System.IO.IsolatedStorage
open System.Windows
open System

type DefaultFileSystem() =
interface IFileSystem with
member this.ReadAllBytesShim (fileName:string) =
use stream = this.FileStreamReadShim fileName
let len = stream.Length
let buf = Array.zeroCreate<byte> (int len)
stream.Read(buf, 0, (int len)) |> ignore
buf


member this.AssemblyLoadFrom(fileName:string) =
let load() =
let assemblyPart = System.Windows.AssemblyPart()
let assemblyStream = this.FileStreamReadShim(fileName)
assemblyPart.Load(assemblyStream)
if System.Windows.Deployment.Current.Dispatcher.CheckAccess() then
load()
else
let resultTask = System.Threading.Tasks.TaskCompletionSource<System.Reflection.Assembly>()
System.Windows.Deployment.Current.Dispatcher.BeginInvoke(Action(fun () -> resultTask.SetResult (load()))) |> ignore
resultTask.Task.Result

member this.AssemblyLoad(assemblyName:System.Reflection.AssemblyName) =
try
System.Reflection.Assembly.Load(assemblyName.FullName)
with e ->
this.AssemblyLoadFrom(assemblyName.Name + ".dll")

member __.FileStreamReadShim (fileName:string) =
match Application.GetResourceStream(System.Uri(fileName,System.UriKind.Relative)) with
| null -> IsolatedStorageFile.GetUserStoreForApplication().OpenFile(fileName, System.IO.FileMode.Open) :> System.IO.Stream
| resStream -> resStream.Stream

member __.FileStreamCreateShim (fileName:string) =
System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication().CreateFile(fileName) :> Stream

member __.FileStreamWriteExistingShim (fileName:string) =
let isf = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication()
new System.IO.IsolatedStorage.IsolatedStorageFileStream(fileName,FileMode.Open,FileAccess.Write,isf) :> Stream

member __.GetFullPathShim (fileName:string) = fileName
member __.IsPathRootedShim (pathName:string) = true

member __.IsInvalidPathShim(path:string) =
let isInvalidPath(p:string) =
String.IsNullOrEmpty(p) || p.IndexOfAny(System.IO.Path.GetInvalidPathChars()) <> -1

let isInvalidDirectory(d:string) =
d=null || d.IndexOfAny(Path.GetInvalidPathChars()) <> -1

isInvalidPath (path) ||
let directory = Path.GetDirectoryName(path)
let filename = Path.GetFileName(path)
isInvalidDirectory(directory) || isInvalidPath(filename)

member __.GetTempPathShim() = "."

member __.GetLastWriteTimeShim (fileName:string) =
match Application.GetResourceStream(System.Uri(fileName,System.UriKind.Relative)) with
| null -> IsolatedStorageFile.GetUserStoreForApplication().GetLastAccessTime(fileName).LocalDateTime
| _resStream -> System.DateTime.Today.Date
member __.SafeExists (fileName:string) =
match Application.GetResourceStream(System.Uri(fileName,System.UriKind.Relative)) with
| null -> IsolatedStorageFile.GetUserStoreForApplication().FileExists fileName
| resStream -> resStream.Stream <> null
member __.FileDelete (fileName:string) =
match Application.GetResourceStream(System.Uri(fileName,System.UriKind.Relative)) with
| null -> IsolatedStorageFile.GetUserStoreForApplication().DeleteFile fileName
| _resStream -> ()
#else

type DefaultFileSystem() =
interface IFileSystem with
Expand Down Expand Up @@ -1104,14 +1007,9 @@ module Shim =
member __.GetLastWriteTimeShim (fileName:string) = File.GetLastWriteTime fileName
member __.SafeExists (fileName:string) = System.IO.File.Exists fileName
member __.FileDelete (fileName:string) = System.IO.File.Delete fileName
#endif

type System.Text.Encoding with
static member GetEncodingShim(n:int) =
#if FX_NO_GET_ENCODING_BY_INTEGER
System.Text.Encoding.GetEncoding(n.ToString())
#else
System.Text.Encoding.GetEncoding(n)
#endif

let mutable FileSystem = DefaultFileSystem() :> IFileSystem
34 changes: 0 additions & 34 deletions src/absil/ilread.fs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ open System.Collections.Generic
open Internal.Utilities
open Microsoft.FSharp.Compiler.AbstractIL
open Microsoft.FSharp.Compiler.AbstractIL.Internal
#if NO_PDB_READER
#else
open Microsoft.FSharp.Compiler.AbstractIL.Internal.Support
#endif
open Microsoft.FSharp.Compiler.AbstractIL.Diagnostics
open Microsoft.FSharp.Compiler.AbstractIL.Internal.BinaryConstants
open Microsoft.FSharp.Compiler.AbstractIL.IL
Expand Down Expand Up @@ -105,10 +102,6 @@ type BinaryFile() =
abstract CountUtf8String : addr:int -> int
abstract ReadUTF8String : addr: int -> string

#if FX_NO_NATIVE_MEMORY_MAPPED_FILES

#else

/// Read file from memory mapped files
module MemoryMapping =

Expand Down Expand Up @@ -216,7 +209,6 @@ type MemoryMappedFile(hMap: MemoryMapping.HANDLE, start:nativeint) =
new System.String(NativePtr.ofNativeInt (m.Addr i), 0, n, System.Text.Encoding.UTF8)


#endif
//---------------------------------------------------------------------
// Read file from memory blocks
//---------------------------------------------------------------------
Expand Down Expand Up @@ -919,11 +911,7 @@ type ILReaderContext =
{ ilg: ILGlobals;
dataEndPoints: Lazy<int32 list>;
sorted: int64;
#if NO_PDB_READER
pdb: obj option;
#else
pdb: (PdbReader * (string -> ILSourceDocument)) option;
#endif
entryPointToken: TableName * int;
getNumRows: TableName -> int;
textSegmentPhysicalLoc : int32;
Expand Down Expand Up @@ -1461,9 +1449,6 @@ let readBlobHeapAsDouble ctxt vidx = fst (sigptrGetDouble (readBlobHeap ctxt vid
// (e) the start of the native resources attached to the binary if any
// ----------------------------------------------------------------------*)

#if NO_PDB_READER
let readNativeResources _ctxt = []
#else
let readNativeResources ctxt =
let nativeResources =
if ctxt.nativeResourcesSize = 0x0 || ctxt.nativeResourcesAddr = 0x0 then
Expand All @@ -1472,7 +1457,6 @@ let readNativeResources ctxt =
[ (lazy (let linkedResource = seekReadBytes ctxt.is (ctxt.anyV2P (ctxt.infile + ": native resources",ctxt.nativeResourcesAddr)) ctxt.nativeResourcesSize
unlinkResource ctxt.nativeResourcesAddr linkedResource)) ]
nativeResources
#endif

let dataEndPoints ctxtH =
lazy
Expand Down Expand Up @@ -2528,9 +2512,6 @@ and seekReadCustomAttr ctxt (TaggedIndex(cat,idx),b) =
and seekReadCustomAttrUncached ctxtH (CustomAttrIdx (cat,idx,valIdx)) =
let ctxt = getHole ctxtH
{ Method=seekReadCustomAttrType ctxt (TaggedIndex(cat,idx));
#if FX_REFLECTION_EMITS_CUSTOM_ATTRIBUTES_USING_BUILDER
Arguments = [], []
#endif
Data=
match readBlobHeapOption ctxt valIdx with
| Some bytes -> bytes
Expand Down Expand Up @@ -2886,11 +2867,7 @@ and seekReadTopCode ctxt numtypars (sz:int) start seqpoints =
let instrs = ibuf.ToArray()
instrs,rawToLabel, lab2pc, raw2nextLab

#if NO_PDB_READER
and seekReadMethodRVA ctxt (_idx,nm,_internalcall,noinline,numtypars) rva =
#else
and seekReadMethodRVA ctxt (idx,nm,_internalcall,noinline,numtypars) rva =
#endif
mkMethBodyLazyAux
(lazy
begin
Expand All @@ -2900,9 +2877,6 @@ and seekReadMethodRVA ctxt (idx,nm,_internalcall,noinline,numtypars) rva =
// -- an overall range for the method
// -- the sequence points for the method
let localPdbInfos, methRangePdbInfo, seqpoints =
#if NO_PDB_READER
[], None, []
#else
match ctxt.pdb with
| None ->
[], None, []
Expand Down Expand Up @@ -2959,7 +2933,6 @@ and seekReadMethodRVA ctxt (idx,nm,_internalcall,noinline,numtypars) rva =
with e ->
// "* Warning: PDB info for method "+nm+" could not be read and will be ignored: "+e.Message
[],None,[]
#endif // NO_PDB_READER

let baseRVA = ctxt.anyV2P("method rva",rva)
// ": reading body of method "+nm+" at rva "+string rva+", phys "+string baseRVA
Expand Down Expand Up @@ -3258,8 +3231,6 @@ and seekReadTopExportedTypes ctxt () =
done;
List.rev !res)

#if NO_PDB_READER
#else
let getPdbReader opts infile =
match opts.pdbPath with
| None -> None
Expand All @@ -3280,7 +3251,6 @@ let getPdbReader opts infile =
let docfun url = if tab.ContainsKey url then tab.[url] else failwith ("Document with URL "+url+" not found in list of documents in the PDB file")
Some (pdbr, docfun)
with e -> dprintn ("* Warning: PDB file could not be read and will be ignored: "+e.Message); None
#endif

//-----------------------------------------------------------------------
// Crack the binary headers, build a reader context and return the lazy
Expand Down Expand Up @@ -3831,11 +3801,7 @@ let rec genOpenBinaryReader infile is opts =
//-----------------------------------------------------------------------
// Set up the PDB reader so we can read debug info for methods.
// ----------------------------------------------------------------------
#if NO_PDB_READER
let pdb = None
#else
let pdb = if runningOnMono then None else getPdbReader opts infile
#endif

let rowAddr (tab:TableName) idx = tablePhysLocations.[tab.Index] + (idx - 1) * tableRowSizes.[tab.Index]

Expand Down
Loading