@@ -7,6 +7,7 @@ module internal Microsoft.FSharp.Compiler.AbstractIL.IL
77open Internal.Utilities
88open System.Collections .Generic
99
10+ [<RequireQualifiedAccess>]
1011type PrimaryAssembly =
1112 | Mscorlib
1213 | DotNetCore
@@ -1474,29 +1475,6 @@ val isTypeNameForGlobalFunctions: string -> bool
14741475
14751476val ungenericizeTypeName : string -> string (* e.g. List`1 - -> List *)
14761477
1477- /// Represents the capabilities of target framework profile.
1478- /// Different profiles may omit some types or contain them in different assemblies.
1479- type IPrimaryAssemblyTraits =
1480-
1481- abstract TypedReferenceTypeScopeRef : ILScopeRef option
1482- abstract RuntimeArgumentHandleTypeScopeRef : ILScopeRef option
1483- abstract SerializationInfoTypeScopeRef : ILScopeRef option
1484- abstract SecurityPermissionAttributeTypeScopeRef : ILScopeRef option
1485- abstract IDispatchConstantAttributeScopeRef : ILScopeRef option
1486- abstract IUnknownConstantAttributeScopeRef : ILScopeRef option
1487- abstract ArgIteratorTypeScopeRef : ILScopeRef option
1488- abstract MarshalByRefObjectScopeRef : ILScopeRef option
1489- abstract ThreadStaticAttributeScopeRef : ILScopeRef option
1490- abstract SpecialNameAttributeScopeRef : ILScopeRef option
1491- abstract ContextStaticAttributeScopeRef : ILScopeRef option
1492- abstract NonSerializedAttributeScopeRef : ILScopeRef option
1493-
1494- abstract SystemRuntimeInteropServicesScopeRef : Lazy < ILScopeRef option >
1495- abstract SystemLinqExpressionsScopeRef : Lazy < ILScopeRef >
1496- abstract SystemCollectionsScopeRef : Lazy < ILScopeRef >
1497- abstract SystemReflectionScopeRef : Lazy < ILScopeRef >
1498- abstract SystemDiagnosticsDebugScopeRef : Lazy < ILScopeRef >
1499- abstract ScopeRef : ILScopeRef
15001478
15011479// ====================================================================
15021480// PART 2
@@ -1509,103 +1487,34 @@ type IPrimaryAssemblyTraits =
15091487/// A table of common references to items in primary assebly (System.Runtime or mscorlib).
15101488/// If a particular version of System.Runtime.dll has been loaded then you should
15111489/// reference items from it via an ILGlobals for that specific version built using mkILGlobals.
1512- [<NoEquality; NoComparison>]
1490+ [<NoEquality; NoComparison; Class >]
15131491type ILGlobals =
1514- {
1515- traits : IPrimaryAssemblyTraits
1516- primaryAssemblyName: string
1517- noDebugData: bool
1518- tref_Object: ILTypeRef
1519- tspec_Object: ILTypeSpec
1520- typ_Object: ILType
1521- tref_String: ILTypeRef
1522- typ_String: ILType
1523- typ_StringBuilder: ILType
1524- typ_AsyncCallback: ILType
1525- typ_IAsyncResult: ILType
1526- typ_IComparable: ILType
1527- tref_Type: ILTypeRef
1528- typ_Type: ILType
1529- typ_Missing: Lazy < ILType >
1530- typ_Activator: ILType
1531- typ_Delegate: ILType
1532- typ_ValueType: ILType
1533- typ_Enum: ILType
1534- tspec_TypedReference: ILTypeSpec option
1535- typ_TypedReference: ILType option
1536- typ_MulticastDelegate: ILType
1537- typ_Array: ILType
1538- tspec_Int64: ILTypeSpec
1539- tspec_UInt64: ILTypeSpec
1540- tspec_Int32: ILTypeSpec
1541- tspec_UInt32: ILTypeSpec
1542- tspec_Int16: ILTypeSpec
1543- tspec_UInt16: ILTypeSpec
1544- tspec_SByte: ILTypeSpec
1545- tspec_Byte: ILTypeSpec
1546- tspec_Single: ILTypeSpec
1547- tspec_Double: ILTypeSpec
1548- tspec_IntPtr: ILTypeSpec
1549- tspec_UIntPtr: ILTypeSpec
1550- tspec_Char: ILTypeSpec
1551- tspec_Bool: ILTypeSpec
1552- typ_int8: ILType
1553- typ_int16: ILType
1554- typ_int32: ILType
1555- typ_int64: ILType
1556- typ_uint8: ILType
1557- typ_uint16: ILType
1558- typ_uint32: ILType
1559- typ_uint64: ILType
1560- typ_float32: ILType
1561- typ_float64: ILType
1562- typ_bool: ILType
1563- typ_char: ILType
1564- typ_IntPtr: ILType
1565- typ_UIntPtr: ILType
1566- typ_RuntimeArgumentHandle: ILType option
1567- typ_RuntimeTypeHandle: ILType
1568- typ_RuntimeMethodHandle: ILType
1569- typ_RuntimeFieldHandle: ILType
1570- typ_Byte: ILType
1571- typ_Int16: ILType
1572- typ_Int32: ILType
1573- typ_Int64: ILType
1574- typ_SByte: ILType
1575- typ_UInt16: ILType
1576- typ_UInt32: ILType
1577- typ_UInt64: ILType
1578- typ_Single: ILType
1579- typ_Double: ILType
1580- typ_Bool: ILType
1581- typ_Char: ILType
1582- typ_SerializationInfo: ILType option
1583- typ_StreamingContext: ILType
1584- tref_SecurityPermissionAttribute : ILTypeRef option
1585- tspec_Exception: ILTypeSpec
1586- typ_Exception: ILType
1587- mutable generatedAttribsCache: ILAttribute list
1588- mutable debuggerBrowsableNeverAttributeCache : ILAttribute option
1589- mutable debuggerTypeProxyAttributeCache : ILAttribute option }
1590-
1591- with
1592- member mkDebuggableAttribute : bool (* disable JIT optimizations *) -> ILAttribute
1593- /// Some commonly used custom attibutes
1594- member mkDebuggableAttributeV2 : bool (* jitTracking *) * bool (* ignoreSymbolStoreSequencePoints *) * bool (* disable JIT optimizations *) * bool (* enable EnC *) -> ILAttribute
1595- member mkCompilerGeneratedAttribute : unit -> ILAttribute
1596- member mkDebuggerNonUserCodeAttribute : unit -> ILAttribute
1597- member mkDebuggerStepThroughAttribute : unit -> ILAttribute
1598- member mkDebuggerHiddenAttribute : unit -> ILAttribute
1599- member mkDebuggerDisplayAttribute : string -> ILAttribute
1600- member mkDebuggerTypeProxyAttribute : ILType -> ILAttribute
1601- member mkDebuggerBrowsableNeverAttribute : unit -> ILAttribute
1602-
1603- /// Build the table of commonly used references given an < c > ILScopeRef </ c > for system runtime assembly.
1604- val mkILGlobals : IPrimaryAssemblyTraits -> string option -> bool -> ILGlobals
1605-
1606- val mkMscorlibBasedTraits : ILScopeRef -> IPrimaryAssemblyTraits
1607-
1608- val EcmaILGlobals : ILGlobals
1492+ member primaryAssemblyScopeRef : ILScopeRef
1493+ member primaryAssemblyName : string
1494+ member typ_Object : ILType
1495+ member typ_String : ILType
1496+ member typ_Type : ILType
1497+ member typ_Array : ILType
1498+ member typ_IntPtr : ILType
1499+ member typ_UIntPtr : ILType
1500+ member typ_Byte : ILType
1501+ member typ_Int16 : ILType
1502+ member typ_Int32 : ILType
1503+ member typ_Int64 : ILType
1504+ member typ_SByte : ILType
1505+ member typ_UInt16 : ILType
1506+ member typ_UInt32 : ILType
1507+ member typ_UInt64 : ILType
1508+ member typ_Single : ILType
1509+ member typ_Double : ILType
1510+ member typ_Bool : ILType
1511+ member typ_Char : ILType
1512+
1513+
1514+ /// Build the table of commonly used references given functions to find types in system assemblies
1515+ val mkILGlobals : ILScopeRef -> ILGlobals
1516+
1517+ val EcmaMscorlibILGlobals : ILGlobals
16091518
16101519/// When writing a binary the fake "toplevel" type definition (called <Module >)
16111520/// must come first. This function puts it first, and creates it in the returned
@@ -1784,7 +1693,7 @@ val mkILTypeDefForGlobalFunctions: ILGlobals -> ILMethodDefs * ILFieldDefs -> IL
17841693/// ldtoken field valuetype ' < PrivateImplementationDetails > ' / ' $$struct0x6000127 - 1' ' < PrivateImplementationDetails > ' :: ' $$method0x6000127 - 1'
17851694/// call void System.Runtime.CompilerServices.RuntimeHelpers :: InitializeArray ( class System.Array , valuetype System.RuntimeFieldHandle )
17861695/// idiom.
1787- val mkRawDataValueTypeDef : ILGlobals -> string * size : int32 * pack : uint16 -> ILTypeDef
1696+ val mkRawDataValueTypeDef : ILType -> string * size : int32 * pack : uint16 -> ILTypeDef
17881697
17891698/// Injecting code into existing code blocks. A branch will
17901699/// be added from the given instructions to the ( unique ) entry of
@@ -1804,7 +1713,7 @@ val mkILStorageCtor: ILSourceMarker option * ILInstr list * ILType * (string * I
18041713val mkILSimpleStorageCtor : ILSourceMarker option * ILTypeSpec option * ILType * ( string * ILType ) list * ILMemberAccess -> ILMethodDef
18051714val mkILSimpleStorageCtorWithParamNames : ILSourceMarker option * ILTypeSpec option * ILType * ( string * string * ILType ) list * ILMemberAccess -> ILMethodDef
18061715
1807- val mkILDelegateMethods : ILGlobals -> ILParameter list * ILReturn -> ILMethodDef list
1716+ val mkILDelegateMethods : ILGlobals -> ILType * ILType -> ILParameter list * ILReturn -> ILMethodDef list
18081717
18091718/// Given a delegate type definition which lies in a particular scope ,
18101719/// make a reference to its constructor.
@@ -1926,38 +1835,10 @@ val rescopeILMethodRef: ILScopeRef -> ILMethodRef -> ILMethodRef
19261835/// the new scope.
19271836val rescopeILFieldRef : ILScopeRef -> ILFieldRef -> ILFieldRef
19281837
1929-
19301838//-----------------------------------------------------------------------
19311839// The ILCode Builder utility.
19321840//----------------------------------------------------------------------
19331841
1934-
1935- /// buildILCode : Build code from a sequence of instructions.
1936- ///
1937- /// e.g. "buildILCode meth resolver instrs exns locals "
1938- ///
1939- /// This makes the basic block structure of code from more primitive
1940- /// information , i.e. an array of instructions.
1941- /// [ meth ]: for debugging and should give the name of the method.
1942- /// [ resolver ]: should return the instruction indexes referred to
1943- /// by code - label strings in the instruction stream.
1944- /// [ instrs ]: the instructions themselves , perhaps with attributes giving
1945- /// debugging information
1946- /// [ exns ]: the table of exception - handling specifications
1947- /// for the method. These are again given with respect to labels which will
1948- /// be mapped to pc's by [ resolver ].
1949- /// [ locals ]: the table of specifications of when local variables are live and
1950- /// should appear in the debug info.
1951- ///
1952- /// If the input code is well - formed , the function will returns the
1953- /// chop up the instruction sequence into basic blocks as required for
1954- /// the exception handlers and then return the tree - structured code
1955- /// corresponding to the instruction stream.
1956- /// A new set of code labels will be used throughout the resulting code.
1957- ///
1958- /// The input can be badly formed in many ways : exception handlers might
1959- /// overlap , or scopes of local variables may overlap badly with
1960- /// exception handlers.
19611842val buildILCode : string -> lab2pc : Dictionary < ILCodeLabel , int > -> instrs : ILInstr [] -> ILExceptionSpec list -> ILLocalDebugInfo list -> ILCode
19621843
19631844// --------------------------------------------------------------------
@@ -1977,18 +1858,6 @@ val instILType: ILGenericArgs -> ILType -> ILType
19771858/// This is a 'vendor neutral' way of referencing mscorlib.
19781859val ecmaPublicKey : PublicKey
19791860
1980- /// Some commonly used methods.
1981- val mkInitializeArrayMethSpec : ILGlobals -> ILMethodSpec
1982-
1983- val mkPrimaryAssemblyExnNewobj : ILGlobals -> string -> ILInstr
1984-
1985- val addMethodGeneratedAttrs : ILGlobals -> ILMethodDef -> ILMethodDef
1986- val addPropertyGeneratedAttrs : ILGlobals -> ILPropertyDef -> ILPropertyDef
1987- val addFieldGeneratedAttrs : ILGlobals -> ILFieldDef -> ILFieldDef
1988-
1989- val addPropertyNeverAttrs : ILGlobals -> ILPropertyDef -> ILPropertyDef
1990- val addFieldNeverAttrs : ILGlobals -> ILFieldDef -> ILFieldDef
1991-
19921861/// Discriminating different important built - in types.
19931862val isILObjectTy : ILType -> bool
19941863val isILStringTy : ILType -> bool
0 commit comments