Skip to content

Commit 07ef38e

Browse files
committed
integrate master
2 parents c494a9c + 2dae2cd commit 07ef38e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+985
-1732
lines changed

src/absil/il.fs

Lines changed: 58 additions & 193 deletions
Large diffs are not rendered by default.

src/absil/il.fsi

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,6 @@ module (*internal*) Microsoft.FSharp.Compiler.AbstractIL.IL
77
open Internal.Utilities
88
open System.Collections.Generic
99

10-
/// The type used to store relatively small lists in the Abstract IL data structures, i.e. for ILTypes, ILGenericArgs, ILParameters and ILLocals.
11-
/// See comments in il.fs for why we've isolated this representation and the possible future choices we might use here.
12-
#if ABSIL_USES_ARRAY_FOR_ILLIST
13-
type ILList<'T> = 'T []
14-
#endif
15-
16-
#if ABSIL_USES_THREELIST_FOR_ILLIST
17-
type ILList<'T> = ThreeList<'T>
18-
#endif
19-
20-
//#if ABSIL_USES_LIST_FOR_ILLIST
21-
type ILList<'T> = 'T list
22-
//#endif
23-
2410
type PrimaryAssembly =
2511
| Mscorlib
2612
| DotNetCore
@@ -361,28 +347,8 @@ and [<StructuralEquality; StructuralComparison>]
361347
/// Actual generic parameters are always types.
362348
363349

364-
and ILGenericArgs = ILList<ILType>
365-
and ILTypes = ILList<ILType>
366-
367-
368-
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
369-
module ILList =
370-
val inline map : ('T -> 'U) -> ILList<'T> -> ILList<'U>
371-
val inline mapi : (int -> 'T -> 'U) -> ILList<'T> -> ILList<'U>
372-
val inline isEmpty : ILList<'T> -> bool
373-
val inline toList : ILList<'T> -> 'T list
374-
val inline ofList : 'T list -> ILList<'T>
375-
val inline lengthsEqAndForall2 : ('T -> 'U -> bool) -> ILList<'T> -> ILList<'U> -> bool
376-
val inline init : int -> (int -> 'T) -> ILList<'T>
377-
val inline empty<'T> : ILList<'T>
378-
val inline toArray : ILList<'T> -> 'T[]
379-
val inline ofArray : 'T[] -> ILList<'T>
380-
val inline nth : ILList<'T> -> int -> 'T
381-
val inline iter : ('T -> unit) -> ILList<'T> -> unit
382-
val inline iteri : (int -> 'T -> unit) -> ILList<'T> -> unit
383-
val inline foldBack : ('T -> 'State -> 'State) -> ILList<'T> -> 'State -> 'State
384-
val inline exists : ('T -> bool) -> ILList<'T> -> bool
385-
350+
and ILGenericArgs = list<ILType>
351+
and ILTypes = list<ILType>
386352

387353
/// Formal identities of methods. Method refs refer to methods on
388354
/// named types. In general you should work with ILMethodSpec objects
@@ -817,8 +783,7 @@ type ILLocal =
817783
IsPinned: bool;
818784
DebugInfo: (string * int * int) option }
819785

820-
821-
type ILLocals = ILList<ILLocal>
786+
type ILLocals = list<ILLocal>
822787

823788
/// IL method bodies
824789
[<RequireQualifiedAccess; NoComparison; NoEquality>]
@@ -891,10 +856,9 @@ type ILParameter =
891856
IsOptional: bool;
892857
CustomAttrs: ILAttributes }
893858

894-
type ILParameters = ILList<ILParameter>
859+
type ILParameters = list<ILParameter>
895860

896-
val typesOfILParamsRaw : ILParameters -> ILTypes
897-
val typesOfILParamsList : ILParameter list -> ILType list
861+
val typesOfILParams : ILParameters -> ILType list
898862

899863
/// Method return values.
900864
[<RequireQualifiedAccess; NoEquality; NoComparison>]
@@ -1428,6 +1392,7 @@ type ILAssemblyManifest =
14281392
AssemblyLongevity: ILAssemblyLongevity;
14291393
DisableJitOptimizations: bool;
14301394
JitTracking: bool;
1395+
IgnoreSymbolStoreSequencePoints: bool;
14311396
Retargetable: bool;
14321397
/// Records the types impemented by this asssembly in auxiliary
14331398
/// modules.
@@ -1658,7 +1623,6 @@ val decodeILAttribData:
16581623
val mkSimpleAssRef: string -> ILAssemblyRef
16591624
val mkSimpleModRef: string -> ILModuleRef
16601625

1661-
val emptyILGenericArgs: ILGenericArgs
16621626
val mkILTyvarTy: uint16 -> ILType
16631627

16641628
/// Make type refs.
@@ -1667,18 +1631,15 @@ val mkILTyRef: ILScopeRef * string -> ILTypeRef
16671631
val mkILTyRefInTyRef: ILTypeRef * string -> ILTypeRef
16681632

16691633
type ILGenericArgsList = ILType list
1670-
val mkILGenericArgs : ILGenericArgsList -> ILGenericArgs
1634+
16711635
/// Make type specs.
16721636
val mkILNonGenericTySpec: ILTypeRef -> ILTypeSpec
16731637
val mkILTySpec: ILTypeRef * ILGenericArgsList -> ILTypeSpec
1674-
val mkILTySpecRaw: ILTypeRef * ILGenericArgs -> ILTypeSpec
16751638

16761639
/// Make types.
16771640
val mkILTy: ILBoxity -> ILTypeSpec -> ILType
16781641
val mkILNamedTy: ILBoxity -> ILTypeRef -> ILGenericArgsList -> ILType
1679-
val mkILNamedTyRaw: ILBoxity -> ILTypeRef -> ILGenericArgs -> ILType
16801642
val mkILBoxedTy: ILTypeRef -> ILGenericArgsList -> ILType
1681-
val mkILBoxedTyRaw: ILTypeRef -> ILGenericArgs -> ILType
16821643
val mkILValueTy: ILTypeRef -> ILGenericArgsList -> ILType
16831644
val mkILNonGenericBoxedTy: ILTypeRef -> ILType
16841645
val mkILNonGenericValueTy: ILTypeRef -> ILType
@@ -1688,16 +1649,11 @@ val isILArrTy: ILType -> bool
16881649
val destILArrTy: ILType -> ILArrayShape * ILType
16891650
val mkILBoxedType : ILTypeSpec -> ILType
16901651

1691-
val mkILTypes : ILType list -> ILTypes
1692-
16931652
/// Make method references and specs.
1694-
val mkILMethRefRaw: ILTypeRef * ILCallingConv * string * int * ILTypes * ILType -> ILMethodRef
16951653
val mkILMethRef: ILTypeRef * ILCallingConv * string * int * ILType list * ILType -> ILMethodRef
16961654
val mkILMethSpec: ILMethodRef * ILBoxity * ILGenericArgsList * ILGenericArgsList -> ILMethodSpec
1697-
val mkILMethSpecForMethRefInTyRaw: ILMethodRef * ILType * ILGenericArgs -> ILMethodSpec
16981655
val mkILMethSpecForMethRefInTy: ILMethodRef * ILType * ILGenericArgsList -> ILMethodSpec
16991656
val mkILMethSpecInTy: ILType * ILCallingConv * string * ILType list * ILType * ILGenericArgsList -> ILMethodSpec
1700-
val mkILMethSpecInTyRaw: ILType * ILCallingConv * string * ILTypes * ILType * ILGenericArgs -> ILMethodSpec
17011657

17021658
/// Construct references to methods on a given type .
17031659
val mkILNonGenericMethSpecInTy: ILType * ILCallingConv * string * ILType list * ILType -> ILMethodSpec
@@ -1722,17 +1678,14 @@ val mkILFieldRef: ILTypeRef * string * ILType -> ILFieldRef
17221678
val mkILFieldSpec: ILFieldRef * ILType -> ILFieldSpec
17231679
val mkILFieldSpecInTy: ILType * string * ILType -> ILFieldSpec
17241680

1725-
val mkILCallSigRaw: ILCallingConv * ILTypes * ILType -> ILCallingSignature
17261681
val mkILCallSig: ILCallingConv * ILType list * ILType -> ILCallingSignature
17271682

17281683
/// Make generalized verions of possibly-generic types,
17291684
/// e.g. Given the ILTypeDef for List, return the type "List<T>".
17301685
val mkILFormalBoxedTy: ILTypeRef -> ILGenericParameterDef list -> ILType
17311686
val mkILFormalNamedTy: ILBoxity -> ILTypeRef -> ILGenericParameterDef list -> ILType
17321687

1733-
val mkILFormalTyparsRaw: ILTypes -> ILGenericParameterDefs
17341688
val mkILFormalTypars: ILType list -> ILGenericParameterDefs
1735-
val mkILFormalGenericArgsRaw: ILGenericParameterDefs -> ILGenericArgs
17361689
val mkILFormalGenericArgs: ILGenericParameterDefs -> ILGenericArgsList
17371690
val mkILSimpleTypar : string -> ILGenericParameterDef
17381691
/// Make custom attributes.
@@ -1794,8 +1747,6 @@ val mkILParamAnon: ILType -> ILParameter
17941747
val mkILParamNamed: string * ILType -> ILParameter
17951748
val mkILReturn: ILType -> ILReturn
17961749
val mkILLocal: ILType -> (string * int * int) option -> ILLocal
1797-
val mkILLocals : ILLocal list -> ILLocals
1798-
val emptyILLocals : ILLocals
17991750

18001751
/// Make a formal generic parameters.
18011752
val mkILEmptyGenericParams: ILGenericParameterDefs

src/absil/illib.fs

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -483,64 +483,6 @@ module ResultOrException =
483483
| Result x -> success x
484484
| Exception _err -> f()
485485

486-
487-
//-------------------------------------------------------------------------
488-
// Library: extensions to flat list (immutable arrays)
489-
//------------------------------------------------------------------------
490-
#if FLAT_LIST_AS_ARRAY_STRUCT
491-
//#else
492-
module FlatList =
493-
494-
let order (eltOrder: IComparer<_>) =
495-
{ new IComparer<FlatList<_>> with
496-
member __.Compare(xs,ys) =
497-
match xs.array,ys.array with
498-
| null,null -> 0
499-
| _,null -> 1
500-
| null,_ -> -1
501-
| arr1,arr2 -> Array.order eltOrder arr1 arr2 }
502-
503-
let mapq f (x:FlatList<_>) =
504-
match x.array with
505-
| null -> x
506-
| arr ->
507-
let arr' = Array.map f arr in
508-
let n = arr.Length in
509-
let rec check i = if i >= n then true else arr.[i] === arr'.[i] && check (i+1)
510-
if check 0 then x else FlatList(arr')
511-
512-
let mapFold f acc (x:FlatList<_>) =
513-
match x.array with
514-
| null ->
515-
FlatList.Empty,acc
516-
| arr ->
517-
let arr,acc = Array.mapFold f acc x.array
518-
FlatList(arr),acc
519-
520-
#endif
521-
#if FLAT_LIST_AS_LIST
522-
523-
#else
524-
525-
module FlatList =
526-
let toArray xs = List.toArray xs
527-
let choose f xs = List.choose f xs
528-
let order eltOrder = List.order eltOrder
529-
let mapq f (x:FlatList<_>) = List.mapq f x
530-
let mapFold f acc (x:FlatList<_>) = List.mapFold f acc x
531-
532-
#endif
533-
534-
#if FLAT_LIST_AS_ARRAY
535-
//#else
536-
module FlatList =
537-
let order eltOrder = Array.order eltOrder
538-
let mapq f x = Array.mapq f x
539-
let mapFold f acc x = Array.mapFold f acc x
540-
#endif
541-
542-
543-
544486
/// Computations that can cooperatively yield by returning a continuation
545487
///
546488
/// - Any yield of a NotYetDone should typically be "abandonable" without adverse consequences. No resource release
@@ -781,7 +723,6 @@ module NameMap =
781723
let ofKeyedList f l = List.foldBack (fun x acc -> Map.add (f x) x acc) l Map.empty
782724
let ofList l : NameMap<'T> = Map.ofList l
783725
let ofSeq l : NameMap<'T> = Map.ofSeq l
784-
let ofFlatList (l:FlatList<_>) : NameMap<'T> = FlatList.toMap l
785726
let toList (l: NameMap<'T>) = Map.toList l
786727
let layer (m1 : NameMap<'T>) m2 = Map.foldBack Map.add m1 m2
787728

src/absil/ilmorph.fs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ let rec typ_tref2tref f x =
5555
| ILType.FunctionPointer x ->
5656
ILType.FunctionPointer
5757
{ x with
58-
ArgTypes=ILList.map (typ_tref2tref f) x.ArgTypes;
58+
ArgTypes=List.map (typ_tref2tref f) x.ArgTypes;
5959
ReturnType=typ_tref2tref f x.ReturnType}
6060
| ILType.Byref t -> ILType.Byref (typ_tref2tref f t)
6161
| ILType.Boxed cr -> mkILBoxedType (tspec_tref2tref f cr)
@@ -65,7 +65,7 @@ let rec typ_tref2tref f x =
6565
| ILType.Modified (req,tref,ty) -> ILType.Modified (req, f tref, typ_tref2tref f ty)
6666
| ILType.Void -> ILType.Void
6767
and tspec_tref2tref f (x:ILTypeSpec) =
68-
mkILTySpecRaw(f x.TypeRef, ILList.map (typ_tref2tref f) x.GenericArgs)
68+
mkILTySpec(f x.TypeRef, List.map (typ_tref2tref f) x.GenericArgs)
6969

7070
let rec typ_scoref2scoref_tyvar2typ ((_fscope,ftyvar) as fs)x =
7171
match x with
@@ -81,9 +81,9 @@ and tspec_scoref2scoref_tyvar2typ fs (x:ILTypeSpec) =
8181
ILTypeSpec.Create(morphILScopeRefsInILTypeRef (fst fs) x.TypeRef,typs_scoref2scoref_tyvar2typ fs x.GenericArgs)
8282
and callsig_scoref2scoref_tyvar2typ f x =
8383
{ x with
84-
ArgTypes=ILList.map (typ_scoref2scoref_tyvar2typ f) x.ArgTypes;
84+
ArgTypes=List.map (typ_scoref2scoref_tyvar2typ f) x.ArgTypes;
8585
ReturnType=typ_scoref2scoref_tyvar2typ f x.ReturnType}
86-
and typs_scoref2scoref_tyvar2typ f i = ILList.map (typ_scoref2scoref_tyvar2typ f) i
86+
and typs_scoref2scoref_tyvar2typ f i = List.map (typ_scoref2scoref_tyvar2typ f) i
8787
and gparams_scoref2scoref_tyvar2typ f i = List.map (gparam_scoref2scoref_tyvar2typ f) i
8888
and gparam_scoref2scoref_tyvar2typ _f i = i
8989
and morphILScopeRefsInILTypeRef fscope (x:ILTypeRef) =
@@ -92,27 +92,27 @@ and morphILScopeRefsInILTypeRef fscope (x:ILTypeRef) =
9292

9393
let callsig_typ2typ f (x: ILCallingSignature) =
9494
{ CallingConv=x.CallingConv;
95-
ArgTypes=ILList.map f x.ArgTypes;
95+
ArgTypes=List.map f x.ArgTypes;
9696
ReturnType=f x.ReturnType}
9797

98-
let gparam_typ2typ f gf = {gf with Constraints = ILList.map f gf.Constraints}
98+
let gparam_typ2typ f gf = {gf with Constraints = List.map f gf.Constraints}
9999
let gparams_typ2typ f gfs = List.map (gparam_typ2typ f) gfs
100-
let typs_typ2typ (f: ILType -> ILType) x = ILList.map f x
100+
let typs_typ2typ (f: ILType -> ILType) x = List.map f x
101101
let mref_typ2typ (f: ILType -> ILType) (x:ILMethodRef) =
102102
ILMethodRef.Create(enclosingTypeRef= (f (mkILBoxedType (mkILNonGenericTySpec x.EnclosingTypeRef))).TypeRef,
103103
callingConv=x.CallingConv,
104104
name=x.Name,
105105
genericArity=x.GenericArity,
106-
argTypes= ILList.map f x.ArgTypes,
106+
argTypes= List.map f x.ArgTypes,
107107
returnType= f x.ReturnType)
108108

109109

110110
type formal_scopeCtxt = Choice<ILMethodSpec, ILFieldSpec>
111111

112112
let mspec_typ2typ (((factualty : ILType -> ILType) , (fformalty: formal_scopeCtxt -> ILType -> ILType))) (x: ILMethodSpec) =
113-
mkILMethSpecForMethRefInTyRaw(mref_typ2typ (fformalty (Choice1Of2 x)) x.MethodRef,
114-
factualty x.EnclosingType,
115-
typs_typ2typ factualty x.GenericArgs)
113+
mkILMethSpecForMethRefInTy(mref_typ2typ (fformalty (Choice1Of2 x)) x.MethodRef,
114+
factualty x.EnclosingType,
115+
typs_typ2typ factualty x.GenericArgs)
116116

117117
let fref_typ2typ (f: ILType -> ILType) x =
118118
{ x with EnclosingTypeRef = (f (mkILBoxedType (mkILNonGenericTySpec x.EnclosingTypeRef))).TypeRef;
@@ -155,7 +155,7 @@ let fdef_typ2typ ilg ftype (fd: ILFieldDef) =
155155
CustomAttrs=cattrs_typ2typ ilg ftype fd.CustomAttrs}
156156

157157
let local_typ2typ f (l: ILLocal) = {l with Type = f l.Type}
158-
let varargs_typ2typ f (varargs: ILVarArgs) = Option.map (ILList.map f) varargs
158+
let varargs_typ2typ f (varargs: ILVarArgs) = Option.map (List.map f) varargs
159159
(* REVIEW: convert varargs *)
160160
let morphILTypesInILInstr ((factualty,fformalty)) i =
161161
let factualty = factualty (Some i)
@@ -205,7 +205,7 @@ let fdefs_fdef2fdef f (m:ILFieldDefs) = mkILFields (List.map f m.AsList)
205205
(* use this when the conversion produces just one type... *)
206206
let morphILTypeDefs f (m: ILTypeDefs) = mkILTypeDefsFromArray (Array.map f m.AsArray)
207207

208-
let locals_typ2typ f ls = ILList.map (local_typ2typ f) ls
208+
let locals_typ2typ f ls = List.map (local_typ2typ f) ls
209209

210210
let ilmbody_instr2instr_typ2typ fs (il: ILMethodBody) =
211211
let (finstr,ftype) = fs
@@ -228,7 +228,7 @@ let mdef_typ2typ_ilmbody2ilmbody ilg fs md =
228228
{md with
229229
GenericParams=gparams_typ2typ ftype' md.GenericParams;
230230
mdBody= body';
231-
Parameters = ILList.map (param_typ2typ ilg ftype') md.Parameters;
231+
Parameters = List.map (param_typ2typ ilg ftype') md.Parameters;
232232
Return = return_typ2typ ilg ftype' md.Return;
233233
CustomAttrs=cattrs_typ2typ ilg ftype' md.CustomAttrs }
234234

@@ -254,7 +254,7 @@ let pdef_typ2typ ilg f p =
254254
SetMethod = Option.map (mref_typ2typ f) p.SetMethod;
255255
GetMethod = Option.map (mref_typ2typ f) p.GetMethod;
256256
Type = f p.Type;
257-
Args = ILList.map f p.Args;
257+
Args = List.map f p.Args;
258258
CustomAttrs = cattrs_typ2typ ilg f p.CustomAttrs }
259259

260260
let pdefs_typ2typ ilg f (pdefs: ILPropertyDefs) = mkILProperties (List.map (pdef_typ2typ ilg f) pdefs.AsList)
@@ -267,7 +267,7 @@ let rec tdef_typ2typ_ilmbody2ilmbody_mdefs2mdefs ilg enc fs td =
267267
let ftype' = ftype (Some (enc,td)) None
268268
let mdefs' = fmdefs (enc,td) td.Methods
269269
let fdefs' = fdefs_typ2typ ilg ftype' td.Fields
270-
{td with Implements= ILList.map ftype' td.Implements;
270+
{td with Implements= List.map ftype' td.Implements;
271271
GenericParams= gparams_typ2typ ftype' td.GenericParams;
272272
Extends = Option.map ftype' td.Extends;
273273
Methods=mdefs';

src/absil/ilpars.fsy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type SigArg = SigArg of (string option * ILType) | Sentinel
2626
let decodeVarargs args =
2727
let rec normals = function
2828
| [] -> ([],None)
29-
| Sentinel :: t -> ([],Some (ILList.ofList (varargs t)))
29+
| Sentinel :: t -> ([],Some (varargs t))
3030
| SigArg (_,p)::t -> let (n,r) = normals t in (p::n, r)
3131
and varargs = function
3232
| [] -> []
@@ -46,7 +46,7 @@ let resolveMethodSpecScopeThen (ResolvedAtMethodSpecScope f) g =
4646
let resolveFormalMethodSpecScope tspeco obj =
4747
match tspeco with
4848
None -> resolveMethodSpecScope obj mkILEmptyGenericParams
49-
| Some (tspec:ILTypeSpec) -> resolveMethodSpecScope obj (mkILFormalTyparsRaw tspec.GenericArgs)
49+
| Some (tspec:ILTypeSpec) -> resolveMethodSpecScope obj (mkILFormalTypars tspec.GenericArgs)
5050

5151
let resolveCurrentMethodSpecScope obj =
5252
resolveMethodSpecScope obj mkILEmptyGenericParams

src/absil/ilprint.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ and goutput_ldtoken_info env os = function
208208
| ILToken.ILField x -> output_string os "field "; goutput_fspec env os x
209209

210210
and goutput_typ_with_shortened_class_syntax env os = function
211-
ILType.Boxed tspec when tspec.GenericArgs = emptyILGenericArgs ->
211+
ILType.Boxed tspec when tspec.GenericArgs = [] ->
212212
goutput_tref env os tspec.TypeRef
213213
| typ2 -> goutput_typ env os typ2
214214

@@ -339,7 +339,7 @@ and goutput_mref env os (mref:ILMethodRef) =
339339
and goutput_mspec env os (mspec:ILMethodSpec) =
340340
let fenv =
341341
ppenv_enter_method mspec.GenericArity
342-
(ppenv_enter_tdef (mkILFormalTyparsRaw mspec.EnclosingType.GenericArgs) env)
342+
(ppenv_enter_tdef (mkILFormalTypars mspec.EnclosingType.GenericArgs) env)
343343
output_callconv os mspec.CallingConv;
344344
output_string os " ";
345345
goutput_typ fenv os mspec.FormalReturnType;
@@ -357,7 +357,7 @@ and goutput_vararg_mspec env os (mspec, varargs) =
357357
| Some varargs' ->
358358
let fenv =
359359
ppenv_enter_method mspec.GenericArity
360-
(ppenv_enter_tdef (mkILFormalTyparsRaw mspec.EnclosingType.GenericArgs) env)
360+
(ppenv_enter_tdef (mkILFormalTypars mspec.EnclosingType.GenericArgs) env)
361361
output_callconv os mspec.CallingConv;
362362
output_string os " ";
363363
goutput_typ fenv os mspec.FormalReturnType;
@@ -386,7 +386,7 @@ and goutput_vararg_sig env os (csig:ILCallingSignature,varargs:ILVarArgs) =
386386
output_string os ")";
387387

388388
and goutput_fspec env os (x:ILFieldSpec) =
389-
let fenv = ppenv_enter_tdef (mkILFormalTyparsRaw x.EnclosingType.GenericArgs) env
389+
let fenv = ppenv_enter_tdef (mkILFormalTypars x.EnclosingType.GenericArgs) env
390390
goutput_typ fenv os x.FormalType;
391391
output_string os " ";
392392
goutput_dlocref env os x.EnclosingType;

0 commit comments

Comments
 (0)