Skip to content

Commit 2c551a0

Browse files
committed
baselines + fsx
1 parent 488ef8e commit 2c551a0

19 files changed

+8615
-3004
lines changed

src/Compiler/CodeGen/IlxGen.fs

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,8 @@ let GetDynamicallyAccessedMemberTypes cenv =
777777

778778
if not (cenv.g.compilingFSharpCore) then
779779
cenv.g.TryEmbedILType(
780-
tref, (fun () ->
780+
tref,
781+
(fun () ->
781782
let values =
782783
[|
783784
("All", -1)
@@ -798,23 +799,36 @@ let GetDynamicallyAccessedMemberTypes cenv =
798799
("Interfaces", 8192)
799800
|]
800801

801-
mkLocalPrivateInt32Enum (cenv, tref, values)))
802+
mkLocalPrivateInt32Enum (cenv, tref, values))
803+
)
802804

803805
ILType.Value(mkILNonGenericTySpec (tref))
804806

805807
let GetDynamicDependencyAttribute cenv memberTypes ilType =
806808
let tref = cenv.g.attrib_DynamicDependencyAttribute.TypeRef
807809

808810
cenv.g.TryEmbedILType(
809-
tref, (
810-
fun () ->
811-
let properties = Some [ "MemberType", GetDynamicallyAccessedMemberTypes cenv; "Type", cenv.g.ilg.typ_Type ]
812-
mkLocalPrivateAttributeWithPropertyConstructors (cenv, tref.Name, properties)))
811+
tref,
812+
(fun () ->
813+
let properties =
814+
Some
815+
[
816+
"MemberType", GetDynamicallyAccessedMemberTypes cenv
817+
"Type", cenv.g.ilg.typ_Type
818+
]
819+
820+
mkLocalPrivateAttributeWithPropertyConstructors (cenv, tref.Name, properties))
821+
)
813822

814823
let typIlMemberTypes =
815824
ILType.Value(mkILNonGenericTySpec (cenv.g.enum_DynamicallyAccessedMemberTypes.TypeRef))
816825

817-
mkILCustomAttribute (tref, [ typIlMemberTypes; cenv.g.ilg.typ_Type ], [ ILAttribElem.Int32 memberTypes; ILAttribElem.Type (Some ilType) ], [])
826+
mkILCustomAttribute (
827+
tref,
828+
[ typIlMemberTypes; cenv.g.ilg.typ_Type ],
829+
[ ILAttribElem.Int32 memberTypes; ILAttribElem.Type(Some ilType) ],
830+
[]
831+
)
818832

819833
/// Generate "modreq([mscorlib]System.Runtime.InteropServices.InAttribute)" on inref types.
820834
let GenReadOnlyModReqIfNecessary (g: TcGlobals) ty ilTy =
@@ -11244,7 +11258,17 @@ and GenTypeDef cenv mgbuf lazyInitInfo eenv m (tycon: Tycon) =
1124411258
reprAccess,
1124511259
None,
1124611260
eenv.imports
11247-
)).With(customAttrs = mkILCustomAttrs [ GetDynamicDependencyAttribute cenv 0x660 (*Public and NonPublic Fields and Properties*) ilThisTy ])
11261+
))
11262+
.With(
11263+
customAttrs =
11264+
mkILCustomAttrs
11265+
[
11266+
GetDynamicDependencyAttribute
11267+
cenv
11268+
0x660 (*Public and NonPublic Fields and Properties*)
11269+
ilThisTy
11270+
]
11271+
)
1124811272

1124911273
yield ilMethodDef
1125011274
// FSharp 1.0 bug 1988: Explicitly setting the ComVisible(true) attribute on an F# type causes an F# record to be emitted in a way that enables mutation for COM interop scenarios

src/Compiler/Driver/CreateILModule.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ module MainModuleBuilder =
304304
RequireCompilationThread ctok
305305

306306
let ilTypeDefs =
307-
mkILTypeDefs (codegenResults.ilTypeDefs @ tcGlobals.embeddedTypeDefs)
307+
mkILTypeDefs (codegenResults.ilTypeDefs @ tcGlobals.tryRemoveEmbeddedILTypeDefs ())
308308

309309
let mainModule =
310310
let hashAlg =

src/Compiler/Interactive/fsi.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,8 +1426,9 @@ type internal FsiDynamicCompiler(
14261426

14271427
/// Generate one assembly using multi-assembly emit
14281428
let EmitInMemoryAssembly (tcConfig: TcConfig, emEnv: ILMultiInMemoryAssemblyEmitEnv, ilxMainModule: ILModuleDef) =
1429+
let embeddedTypes = tcGlobals.tryRemoveEmbeddedILTypeDefs() |> List.filter(fun tdef -> not(emEnv.IsLocalInternalType(mkRefForNestedILTypeDef ILScopeRef.Local ([], tdef))))
1430+
let ilxMainModule = { ilxMainModule with TypeDefs = mkILTypeDefs (ilxMainModule.TypeDefs.AsList() @ embeddedTypes) }
14291431
let multiAssemblyName = ilxMainModule.ManifestOfAssembly.Name
1430-
14311432
// Adjust the assembly name of this fragment, and add InternalsVisibleTo attributes to
14321433
// allow internals access by all future assemblies with the same name (and only differing in version)
14331434
let manifest =

src/Compiler/TypedTree/TcGlobals.fs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,13 @@ type TcGlobals(
10511051

10521052
member _.embeddedTypeDefs = embeddedILTypeDefs.Values |> Seq.toList
10531053

1054+
member _.tryRemoveEmbeddedILTypeDefs () = [
1055+
for key in embeddedILTypeDefs.Keys do
1056+
match (embeddedILTypeDefs.TryRemove(key)) with
1057+
| true, ilTypeDef -> yield ilTypeDef
1058+
| false, _ -> ()
1059+
]
1060+
10541061
// A table of all intrinsics that the compiler cares about
10551062
member _.knownIntrinsics = v_knownIntrinsics
10561063

0 commit comments

Comments
 (0)