Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit75e435e

Browse files
authored
Use Roslyn for backing metadata bytes in VS (#4586)
* weak ByteFile* cleanup, only use in VS* cleanup flags* some comments* some comments* use Roslyn memory manager for metadata in VS* report statistics only with --times, clarify flags2* minor updates* us in VS* fix build* fix build* fix build* add SFH to FileSystem* fix build* fix build* fix build* fix build* add some comments
1 parent3273ed0 commit75e435e

File tree

47 files changed

+1904
-1475
lines changed

Some content is hidden

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

47 files changed

+1904
-1475
lines changed

‎fcs/build.fsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let isMono = false
2424
// Utilities
2525
// --------------------------------------------------------------------------------------
2626

27-
letdotnetExePath= DotNetCli.InstallDotNetSDK"2.1.4"
27+
letdotnetExePath= DotNetCli.InstallDotNetSDK"2.1.100"
2828

2929
letrunDotnet workingDir args=
3030
letresult=

‎src/absil/il.fs‎

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,7 @@ type MethodBody =
13241324
| PInvokeofPInvokeMethod(* platform invoke to native*)
13251325
| Abstract
13261326
| Native
1327+
| NotAvailable
13271328

13281329
typeILLazyMethodBody=
13291330
| ILLazyMethodBodyofLazy<MethodBody>
@@ -1859,7 +1860,8 @@ type ILResourceAccess =
18591860

18601861
[<RequireQualifiedAccess>]
18611862
typeILResourceLocation=
1862-
| Localof(unit->byte[])
1863+
| LocalInofstring*int*int
1864+
| LocalOutofbyte[]
18631865
| FileofILModuleRef*int32
18641866
| AssemblyofILAssemblyRef
18651867

@@ -1868,15 +1870,16 @@ type ILResource =
18681870
Location:ILResourceLocation;
18691871
Access:ILResourceAccess;
18701872
CustomAttrs:ILAttributes}
1871-
/// Read the bytes from a resource local to an assembly
1872-
memberr.Bytes=
1873-
match r.Locationwith
1874-
| ILResourceLocation.Local b-> b()
1875-
|_-> failwith"Bytes"
1873+
memberr.GetBytes()=
1874+
match r.Locationwith
1875+
| ILResourceLocation.LocalIn(file, start, len)->
1876+
FileSystem.ReadAllBytesShim(file).[start.. start+ len-1]
1877+
| ILResourceLocation.LocalOut bytes-> bytes
1878+
|_-> failwith"GetBytes"
18761879

18771880
typeILResources=
1878-
| ILResourcesofLazy<ILResourcelist>
1879-
memberx.AsList=let(ILResources ltab)= xin(ltab.Force())
1881+
| ILResourcesofILResourcelist
1882+
memberx.AsList=let(ILResources ltab)= xin ltab
18801883

18811884
// --------------------------------------------------------------------
18821885
// One module in the "current" assembly
@@ -1912,6 +1915,11 @@ type ILAssemblyManifest =
19121915
EntrypointElsewhere:ILModuleRef option
19131916
}
19141917

1918+
[<RequireQualifiedAccess>]
1919+
typeILNativeResource=
1920+
| InoffileName:string*linkedResourceBase:int*linkedResourceStart:int*linkedResourceLength:int
1921+
| OutofunlinkedResource:byte[]
1922+
19151923
typeILModuleDef=
19161924
{ Manifest:ILAssemblyManifest option
19171925
CustomAttrs:ILAttributes
@@ -1923,7 +1931,7 @@ type ILModuleDef =
19231931
SubSystemFlags:int32
19241932
IsDLL:bool
19251933
IsILOnly:bool
1926-
Platform:ILPlatform option
1934+
Platform:ILPlatform option
19271935
StackReserveSize:int32 option
19281936
Is32Bit:bool
19291937
Is32BitPreferred:bool
@@ -1933,7 +1941,7 @@ type ILModuleDef =
19331941
ImageBase:int32
19341942
MetadataVersion:string
19351943
Resources:ILResources
1936-
NativeResources:list<Lazy<byte[]>>(* e.g. win32 resources*)
1944+
NativeResources:ILNativeResourcelist(* e.g. win32 resources*)
19371945
}
19381946
memberx.ManifestOfAssembly=
19391947
match x.Manifestwith
@@ -2515,6 +2523,9 @@ let mkMethodBody (zeroinit,locals,maxstack,code,tag) = MethodBody.IL (mkILMethod
25152523

25162524
letmkILVoidReturn= mkILReturn ILType.Void
25172525

2526+
letmethBodyNotAvailable= mkMethBodyAux MethodBody.NotAvailable
2527+
letmethBodyAbstract= mkMethBodyAux MethodBody.Abstract
2528+
letmethBodyNative= mkMethBodyAux MethodBody.Native
25182529

25192530
letmkILCtor(access,args,impl)=
25202531
ILMethodDef(name=".ctor",
@@ -2764,8 +2775,7 @@ let mkILNestedExportedTypes l =
27642775
letmkILNestedExportedTypesLazy(l:Lazy<_>)=
27652776
ILNestedExportedTypes(lazy(List.foldBack addNestedExportedTypeToTable(l.Force()) Map.empty))
27662777

2767-
letmkILResources l= ILResources(notlazy l)
2768-
letmkILResourcesLazy l= ILResources l
2778+
letmkILResources l= ILResources l
27692779

27702780
letaddMethodImplToTable y tab=
27712781
letkey=(y.Overrides.MethodRef.Name,y.Overrides.MethodRef.ArgTypes.Length)
@@ -3751,7 +3761,8 @@ and refs_of_exported_types s (tab: ILExportedTypesAndForwarders) = List.iter (re
37513761

37523762
andrefs_of_resource_where s x=
37533763
match xwith
3754-
| ILResourceLocation.Local_->()
3764+
| ILResourceLocation.LocalIn_->()
3765+
| ILResourceLocation.LocalOut_->()
37553766
| ILResourceLocation.File(mref,_)-> refs_of_modref s mref
37563767
| ILResourceLocation.Assembly aref-> refs_of_assref s aref
37573768

‎src/absil/il.fsi‎

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,7 @@ type MethodBody =
988988
| PInvokeofPInvokeMethod(* platform invoke to native*)
989989
| Abstract
990990
| Native
991+
| NotAvailable
991992

992993
// REVIEW: fold this into ILMethodDef.
993994
[<RequireQualifiedAccess>]
@@ -1426,8 +1427,16 @@ type ILResourceAccess =
14261427

14271428
[<RequireQualifiedAccess>]
14281429
typeILResourceLocation=
1429-
| Localof(unit->byte[])(* resources may be re-read each time this function is called*)
1430+
/// Represents a manifest resource that can be read from within the PE file
1431+
| LocalInofstring*int*int
1432+
1433+
/// Represents a manifest resource that is due to be written to the output PE file
1434+
| LocalOutofbyte[]
1435+
1436+
/// Represents a manifest resource in an associated file
14301437
| FileofILModuleRef*int32
1438+
1439+
/// Represents a manifest resource in a different assembly
14311440
| AssemblyofILAssemblyRef
14321441

14331442
/// "Manifest ILResources" are chunks of resource data, being one of:
@@ -1439,8 +1448,9 @@ type ILResource =
14391448
Location:ILResourceLocation
14401449
Access:ILResourceAccess
14411450
CustomAttrs:ILAttributes}
1442-
/// Read the bytes from a resource local to an assembly
1443-
memberBytes:byte[]
1451+
1452+
/// Read the bytes from a resource local to an assembly. Will fail for non-local resources.
1453+
memberGetBytes:unit->byte[]
14441454

14451455
/// Table of resources in a module.
14461456
[<NoEquality; NoComparison>]
@@ -1487,7 +1497,15 @@ type ILAssemblyManifest =
14871497
/// Records whether the entrypoint resides in another module.
14881498
EntrypointElsewhere:ILModuleRef option
14891499
}
1490-
1500+
1501+
[<RequireQualifiedAccess>]
1502+
typeILNativeResource=
1503+
/// Represents a native resource to be read from the PE file
1504+
| InoffileName:string*linkedResourceBase:int*linkedResourceStart:int*linkedResourceLength:int
1505+
1506+
/// Represents a native resource to be written in an output file
1507+
| OutofunlinkedResource:byte[]
1508+
14911509
/// One module in the "current" assembly, either a main-module or
14921510
/// an auxiliary module. The main module will have a manifest.
14931511
///
@@ -1512,9 +1530,9 @@ type ILModuleDef =
15121530
PhysicalAlignment:int32
15131531
ImageBase:int32
15141532
MetadataVersion:string
1515-
Resources:ILResources
1516-
/// e.g. win86 resources, as the exact contents of a .res or .obj file.
1517-
NativeResources:Lazy<byte[]> list}
1533+
Resources:ILResources
1534+
/// e.g. win86 resources, as the exact contents of a .res or .obj file.Must be unlinked manually.
1535+
NativeResources:ILNativeResource list}
15181536
memberManifestOfAssembly:ILAssemblyManifest
15191537
memberHasManifest:bool
15201538

@@ -1749,6 +1767,9 @@ val mkILEmptyGenericParams: ILGenericParameterDefs
17491767
/// Make method definitions.
17501768
val mkILMethodBody: initlocals:bool* ILLocals* int* ILCode* ILSourceMarker option-> ILMethodBody
17511769
val mkMethodBody: bool* ILLocals* int* ILCode* ILSourceMarker option-> MethodBody
1770+
val methBodyNotAvailable: ILLazyMethodBody
1771+
val methBodyAbstract: ILLazyMethodBody
1772+
val methBodyNative: ILLazyMethodBody
17521773

17531774
val mkILCtor: ILMemberAccess* ILParameter list* MethodBody-> ILMethodDef
17541775
val mkILClassCtor: MethodBody-> ILMethodDef
@@ -1863,7 +1884,6 @@ val mkILExportedTypes: ILExportedTypeOrForwarder list -> ILExportedTypesAndForwa
18631884
val mkILExportedTypesLazy: Lazy<ILExportedTypeOrForwarder list>-> ILExportedTypesAndForwarders
18641885

18651886
val mkILResources: ILResource list-> ILResources
1866-
val mkILResourcesLazy: Lazy<ILResource list>-> ILResources
18671887

18681888
/// Making modules.
18691889
val mkILSimpleModule: assemblyName:string-> moduleName:string-> dll:bool-> subsystemVersion:(int* int)-> useHighEntropyVA: bool-> ILTypeDefs-> int32 option-> string option-> int-> ILExportedTypesAndForwarders-> string-> ILModuleDef

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp