Skip to content

Commit 592e933

Browse files
authored
Merge pull request #9383 from dotnet/merges/master-to-release/dev16.7
Merge master to release/dev16.7
2 parents 5455a09 + d0c19d8 commit 592e933

File tree

7 files changed

+42
-68
lines changed

7 files changed

+42
-68
lines changed

src/absil/il.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3708,6 +3708,7 @@ let getCustomAttrData (ilg: ILGlobals) cattr =
37083708
let MscorlibScopeRef = ILScopeRef.Assembly (ILAssemblyRef.Create ("mscorlib", None, Some ecmaPublicKey, true, None, None))
37093709

37103710
let EcmaMscorlibILGlobals = mkILGlobals (MscorlibScopeRef, [])
3711+
let PrimaryAssemblyILGlobals = mkILGlobals (ILScopeRef.PrimaryAssembly, [])
37113712

37123713
// ILSecurityDecl is a 'blob' having the following format:
37133714
// - A byte containing a period (.).

src/absil/il.fsi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,7 @@ type ILGlobals =
16141614
val mkILGlobals: primaryScopeRef: ILScopeRef * assembliesThatForwardToPrimaryAssembly: ILAssemblyRef list -> ILGlobals
16151615

16161616
val EcmaMscorlibILGlobals: ILGlobals
1617+
val PrimaryAssemblyILGlobals: ILGlobals
16171618

16181619
/// When writing a binary the fake "toplevel" type definition (called <Module>)
16191620
/// must come first. This function puts it first, and creates it in the returned

src/absil/ilascii.fs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ open Internal.Utilities.Collections
77
open FSharp.Compiler.AbstractIL.Internal.Library
88
open FSharp.Compiler.AbstractIL.IL
99

10-
// set to the proper value at CompileOps.fs (BuildFrameworkTcImports)
11-
// Only relevant when compiling FSharp.Core.dll
12-
let mutable parseILGlobals = EcmaMscorlibILGlobals
13-
1410
/// Table of parsing and pretty printing data for instructions.
1511
let noArgInstrs =
1612
lazy [

src/absil/ilascii.fsi

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ open FSharp.Compiler.AbstractIL.Internal
1010
open FSharp.Compiler.AbstractIL.Extensions.ILX.Types
1111
open FSharp.Compiler.AbstractIL.IL
1212

13-
// --------------------------------------------------------------------
14-
// IL Parser state - must be initialized before parsing a module
15-
// --------------------------------------------------------------------
16-
17-
val mutable parseILGlobals: ILGlobals
18-
1913
// --------------------------------------------------------------------
2014
// IL Lexer and pretty-printer tables
2115
// --------------------------------------------------------------------

src/absil/ilpars.fsy

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,6 @@ let resolveMethodSpecScopeThen (ResolvedAtMethodSpecScope f) g =
3131
let resolveCurrentMethodSpecScope obj =
3232
resolveMethodSpecScope obj mkILEmptyGenericParams
3333

34-
35-
let findSystemRuntimeAssemblyRef() =
36-
match parseILGlobals.primaryAssemblyScopeRef with
37-
| ILScopeRef.Assembly aref -> aref
38-
| _ -> pfailwith "systemRuntimeScopeRef not set to valid assembly reference in parseILGlobals"
39-
40-
let findAssemblyRef nm =
41-
if nm = "mscorlib" then findSystemRuntimeAssemblyRef()
42-
else
43-
pfailwith ("Undefined assembly ref '" + nm + "'")
44-
4534
%}
4635

4736
/*-----------------------------------------------------------------------
@@ -178,8 +167,7 @@ name1:
178167
className:
179168
LBRACK name1 RBRACK slashedName
180169
{ let (enc,nm) = $4
181-
let aref = findAssemblyRef $2
182-
ILScopeRef.Assembly aref, enc, nm }
170+
ILScopeRef.PrimaryAssembly, enc, nm }
183171
| slashedName
184172
{ let enc, nm = $1 in (ILScopeRef.Local, enc, nm) }
185173

@@ -235,9 +223,9 @@ callKind:
235223
*---------------------------------------------*/
236224

237225
typ: STRING
238-
{ noMethodSpecScope parseILGlobals.typ_String }
226+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_String }
239227
| OBJECT
240-
{ noMethodSpecScope parseILGlobals.typ_Object }
228+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_Object }
241229
| CLASS typeNameInst
242230
{ resolveMethodSpecScopeThen $2 (fun tspec ->
243231
noMethodSpecScope (mkILBoxedType tspec)) }
@@ -256,45 +244,45 @@ typ: STRING
256244
| typ STAR
257245
{ resolveMethodSpecScopeThen $1 (fun ty -> noMethodSpecScope (ILType.Ptr ty)) }
258246
| CHAR
259-
{ noMethodSpecScope parseILGlobals.typ_Char }
247+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_Char }
260248
| VOID
261249
{ noMethodSpecScope ILType.Void }
262250
| BOOL
263-
{ noMethodSpecScope parseILGlobals.typ_Bool }
251+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_Bool }
264252
| INT8
265-
{ noMethodSpecScope parseILGlobals.typ_SByte }
253+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_SByte }
266254
| INT16
267-
{ noMethodSpecScope parseILGlobals.typ_Int16 }
255+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_Int16 }
268256
| INT32
269-
{ noMethodSpecScope parseILGlobals.typ_Int32 }
257+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_Int32 }
270258
| INT64
271-
{ noMethodSpecScope parseILGlobals.typ_Int64 }
259+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_Int64 }
272260
| FLOAT32
273-
{ noMethodSpecScope parseILGlobals.typ_Single }
261+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_Single }
274262
| FLOAT64
275-
{ noMethodSpecScope parseILGlobals.typ_Double }
263+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_Double }
276264
| UNSIGNED INT8
277-
{ noMethodSpecScope parseILGlobals.typ_Byte }
265+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_Byte }
278266
| UNSIGNED INT16
279-
{ noMethodSpecScope parseILGlobals.typ_UInt16 }
267+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_UInt16 }
280268
| UNSIGNED INT32
281-
{ noMethodSpecScope parseILGlobals.typ_UInt32 }
269+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_UInt32 }
282270
| UNSIGNED INT64
283-
{ noMethodSpecScope parseILGlobals.typ_UInt64 }
271+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_UInt64 }
284272
| UINT8
285-
{ noMethodSpecScope parseILGlobals.typ_Byte }
273+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_Byte }
286274
| UINT16
287-
{ noMethodSpecScope parseILGlobals.typ_UInt16 }
275+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_UInt16 }
288276
| UINT32
289-
{ noMethodSpecScope parseILGlobals.typ_UInt32 }
277+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_UInt32 }
290278
| UINT64
291-
{ noMethodSpecScope parseILGlobals.typ_UInt64 }
279+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_UInt64 }
292280
| NATIVE INT
293-
{ noMethodSpecScope parseILGlobals.typ_IntPtr }
281+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_IntPtr }
294282
| NATIVE UNSIGNED INT
295-
{ noMethodSpecScope parseILGlobals.typ_UIntPtr }
283+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_UIntPtr }
296284
| NATIVE UINT
297-
{ noMethodSpecScope parseILGlobals.typ_UIntPtr }
285+
{ noMethodSpecScope PrimaryAssemblyILGlobals.typ_UIntPtr }
298286

299287
| BANG int32
300288
{ noMethodSpecScope (ILType.TypeVar (uint16 ( $2))) }

src/absil/ilread.fs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ open System.Reflection
3333

3434
#nowarn "9"
3535

36-
let primaryAssemblyILGlobals = mkILGlobals (ILScopeRef.PrimaryAssembly, [])
37-
3836
let checking = false
3937
let logging = false
4038
let _ = if checking then dprintn "warning: ILBinaryReader.checking is on"
@@ -1717,7 +1715,7 @@ and seekReadTypeDefOrRefAsTypeRef (ctxt: ILMetadataReader) (TaggedIndex(tag, idx
17171715
| tag when tag = tdor_TypeRef -> seekReadTypeRef ctxt idx
17181716
| tag when tag = tdor_TypeSpec ->
17191717
dprintn ("type spec used where a type ref or def is required")
1720-
primaryAssemblyILGlobals.typ_Object.TypeRef
1718+
PrimaryAssemblyILGlobals.typ_Object.TypeRef
17211719
| _ -> failwith "seekReadTypeDefOrRefAsTypeRef_readTypeDefOrRefOrSpec"
17221720

17231721
and seekReadMethodRefParent (ctxt: ILMetadataReader) mdv numtypars (TaggedIndex(tag, idx)) =
@@ -1835,22 +1833,22 @@ and sigptrGetTypeDefOrRefOrSpecIdx bytes sigptr =
18351833

18361834
and sigptrGetTy (ctxt: ILMetadataReader) numtypars bytes sigptr =
18371835
let b0, sigptr = sigptrGetByte bytes sigptr
1838-
if b0 = et_OBJECT then primaryAssemblyILGlobals.typ_Object, sigptr
1839-
elif b0 = et_STRING then primaryAssemblyILGlobals.typ_String, sigptr
1840-
elif b0 = et_I1 then primaryAssemblyILGlobals.typ_SByte, sigptr
1841-
elif b0 = et_I2 then primaryAssemblyILGlobals.typ_Int16, sigptr
1842-
elif b0 = et_I4 then primaryAssemblyILGlobals.typ_Int32, sigptr
1843-
elif b0 = et_I8 then primaryAssemblyILGlobals.typ_Int64, sigptr
1844-
elif b0 = et_I then primaryAssemblyILGlobals.typ_IntPtr, sigptr
1845-
elif b0 = et_U1 then primaryAssemblyILGlobals.typ_Byte, sigptr
1846-
elif b0 = et_U2 then primaryAssemblyILGlobals.typ_UInt16, sigptr
1847-
elif b0 = et_U4 then primaryAssemblyILGlobals.typ_UInt32, sigptr
1848-
elif b0 = et_U8 then primaryAssemblyILGlobals.typ_UInt64, sigptr
1849-
elif b0 = et_U then primaryAssemblyILGlobals.typ_UIntPtr, sigptr
1850-
elif b0 = et_R4 then primaryAssemblyILGlobals.typ_Single, sigptr
1851-
elif b0 = et_R8 then primaryAssemblyILGlobals.typ_Double, sigptr
1852-
elif b0 = et_CHAR then primaryAssemblyILGlobals.typ_Char, sigptr
1853-
elif b0 = et_BOOLEAN then primaryAssemblyILGlobals.typ_Bool, sigptr
1836+
if b0 = et_OBJECT then PrimaryAssemblyILGlobals.typ_Object, sigptr
1837+
elif b0 = et_STRING then PrimaryAssemblyILGlobals.typ_String, sigptr
1838+
elif b0 = et_I1 then PrimaryAssemblyILGlobals.typ_SByte, sigptr
1839+
elif b0 = et_I2 then PrimaryAssemblyILGlobals.typ_Int16, sigptr
1840+
elif b0 = et_I4 then PrimaryAssemblyILGlobals.typ_Int32, sigptr
1841+
elif b0 = et_I8 then PrimaryAssemblyILGlobals.typ_Int64, sigptr
1842+
elif b0 = et_I then PrimaryAssemblyILGlobals.typ_IntPtr, sigptr
1843+
elif b0 = et_U1 then PrimaryAssemblyILGlobals.typ_Byte, sigptr
1844+
elif b0 = et_U2 then PrimaryAssemblyILGlobals.typ_UInt16, sigptr
1845+
elif b0 = et_U4 then PrimaryAssemblyILGlobals.typ_UInt32, sigptr
1846+
elif b0 = et_U8 then PrimaryAssemblyILGlobals.typ_UInt64, sigptr
1847+
elif b0 = et_U then PrimaryAssemblyILGlobals.typ_UIntPtr, sigptr
1848+
elif b0 = et_R4 then PrimaryAssemblyILGlobals.typ_Single, sigptr
1849+
elif b0 = et_R8 then PrimaryAssemblyILGlobals.typ_Double, sigptr
1850+
elif b0 = et_CHAR then PrimaryAssemblyILGlobals.typ_Char, sigptr
1851+
elif b0 = et_BOOLEAN then PrimaryAssemblyILGlobals.typ_Bool, sigptr
18541852
elif b0 = et_WITH then
18551853
let b0, sigptr = sigptrGetByte bytes sigptr
18561854
let tdorIdx, sigptr = sigptrGetTypeDefOrRefOrSpecIdx bytes sigptr
@@ -1896,7 +1894,7 @@ and sigptrGetTy (ctxt: ILMetadataReader) numtypars bytes sigptr =
18961894

18971895
elif b0 = et_VOID then ILType.Void, sigptr
18981896
elif b0 = et_TYPEDBYREF then
1899-
primaryAssemblyILGlobals.typ_TypedReference, sigptr
1897+
PrimaryAssemblyILGlobals.typ_TypedReference, sigptr
19001898
elif b0 = et_CMOD_REQD || b0 = et_CMOD_OPT then
19011899
let tdorIdx, sigptr = sigptrGetTypeDefOrRefOrSpecIdx bytes sigptr
19021900
let ty, sigptr = sigptrGetTy ctxt numtypars bytes sigptr

src/fsharp/CompileOps.fs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4941,10 +4941,6 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
49414941
#if DEBUG
49424942
// the global_g reference cell is used only for debug printing
49434943
global_g <- Some tcGlobals
4944-
#endif
4945-
// do this prior to parsing, since parsing IL assembly code may refer to mscorlib
4946-
#if !NO_INLINE_IL_PARSER
4947-
FSharp.Compiler.AbstractIL.Internal.AsciiConstants.parseILGlobals <- tcGlobals.ilg
49484944
#endif
49494945
frameworkTcImports.SetTcGlobals tcGlobals
49504946
return tcGlobals, frameworkTcImports

0 commit comments

Comments
 (0)