mirror of
https://github.com/Smaug123/WoofWare.PawPrint
synced 2025-10-05 14:18:40 +00:00
Compare commits
2 Commits
55677a507b
...
a9b2598525
Author | SHA1 | Date | |
---|---|---|---|
|
a9b2598525 | ||
|
e05abbb724 |
@@ -331,6 +331,13 @@ module ConcreteActivePatterns =
|
|||||||
| ConcreteTypeHandle.Pointer inner -> Some inner
|
| ConcreteTypeHandle.Pointer inner -> Some inner
|
||||||
| _ -> None
|
| _ -> None
|
||||||
|
|
||||||
|
type IAssemblyLoad =
|
||||||
|
abstract LoadAssembly :
|
||||||
|
loadedAssemblies : ImmutableDictionary<string, DumpedAssembly> ->
|
||||||
|
referencedIn : AssemblyName ->
|
||||||
|
handle : AssemblyReferenceHandle ->
|
||||||
|
ImmutableDictionary<string, DumpedAssembly> * DumpedAssembly
|
||||||
|
|
||||||
[<RequireQualifiedAccess>]
|
[<RequireQualifiedAccess>]
|
||||||
module TypeConcretization =
|
module TypeConcretization =
|
||||||
|
|
||||||
@@ -406,8 +413,7 @@ module TypeConcretization =
|
|||||||
|
|
||||||
// Helper function for assembly loading with retry pattern
|
// Helper function for assembly loading with retry pattern
|
||||||
let private loadAssemblyAndResolveTypeRef
|
let private loadAssemblyAndResolveTypeRef
|
||||||
(loadAssembly :
|
(loadAssembly : IAssemblyLoad)
|
||||||
AssemblyName -> AssemblyReferenceHandle -> ImmutableDictionary<string, DumpedAssembly> * DumpedAssembly)
|
|
||||||
(ctx : ConcretizationContext<'corelib>)
|
(ctx : ConcretizationContext<'corelib>)
|
||||||
(currentAssembly : AssemblyName)
|
(currentAssembly : AssemblyName)
|
||||||
(typeRef : TypeRef)
|
(typeRef : TypeRef)
|
||||||
@@ -428,7 +434,8 @@ module TypeConcretization =
|
|||||||
// Need to load the assembly
|
// Need to load the assembly
|
||||||
match typeRef.ResolutionScope with
|
match typeRef.ResolutionScope with
|
||||||
| TypeRefResolutionScope.Assembly assyRef ->
|
| TypeRefResolutionScope.Assembly assyRef ->
|
||||||
let newAssemblies, _ = loadAssembly currentAssembly assyRef
|
let newAssemblies, _ =
|
||||||
|
loadAssembly.LoadAssembly ctx.LoadedAssemblies currentAssembly assyRef
|
||||||
|
|
||||||
let newCtx =
|
let newCtx =
|
||||||
{ ctx with
|
{ ctx with
|
||||||
@@ -584,8 +591,7 @@ module TypeConcretization =
|
|||||||
ImmutableArray.Empty // No generic parameters
|
ImmutableArray.Empty // No generic parameters
|
||||||
|
|
||||||
let private concretizeTypeReference
|
let private concretizeTypeReference
|
||||||
(loadAssembly :
|
(loadAssembly : IAssemblyLoad)
|
||||||
AssemblyName -> AssemblyReferenceHandle -> ImmutableDictionary<string, DumpedAssembly> * DumpedAssembly)
|
|
||||||
(ctx : ConcretizationContext<'corelib>)
|
(ctx : ConcretizationContext<'corelib>)
|
||||||
(currentAssembly : AssemblyName)
|
(currentAssembly : AssemblyName)
|
||||||
(typeRef : TypeRef)
|
(typeRef : TypeRef)
|
||||||
@@ -609,8 +615,7 @@ module TypeConcretization =
|
|||||||
/// Concretize a type in a specific generic context
|
/// Concretize a type in a specific generic context
|
||||||
let rec concretizeType
|
let rec concretizeType
|
||||||
(ctx : ConcretizationContext<DumpedAssembly>)
|
(ctx : ConcretizationContext<DumpedAssembly>)
|
||||||
(loadAssembly :
|
(loadAssembly : IAssemblyLoad)
|
||||||
AssemblyName -> AssemblyReferenceHandle -> ImmutableDictionary<string, DumpedAssembly> * DumpedAssembly)
|
|
||||||
(assembly : AssemblyName)
|
(assembly : AssemblyName)
|
||||||
(typeGenerics : ImmutableArray<ConcreteTypeHandle>)
|
(typeGenerics : ImmutableArray<ConcreteTypeHandle>)
|
||||||
(methodGenerics : ImmutableArray<ConcreteTypeHandle>)
|
(methodGenerics : ImmutableArray<ConcreteTypeHandle>)
|
||||||
@@ -706,8 +711,7 @@ module TypeConcretization =
|
|||||||
|
|
||||||
and private concretizeGenericInstantiation
|
and private concretizeGenericInstantiation
|
||||||
(ctx : ConcretizationContext<DumpedAssembly>)
|
(ctx : ConcretizationContext<DumpedAssembly>)
|
||||||
(loadAssembly :
|
(loadAssembly : IAssemblyLoad)
|
||||||
AssemblyName -> AssemblyReferenceHandle -> ImmutableDictionary<string, DumpedAssembly> * DumpedAssembly)
|
|
||||||
(assembly : AssemblyName)
|
(assembly : AssemblyName)
|
||||||
(typeGenerics : ImmutableArray<ConcreteTypeHandle>)
|
(typeGenerics : ImmutableArray<ConcreteTypeHandle>)
|
||||||
(methodGenerics : ImmutableArray<ConcreteTypeHandle>)
|
(methodGenerics : ImmutableArray<ConcreteTypeHandle>)
|
||||||
@@ -786,7 +790,8 @@ module TypeConcretization =
|
|||||||
|
|
||||||
| false, _ ->
|
| false, _ ->
|
||||||
// Need to load the assembly
|
// Need to load the assembly
|
||||||
let newAssemblies, loadedAssy = loadAssembly assembly assyRef
|
let newAssemblies, loadedAssy =
|
||||||
|
loadAssembly.LoadAssembly ctx.LoadedAssemblies assembly assyRef
|
||||||
|
|
||||||
let ctxWithNewAssy =
|
let ctxWithNewAssy =
|
||||||
{ ctxAfterArgs with
|
{ ctxAfterArgs with
|
||||||
@@ -865,8 +870,7 @@ module Concretization =
|
|||||||
/// Helper to concretize an array of types
|
/// Helper to concretize an array of types
|
||||||
let private concretizeTypeArray
|
let private concretizeTypeArray
|
||||||
(ctx : TypeConcretization.ConcretizationContext<DumpedAssembly>)
|
(ctx : TypeConcretization.ConcretizationContext<DumpedAssembly>)
|
||||||
(loadAssembly :
|
(loadAssembly : IAssemblyLoad)
|
||||||
AssemblyName -> AssemblyReferenceHandle -> ImmutableDictionary<string, DumpedAssembly> * DumpedAssembly)
|
|
||||||
(assembly : AssemblyName)
|
(assembly : AssemblyName)
|
||||||
(typeArgs : ImmutableArray<ConcreteTypeHandle>)
|
(typeArgs : ImmutableArray<ConcreteTypeHandle>)
|
||||||
(methodArgs : ImmutableArray<ConcreteTypeHandle>)
|
(methodArgs : ImmutableArray<ConcreteTypeHandle>)
|
||||||
@@ -889,8 +893,7 @@ module Concretization =
|
|||||||
/// Helper to concretize a method signature
|
/// Helper to concretize a method signature
|
||||||
let private concretizeMethodSignature
|
let private concretizeMethodSignature
|
||||||
(ctx : TypeConcretization.ConcretizationContext<DumpedAssembly>)
|
(ctx : TypeConcretization.ConcretizationContext<DumpedAssembly>)
|
||||||
(loadAssembly :
|
(loadAssembly : IAssemblyLoad)
|
||||||
AssemblyName -> AssemblyReferenceHandle -> ImmutableDictionary<string, DumpedAssembly> * DumpedAssembly)
|
|
||||||
(assembly : AssemblyName)
|
(assembly : AssemblyName)
|
||||||
(typeArgs : ImmutableArray<ConcreteTypeHandle>)
|
(typeArgs : ImmutableArray<ConcreteTypeHandle>)
|
||||||
(methodArgs : ImmutableArray<ConcreteTypeHandle>)
|
(methodArgs : ImmutableArray<ConcreteTypeHandle>)
|
||||||
@@ -926,8 +929,7 @@ module Concretization =
|
|||||||
|
|
||||||
/// Helper to ensure base type assembly is loaded
|
/// Helper to ensure base type assembly is loaded
|
||||||
let rec private ensureBaseTypeAssembliesLoaded
|
let rec private ensureBaseTypeAssembliesLoaded
|
||||||
(loadAssembly :
|
(loadAssembly : IAssemblyLoad)
|
||||||
AssemblyName -> AssemblyReferenceHandle -> ImmutableDictionary<string, DumpedAssembly> * DumpedAssembly)
|
|
||||||
(assemblies : ImmutableDictionary<string, DumpedAssembly>)
|
(assemblies : ImmutableDictionary<string, DumpedAssembly>)
|
||||||
(assyName : AssemblyName)
|
(assyName : AssemblyName)
|
||||||
(baseTypeInfo : BaseTypeInfo option)
|
(baseTypeInfo : BaseTypeInfo option)
|
||||||
@@ -947,7 +949,7 @@ module Concretization =
|
|||||||
| true, _ -> assemblies
|
| true, _ -> assemblies
|
||||||
| false, _ ->
|
| false, _ ->
|
||||||
// Need to load the assembly - pass the assembly that contains the reference
|
// Need to load the assembly - pass the assembly that contains the reference
|
||||||
let newAssemblies, _ = loadAssembly assy.Name assyRef
|
let newAssemblies, _ = loadAssembly.LoadAssembly assemblies assy.Name assyRef
|
||||||
newAssemblies
|
newAssemblies
|
||||||
| _ -> assemblies
|
| _ -> assemblies
|
||||||
| Some (BaseTypeInfo.TypeDef _)
|
| Some (BaseTypeInfo.TypeDef _)
|
||||||
@@ -957,8 +959,7 @@ module Concretization =
|
|||||||
/// Concretize a method's signature and body
|
/// Concretize a method's signature and body
|
||||||
let concretizeMethod
|
let concretizeMethod
|
||||||
(ctx : AllConcreteTypes)
|
(ctx : AllConcreteTypes)
|
||||||
(loadAssembly :
|
(loadAssembly : IAssemblyLoad)
|
||||||
AssemblyName -> AssemblyReferenceHandle -> ImmutableDictionary<string, DumpedAssembly> * DumpedAssembly)
|
|
||||||
(assemblies : ImmutableDictionary<string, DumpedAssembly>)
|
(assemblies : ImmutableDictionary<string, DumpedAssembly>)
|
||||||
(baseTypes : BaseClassTypes<DumpedAssembly>)
|
(baseTypes : BaseClassTypes<DumpedAssembly>)
|
||||||
(method : WoofWare.PawPrint.MethodInfo<'ty, GenericParamFromMetadata, TypeDefn>)
|
(method : WoofWare.PawPrint.MethodInfo<'ty, GenericParamFromMetadata, TypeDefn>)
|
||||||
|
@@ -61,16 +61,6 @@ module TestPureCases =
|
|||||||
ExpectedReturnCode = 0
|
ExpectedReturnCode = 0
|
||||||
NativeImpls = MockEnv.make ()
|
NativeImpls = MockEnv.make ()
|
||||||
}
|
}
|
||||||
{
|
|
||||||
FileName = "AdvancedStructLayout.cs"
|
|
||||||
ExpectedReturnCode = 0
|
|
||||||
NativeImpls = MockEnv.make ()
|
|
||||||
}
|
|
||||||
{
|
|
||||||
FileName = "OverlappingStructs.cs"
|
|
||||||
ExpectedReturnCode = 0
|
|
||||||
NativeImpls = MockEnv.make ()
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
|
|
||||||
let cases : EndToEndTestCase list =
|
let cases : EndToEndTestCase list =
|
||||||
|
@@ -222,5 +222,5 @@ module AbstractMachine =
|
|||||||
|> ExecutionResult.Stepped
|
|> ExecutionResult.Stepped
|
||||||
| IlOp.Switch immutableArray -> failwith "TODO: Switch unimplemented"
|
| IlOp.Switch immutableArray -> failwith "TODO: Switch unimplemented"
|
||||||
| IlOp.UnaryStringToken (unaryStringTokenIlOp, stringHandle) ->
|
| IlOp.UnaryStringToken (unaryStringTokenIlOp, stringHandle) ->
|
||||||
UnaryStringTokenIlOp.execute baseClassTypes unaryStringTokenIlOp stringHandle state thread
|
UnaryStringTokenIlOp.execute loggerFactory baseClassTypes unaryStringTokenIlOp stringHandle state thread
|
||||||
|> ExecutionResult.Stepped
|
|> ExecutionResult.Stepped
|
||||||
|
@@ -460,20 +460,22 @@ module CliType =
|
|||||||
// The field type might reference generic parameters of the declaring type
|
// The field type might reference generic parameters of the declaring type
|
||||||
let methodGenerics = ImmutableArray.Empty // Fields don't have method generics
|
let methodGenerics = ImmutableArray.Empty // Fields don't have method generics
|
||||||
|
|
||||||
let loadAssembly
|
let loadAssembly =
|
||||||
(assyName : AssemblyName)
|
{ new IAssemblyLoad with
|
||||||
(ref : AssemblyReferenceHandle)
|
member _.LoadAssembly loaded assyName ref =
|
||||||
: ImmutableDictionary<string, DumpedAssembly> * DumpedAssembly
|
match loaded.TryGetValue assyName.FullName with
|
||||||
=
|
| true, currentAssy ->
|
||||||
match assemblies.TryGetValue assyName.FullName with
|
let targetAssyRef = currentAssy.AssemblyReferences.[ref]
|
||||||
| true, currentAssy ->
|
|
||||||
let targetAssyRef = currentAssy.AssemblyReferences.[ref]
|
|
||||||
|
|
||||||
match assemblies.TryGetValue targetAssyRef.Name.FullName with
|
match loaded.TryGetValue targetAssyRef.Name.FullName with
|
||||||
| true, targetAssy -> assemblies, targetAssy
|
| true, targetAssy -> loaded, targetAssy
|
||||||
| false, _ ->
|
| false, _ ->
|
||||||
failwithf "Assembly %s not loaded when trying to resolve reference" targetAssyRef.Name.FullName
|
failwithf
|
||||||
| false, _ -> failwithf "Current assembly %s not loaded when trying to resolve reference" assyName.FullName
|
"Assembly %s not loaded when trying to resolve reference"
|
||||||
|
targetAssyRef.Name.FullName
|
||||||
|
| false, _ ->
|
||||||
|
failwithf "Current assembly %s not loaded when trying to resolve reference" assyName.FullName
|
||||||
|
}
|
||||||
|
|
||||||
let handle, newCtx =
|
let handle, newCtx =
|
||||||
TypeConcretization.concretizeType
|
TypeConcretization.concretizeType
|
||||||
|
@@ -149,7 +149,73 @@ type StateLoadResult =
|
|||||||
module IlMachineState =
|
module IlMachineState =
|
||||||
type private Dummy = class end
|
type private Dummy = class end
|
||||||
|
|
||||||
|
let private loadAssembly'
|
||||||
|
(loggerFactory : ILoggerFactory)
|
||||||
|
(dotnetRuntimeDirs : string seq)
|
||||||
|
(referencedInAssembly : DumpedAssembly)
|
||||||
|
(r : AssemblyReferenceHandle)
|
||||||
|
(assemblies : ImmutableDictionary<string, DumpedAssembly>)
|
||||||
|
=
|
||||||
|
let assemblyRef = referencedInAssembly.AssemblyReferences.[r]
|
||||||
|
let assemblyName = assemblyRef.Name
|
||||||
|
|
||||||
|
match assemblies.TryGetValue assemblyName.FullName with
|
||||||
|
| true, v -> v, assemblyName
|
||||||
|
| false, _ ->
|
||||||
|
let logger = loggerFactory.CreateLogger typeof<Dummy>.DeclaringType
|
||||||
|
|
||||||
|
let assy =
|
||||||
|
dotnetRuntimeDirs
|
||||||
|
|> Seq.choose (fun dir ->
|
||||||
|
let file = Path.Combine (dir, assemblyName.Name + ".dll")
|
||||||
|
|
||||||
|
try
|
||||||
|
use f = File.OpenRead file
|
||||||
|
logger.LogInformation ("Loading assembly from file {AssemblyFileLoadPath}", file)
|
||||||
|
Assembly.read loggerFactory (Some file) f |> Some
|
||||||
|
with :? FileNotFoundException ->
|
||||||
|
None
|
||||||
|
)
|
||||||
|
|> Seq.toList
|
||||||
|
|
||||||
|
match assy |> List.tryHead with
|
||||||
|
| None -> failwith $"Could not find a readable DLL in any runtime dir with name %s{assemblyName.Name}.dll"
|
||||||
|
| Some assy -> assy, assemblyName
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new IlMachineState which has loaded the given assembly.
|
||||||
|
/// This involves reading assemblies from the disk and doing a complete parse of them, so it might be quite slow!
|
||||||
|
///
|
||||||
|
/// This function doesn't do anything if the referenced assembly has already been loaded.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="loggerFactory">LoggerFactory into which to emit logs.</param>
|
||||||
|
/// <param name="referencedInAssembly">The assembly which contains an AssemblyReference which causes us to want to load a new assembly.</param>
|
||||||
|
/// <param name="r">The AssemblyReferenceHandle pointing at an assembly we want to load. *Important*: this is an AssemblyReferenceHandle from <c>referencedInAssembly</c>; in general, AssemblyReferenceHandles are only well-defined if you know what assembly they were defined in.</param>
|
||||||
|
/// <param name="state">The immutable state to augment with the new assembly.</param>
|
||||||
|
let loadAssembly
|
||||||
|
(loggerFactory : ILoggerFactory)
|
||||||
|
(referencedInAssembly : DumpedAssembly)
|
||||||
|
(r : AssemblyReferenceHandle)
|
||||||
|
(state : IlMachineState)
|
||||||
|
: IlMachineState * DumpedAssembly * AssemblyName
|
||||||
|
=
|
||||||
|
let dumped, assy =
|
||||||
|
loadAssembly' loggerFactory state.DotnetRuntimeDirs referencedInAssembly r state._LoadedAssemblies
|
||||||
|
|
||||||
|
state.WithLoadedAssembly assy dumped, dumped, assy
|
||||||
|
|
||||||
|
let private loader (loggerFactory : ILoggerFactory) (state : IlMachineState) : IAssemblyLoad =
|
||||||
|
{ new IAssemblyLoad with
|
||||||
|
member _.LoadAssembly loaded assyName ref =
|
||||||
|
let targetAssy, name =
|
||||||
|
loadAssembly' loggerFactory state.DotnetRuntimeDirs loaded.[assyName.FullName] ref loaded
|
||||||
|
|
||||||
|
let newAssys = loaded.SetItem (name.FullName, targetAssy)
|
||||||
|
newAssys, targetAssy
|
||||||
|
}
|
||||||
|
|
||||||
let concretizeType
|
let concretizeType
|
||||||
|
(loggerFactory : ILoggerFactory)
|
||||||
(baseClassTypes : BaseClassTypes<DumpedAssembly>)
|
(baseClassTypes : BaseClassTypes<DumpedAssembly>)
|
||||||
(state : IlMachineState)
|
(state : IlMachineState)
|
||||||
(declaringAssembly : AssemblyName)
|
(declaringAssembly : AssemblyName)
|
||||||
@@ -169,14 +235,7 @@ module IlMachineState =
|
|||||||
let handle, ctx =
|
let handle, ctx =
|
||||||
TypeConcretization.concretizeType
|
TypeConcretization.concretizeType
|
||||||
ctx
|
ctx
|
||||||
(fun assyName ref ->
|
(loader loggerFactory state)
|
||||||
let currentAssy = state.LoadedAssembly assyName |> Option.get
|
|
||||||
|
|
||||||
let targetAssy =
|
|
||||||
currentAssy.AssemblyReferences.[ref].Name |> state.LoadedAssembly |> Option.get
|
|
||||||
|
|
||||||
state._LoadedAssemblies, targetAssy
|
|
||||||
)
|
|
||||||
declaringAssembly
|
declaringAssembly
|
||||||
typeGenerics
|
typeGenerics
|
||||||
methodGenerics
|
methodGenerics
|
||||||
@@ -190,51 +249,6 @@ module IlMachineState =
|
|||||||
|
|
||||||
state, handle
|
state, handle
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Create a new IlMachineState which has loaded the given assembly.
|
|
||||||
/// This involves reading assemblies from the disk and doing a complete parse of them, so it might be quite slow!
|
|
||||||
///
|
|
||||||
/// This function doesn't do anything if the referenced assembly has already been loaded.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="loggerFactory">LoggerFactory into which to emit logs.</param>
|
|
||||||
/// <param name="referencedInAssembly">The assembly which contains an AssemblyReference which causes us to want to load a new assembly.</param>
|
|
||||||
/// <param name="r">The AssemblyReferenceHandle pointing at an assembly we want to load. *Important*: this is an AssemblyReferenceHandle from <c>referencedInAssembly</c>; in general, AssemblyReferenceHandles are only well-defined if you know what assembly they were defined in.</param>
|
|
||||||
/// <param name="state">The immutable state to augment with the new assembly.</param>
|
|
||||||
let loadAssembly
|
|
||||||
(loggerFactory : ILoggerFactory)
|
|
||||||
(referencedInAssembly : DumpedAssembly)
|
|
||||||
(r : AssemblyReferenceHandle)
|
|
||||||
(state : IlMachineState)
|
|
||||||
: IlMachineState * DumpedAssembly * AssemblyName
|
|
||||||
=
|
|
||||||
let assemblyRef = referencedInAssembly.AssemblyReferences.[r]
|
|
||||||
let assemblyName = assemblyRef.Name
|
|
||||||
|
|
||||||
match state.LoadedAssembly assemblyName with
|
|
||||||
| Some v -> state, v, assemblyName
|
|
||||||
| None ->
|
|
||||||
let logger = loggerFactory.CreateLogger typeof<Dummy>.DeclaringType
|
|
||||||
|
|
||||||
let assy =
|
|
||||||
state.DotnetRuntimeDirs
|
|
||||||
|> Seq.choose (fun dir ->
|
|
||||||
let file = Path.Combine (dir, assemblyName.Name + ".dll")
|
|
||||||
|
|
||||||
try
|
|
||||||
use f = File.OpenRead file
|
|
||||||
logger.LogInformation ("Loading assembly from file {AssemblyFileLoadPath}", file)
|
|
||||||
Assembly.read loggerFactory (Some file) f |> Some
|
|
||||||
with :? FileNotFoundException ->
|
|
||||||
None
|
|
||||||
)
|
|
||||||
|> Seq.toList
|
|
||||||
|
|
||||||
match assy |> List.tryHead with
|
|
||||||
| None -> failwith $"Could not find a readable DLL in any runtime dir with name %s{assemblyName.Name}.dll"
|
|
||||||
| Some assy ->
|
|
||||||
|
|
||||||
state.WithLoadedAssembly assemblyName assy, assy, assemblyName
|
|
||||||
|
|
||||||
let rec internal resolveTypeFromName
|
let rec internal resolveTypeFromName
|
||||||
(loggerFactory : ILoggerFactory)
|
(loggerFactory : ILoggerFactory)
|
||||||
(ns : string option)
|
(ns : string option)
|
||||||
@@ -530,26 +544,6 @@ module IlMachineState =
|
|||||||
BaseTypes = baseClassTypes
|
BaseTypes = baseClassTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function to get assembly from reference
|
|
||||||
let loadAssembly
|
|
||||||
(currentAssembly : AssemblyName)
|
|
||||||
(assyRef : AssemblyReferenceHandle)
|
|
||||||
: ImmutableDictionary<string, DumpedAssembly> * DumpedAssembly
|
|
||||||
=
|
|
||||||
let assyToLoad =
|
|
||||||
match state.LoadedAssembly currentAssembly with
|
|
||||||
| Some assy -> assy
|
|
||||||
| None -> failwithf "Assembly %s not loaded" currentAssembly.FullName
|
|
||||||
|
|
||||||
let referencedAssy = assyToLoad.AssemblyReferences.[assyRef]
|
|
||||||
|
|
||||||
match state.LoadedAssembly referencedAssy.Name with
|
|
||||||
| Some assy -> state._LoadedAssemblies, assy
|
|
||||||
| None ->
|
|
||||||
// Need to load the assembly
|
|
||||||
let newState, loadedAssy, _ = loadAssembly loggerFactory assyToLoad assyRef state
|
|
||||||
newState._LoadedAssemblies, loadedAssy
|
|
||||||
|
|
||||||
// Concretize each generic argument first
|
// Concretize each generic argument first
|
||||||
let mutable currentCtx = ctx
|
let mutable currentCtx = ctx
|
||||||
let genericHandles = ImmutableArray.CreateBuilder declaringType.Generics.Length
|
let genericHandles = ImmutableArray.CreateBuilder declaringType.Generics.Length
|
||||||
@@ -558,7 +552,7 @@ module IlMachineState =
|
|||||||
let handle, newCtx =
|
let handle, newCtx =
|
||||||
TypeConcretization.concretizeType
|
TypeConcretization.concretizeType
|
||||||
currentCtx
|
currentCtx
|
||||||
loadAssembly
|
(loader loggerFactory state)
|
||||||
declaringType.Assembly
|
declaringType.Assembly
|
||||||
ImmutableArray.Empty // No type generics in this context
|
ImmutableArray.Empty // No type generics in this context
|
||||||
ImmutableArray.Empty // No method generics in this context
|
ImmutableArray.Empty // No method generics in this context
|
||||||
@@ -570,12 +564,13 @@ module IlMachineState =
|
|||||||
// Now we need to concretize the type definition itself
|
// Now we need to concretize the type definition itself
|
||||||
// If it's a non-generic type, we can use concretizeTypeDefinition directly
|
// If it's a non-generic type, we can use concretizeTypeDefinition directly
|
||||||
if declaringType.Generics.IsEmpty then
|
if declaringType.Generics.IsEmpty then
|
||||||
let handle, newCtx =
|
let handle, currentCtx =
|
||||||
TypeConcretization.concretizeTypeDefinition currentCtx declaringType.Assembly declaringType.Definition
|
TypeConcretization.concretizeTypeDefinition currentCtx declaringType.Assembly declaringType.Definition
|
||||||
|
|
||||||
let newState =
|
let newState =
|
||||||
{ state with
|
{ state with
|
||||||
ConcreteTypes = newCtx.ConcreteTypes
|
ConcreteTypes = currentCtx.ConcreteTypes
|
||||||
|
_LoadedAssemblies = currentCtx.LoadedAssemblies
|
||||||
}
|
}
|
||||||
|
|
||||||
handle, newState
|
handle, newState
|
||||||
@@ -631,7 +626,7 @@ module IlMachineState =
|
|||||||
state.WithLoadedAssembly assy.Name assy
|
state.WithLoadedAssembly assy.Name assy
|
||||||
|
|
||||||
let state, handle =
|
let state, handle =
|
||||||
concretizeType baseClassTypes state assy.Name typeGenerics methodGenerics ty
|
concretizeType loggerFactory baseClassTypes state assy.Name typeGenerics methodGenerics ty
|
||||||
|
|
||||||
// Now get the zero value
|
// Now get the zero value
|
||||||
let zero, state = cliTypeZeroOfHandle state baseClassTypes handle
|
let zero, state = cliTypeZeroOfHandle state baseClassTypes handle
|
||||||
@@ -807,22 +802,7 @@ module IlMachineState =
|
|||||||
let concretizedMethod, newConcreteTypes, newAssemblies =
|
let concretizedMethod, newConcreteTypes, newAssemblies =
|
||||||
Concretization.concretizeMethod
|
Concretization.concretizeMethod
|
||||||
state.ConcreteTypes
|
state.ConcreteTypes
|
||||||
(fun assyName ref ->
|
(loader loggerFactory state)
|
||||||
match state.LoadedAssembly assyName with
|
|
||||||
| Some currentAssy ->
|
|
||||||
let targetAssyRef = currentAssy.AssemblyReferences.[ref]
|
|
||||||
|
|
||||||
match state.LoadedAssembly targetAssyRef.Name with
|
|
||||||
| Some _ ->
|
|
||||||
// Assembly already loaded, return existing state
|
|
||||||
state._LoadedAssemblies, state._LoadedAssemblies.[targetAssyRef.Name.FullName]
|
|
||||||
| None ->
|
|
||||||
// Need to load the assembly
|
|
||||||
let newState, loadedAssy, _ = loadAssembly loggerFactory currentAssy ref state
|
|
||||||
newState._LoadedAssemblies, loadedAssy
|
|
||||||
| None ->
|
|
||||||
failwithf "Current assembly %s not loaded when trying to resolve reference" assyName.FullName
|
|
||||||
)
|
|
||||||
state._LoadedAssemblies
|
state._LoadedAssemblies
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
methodToCall
|
methodToCall
|
||||||
@@ -868,6 +848,7 @@ module IlMachineState =
|
|||||||
for i = 0 to generics.Length - 1 do
|
for i = 0 to generics.Length - 1 do
|
||||||
let state2, handle =
|
let state2, handle =
|
||||||
concretizeType
|
concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
callingAssembly
|
callingAssembly
|
||||||
@@ -923,14 +904,7 @@ module IlMachineState =
|
|||||||
let handle, newCtx =
|
let handle, newCtx =
|
||||||
TypeConcretization.concretizeType
|
TypeConcretization.concretizeType
|
||||||
ctx
|
ctx
|
||||||
(fun assyName ref ->
|
(loader loggerFactory state)
|
||||||
let currentAssy = state.LoadedAssembly assyName |> Option.get
|
|
||||||
|
|
||||||
let targetAssy =
|
|
||||||
currentAssy.AssemblyReferences.[ref].Name |> state.LoadedAssembly |> Option.get
|
|
||||||
|
|
||||||
state._LoadedAssemblies, targetAssy
|
|
||||||
)
|
|
||||||
(state.ActiveAssembly thread).Name
|
(state.ActiveAssembly thread).Name
|
||||||
ImmutableArray.Empty // No type generics for the concretization context
|
ImmutableArray.Empty // No type generics for the concretization context
|
||||||
ImmutableArray.Empty // No method generics for the concretization context
|
ImmutableArray.Empty // No method generics for the concretization context
|
||||||
@@ -941,6 +915,7 @@ module IlMachineState =
|
|||||||
state <-
|
state <-
|
||||||
{ state with
|
{ state with
|
||||||
ConcreteTypes = newCtx.ConcreteTypes
|
ConcreteTypes = newCtx.ConcreteTypes
|
||||||
|
_LoadedAssemblies = newCtx.LoadedAssemblies
|
||||||
}
|
}
|
||||||
|
|
||||||
handles.ToImmutable (), state
|
handles.ToImmutable (), state
|
||||||
@@ -1045,14 +1020,7 @@ module IlMachineState =
|
|||||||
let declaringHandle, newCtx =
|
let declaringHandle, newCtx =
|
||||||
TypeConcretization.concretizeType
|
TypeConcretization.concretizeType
|
||||||
ctx
|
ctx
|
||||||
(fun assyName ref ->
|
(loader loggerFactory state)
|
||||||
let currentAssy = state.LoadedAssembly assyName |> Option.get
|
|
||||||
|
|
||||||
let targetAssy =
|
|
||||||
currentAssy.AssemblyReferences.[ref].Name |> state.LoadedAssembly |> Option.get
|
|
||||||
|
|
||||||
state._LoadedAssemblies, targetAssy
|
|
||||||
)
|
|
||||||
field.DeclaringType.Assembly
|
field.DeclaringType.Assembly
|
||||||
contextTypeGenerics
|
contextTypeGenerics
|
||||||
contextMethodGenerics
|
contextMethodGenerics
|
||||||
@@ -1302,6 +1270,7 @@ module IlMachineState =
|
|||||||
// TODO: generics?
|
// TODO: generics?
|
||||||
let state, t =
|
let state, t =
|
||||||
concretizeType
|
concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
targetType.Assembly
|
targetType.Assembly
|
||||||
@@ -1319,6 +1288,7 @@ module IlMachineState =
|
|||||||
// Concretize the field signature from the member reference
|
// Concretize the field signature from the member reference
|
||||||
let state, concreteFieldSig =
|
let state, concreteFieldSig =
|
||||||
concretizeType
|
concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
(state.ActiveAssembly(currentThread).Name)
|
(state.ActiveAssembly(currentThread).Name)
|
||||||
@@ -1336,6 +1306,7 @@ module IlMachineState =
|
|||||||
// Concretize the field's signature for comparison
|
// Concretize the field's signature for comparison
|
||||||
let state, fieldSigConcrete =
|
let state, fieldSigConcrete =
|
||||||
concretizeType
|
concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
assy.Name
|
assy.Name
|
||||||
@@ -1373,6 +1344,7 @@ module IlMachineState =
|
|||||||
state
|
state
|
||||||
(fun state ty ->
|
(fun state ty ->
|
||||||
concretizeType
|
concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
(state.ActiveAssembly(currentThread).Name)
|
(state.ActiveAssembly(currentThread).Name)
|
||||||
@@ -1390,6 +1362,7 @@ module IlMachineState =
|
|||||||
state
|
state
|
||||||
(fun state ty ->
|
(fun state ty ->
|
||||||
concretizeType
|
concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
assy.Name
|
assy.Name
|
||||||
@@ -1556,6 +1529,7 @@ module IlMachineState =
|
|||||||
|
|
||||||
/// Returns the type handle and an allocated System.RuntimeType.
|
/// Returns the type handle and an allocated System.RuntimeType.
|
||||||
let getOrAllocateType
|
let getOrAllocateType
|
||||||
|
(loggerFactory : ILoggerFactory)
|
||||||
(baseClassTypes : BaseClassTypes<DumpedAssembly>)
|
(baseClassTypes : BaseClassTypes<DumpedAssembly>)
|
||||||
(defn : ConcreteTypeHandle)
|
(defn : ConcreteTypeHandle)
|
||||||
(state : IlMachineState)
|
(state : IlMachineState)
|
||||||
@@ -1567,7 +1541,13 @@ module IlMachineState =
|
|||||||
baseClassTypes.Corelib.Name.FullName,
|
baseClassTypes.Corelib.Name.FullName,
|
||||||
SignatureTypeKind.Class
|
SignatureTypeKind.Class
|
||||||
)
|
)
|
||||||
|> concretizeType baseClassTypes state baseClassTypes.Corelib.Name ImmutableArray.Empty ImmutableArray.Empty
|
|> concretizeType
|
||||||
|
loggerFactory
|
||||||
|
baseClassTypes
|
||||||
|
state
|
||||||
|
baseClassTypes.Corelib.Name
|
||||||
|
ImmutableArray.Empty
|
||||||
|
ImmutableArray.Empty
|
||||||
|
|
||||||
let result, reg, state =
|
let result, reg, state =
|
||||||
TypeHandleRegistry.getOrAllocate
|
TypeHandleRegistry.getOrAllocate
|
||||||
@@ -1611,7 +1591,13 @@ module IlMachineState =
|
|||||||
baseClassTypes.Corelib.Name.FullName,
|
baseClassTypes.Corelib.Name.FullName,
|
||||||
SignatureTypeKind.Class
|
SignatureTypeKind.Class
|
||||||
)
|
)
|
||||||
|> concretizeType baseClassTypes state baseClassTypes.Corelib.Name ImmutableArray.Empty ImmutableArray.Empty
|
|> concretizeType
|
||||||
|
loggerFactory
|
||||||
|
baseClassTypes
|
||||||
|
state
|
||||||
|
baseClassTypes.Corelib.Name
|
||||||
|
ImmutableArray.Empty
|
||||||
|
ImmutableArray.Empty
|
||||||
|
|
||||||
let result, reg, state =
|
let result, reg, state =
|
||||||
FieldHandleRegistry.getOrAllocate
|
FieldHandleRegistry.getOrAllocate
|
||||||
|
@@ -10,6 +10,7 @@ open Microsoft.Extensions.Logging
|
|||||||
[<RequireQualifiedAccess>]
|
[<RequireQualifiedAccess>]
|
||||||
module IlMachineStateExecution =
|
module IlMachineStateExecution =
|
||||||
let getTypeOfObj
|
let getTypeOfObj
|
||||||
|
(loggerFactory : ILoggerFactory)
|
||||||
(baseClassTypes : BaseClassTypes<DumpedAssembly>)
|
(baseClassTypes : BaseClassTypes<DumpedAssembly>)
|
||||||
(state : IlMachineState)
|
(state : IlMachineState)
|
||||||
(esv : EvalStackValue)
|
(esv : EvalStackValue)
|
||||||
@@ -19,6 +20,7 @@ module IlMachineStateExecution =
|
|||||||
| EvalStackValue.Int32 _ ->
|
| EvalStackValue.Int32 _ ->
|
||||||
DumpedAssembly.typeInfoToTypeDefn' baseClassTypes state._LoadedAssemblies baseClassTypes.Int32
|
DumpedAssembly.typeInfoToTypeDefn' baseClassTypes state._LoadedAssemblies baseClassTypes.Int32
|
||||||
|> IlMachineState.concretizeType
|
|> IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
baseClassTypes.Corelib.Name
|
baseClassTypes.Corelib.Name
|
||||||
@@ -27,6 +29,7 @@ module IlMachineStateExecution =
|
|||||||
| EvalStackValue.Int64 _ ->
|
| EvalStackValue.Int64 _ ->
|
||||||
DumpedAssembly.typeInfoToTypeDefn' baseClassTypes state._LoadedAssemblies baseClassTypes.Int64
|
DumpedAssembly.typeInfoToTypeDefn' baseClassTypes state._LoadedAssemblies baseClassTypes.Int64
|
||||||
|> IlMachineState.concretizeType
|
|> IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
baseClassTypes.Corelib.Name
|
baseClassTypes.Corelib.Name
|
||||||
@@ -36,6 +39,7 @@ module IlMachineStateExecution =
|
|||||||
| EvalStackValue.Float _ ->
|
| EvalStackValue.Float _ ->
|
||||||
DumpedAssembly.typeInfoToTypeDefn' baseClassTypes state._LoadedAssemblies baseClassTypes.Double
|
DumpedAssembly.typeInfoToTypeDefn' baseClassTypes state._LoadedAssemblies baseClassTypes.Double
|
||||||
|> IlMachineState.concretizeType
|
|> IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
baseClassTypes.Corelib.Name
|
baseClassTypes.Corelib.Name
|
||||||
@@ -156,7 +160,8 @@ module IlMachineStateExecution =
|
|||||||
| None -> failwith "unexpectedly no `this` on the eval stack of instance method"
|
| None -> failwith "unexpectedly no `this` on the eval stack of instance method"
|
||||||
| Some this -> this
|
| Some this -> this
|
||||||
|
|
||||||
let state, callingObjTyHandle = getTypeOfObj baseClassTypes state callingObj
|
let state, callingObjTyHandle =
|
||||||
|
getTypeOfObj loggerFactory baseClassTypes state callingObj
|
||||||
|
|
||||||
let callingObjTy =
|
let callingObjTy =
|
||||||
let ty =
|
let ty =
|
||||||
@@ -200,6 +205,7 @@ module IlMachineStateExecution =
|
|||||||
let state, retType =
|
let state, retType =
|
||||||
meth.Signature.ReturnType
|
meth.Signature.ReturnType
|
||||||
|> IlMachineState.concretizeType
|
|> IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
meth.DeclaringType.Assembly
|
meth.DeclaringType.Assembly
|
||||||
@@ -211,6 +217,7 @@ module IlMachineStateExecution =
|
|||||||
||> Seq.mapFold (fun state ty ->
|
||> Seq.mapFold (fun state ty ->
|
||||||
ty
|
ty
|
||||||
|> IlMachineState.concretizeType
|
|> IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
meth.DeclaringType.Assembly
|
meth.DeclaringType.Assembly
|
||||||
@@ -573,6 +580,7 @@ module IlMachineStateExecution =
|
|||||||
// Concretize the base type
|
// Concretize the base type
|
||||||
let state, baseTypeHandle =
|
let state, baseTypeHandle =
|
||||||
IlMachineState.concretizeType
|
IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
sourceAssembly.Name
|
sourceAssembly.Name
|
||||||
@@ -612,6 +620,7 @@ module IlMachineStateExecution =
|
|||||||
// Concretize the base type
|
// Concretize the base type
|
||||||
let state, baseTypeHandle =
|
let state, baseTypeHandle =
|
||||||
IlMachineState.concretizeType
|
IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
sourceAssembly.Name
|
sourceAssembly.Name
|
||||||
@@ -663,6 +672,7 @@ module IlMachineStateExecution =
|
|||||||
state
|
state
|
||||||
(fun state typeDefn ->
|
(fun state typeDefn ->
|
||||||
IlMachineState.concretizeType
|
IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
concreteType.Assembly
|
concreteType.Assembly
|
||||||
@@ -687,6 +697,7 @@ module IlMachineStateExecution =
|
|||||||
||> Seq.fold (fun (state, acc) typeDefn ->
|
||> Seq.fold (fun (state, acc) typeDefn ->
|
||||||
let state, handle =
|
let state, handle =
|
||||||
IlMachineState.concretizeType
|
IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
concreteType.Assembly
|
concreteType.Assembly
|
||||||
|
@@ -10,6 +10,7 @@ open Microsoft.Extensions.Logging
|
|||||||
module Program =
|
module Program =
|
||||||
/// Returns the pointer to the resulting array on the heap.
|
/// Returns the pointer to the resulting array on the heap.
|
||||||
let allocateArgs
|
let allocateArgs
|
||||||
|
(loggerFactory : ILoggerFactory)
|
||||||
(args : string list)
|
(args : string list)
|
||||||
(corelib : BaseClassTypes<DumpedAssembly>)
|
(corelib : BaseClassTypes<DumpedAssembly>)
|
||||||
(state : IlMachineState)
|
(state : IlMachineState)
|
||||||
@@ -18,6 +19,7 @@ module Program =
|
|||||||
let state, stringType =
|
let state, stringType =
|
||||||
DumpedAssembly.typeInfoToTypeDefn' corelib state._LoadedAssemblies corelib.String
|
DumpedAssembly.typeInfoToTypeDefn' corelib state._LoadedAssemblies corelib.String
|
||||||
|> IlMachineState.concretizeType
|
|> IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
corelib
|
corelib
|
||||||
state
|
state
|
||||||
corelib.Corelib.Name
|
corelib.Corelib.Name
|
||||||
@@ -285,7 +287,7 @@ module Program =
|
|||||||
let arrayAllocation, state =
|
let arrayAllocation, state =
|
||||||
match mainMethodFromMetadata.Signature.ParameterTypes |> Seq.toList with
|
match mainMethodFromMetadata.Signature.ParameterTypes |> Seq.toList with
|
||||||
| [ TypeDefn.OneDimensionalArrayLowerBoundZero (TypeDefn.PrimitiveType PrimitiveType.String) ] ->
|
| [ TypeDefn.OneDimensionalArrayLowerBoundZero (TypeDefn.PrimitiveType PrimitiveType.String) ] ->
|
||||||
allocateArgs argv baseClassTypes state
|
allocateArgs loggerFactory argv baseClassTypes state
|
||||||
| _ -> failwith "Main method must take an array of strings; other signatures not yet implemented"
|
| _ -> failwith "Main method must take an array of strings; other signatures not yet implemented"
|
||||||
|
|
||||||
match mainMethodFromMetadata.Signature.ReturnType with
|
match mainMethodFromMetadata.Signature.ReturnType with
|
||||||
|
@@ -33,6 +33,7 @@ module internal UnaryMetadataIlOp =
|
|||||||
||> Seq.fold (fun (state, acc) typeDefn ->
|
||> Seq.fold (fun (state, acc) typeDefn ->
|
||||||
let state, concreteType =
|
let state, concreteType =
|
||||||
IlMachineState.concretizeType
|
IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
(state.ActiveAssembly thread).Name
|
(state.ActiveAssembly thread).Name
|
||||||
@@ -138,6 +139,7 @@ module internal UnaryMetadataIlOp =
|
|||||||
||> Seq.fold (fun (state, acc) typeDefn ->
|
||> Seq.fold (fun (state, acc) typeDefn ->
|
||||||
let state, concreteType =
|
let state, concreteType =
|
||||||
IlMachineState.concretizeType
|
IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
(state.ActiveAssembly thread).Name
|
(state.ActiveAssembly thread).Name
|
||||||
@@ -475,6 +477,7 @@ module internal UnaryMetadataIlOp =
|
|||||||
|
|
||||||
let state, targetConcreteType =
|
let state, targetConcreteType =
|
||||||
IlMachineState.concretizeType
|
IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
activeAssy.Name
|
activeAssy.Name
|
||||||
@@ -1227,6 +1230,7 @@ module internal UnaryMetadataIlOp =
|
|||||||
|
|
||||||
let state, handle =
|
let state, handle =
|
||||||
IlMachineState.concretizeType
|
IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
activeAssy.Name
|
activeAssy.Name
|
||||||
@@ -1234,7 +1238,8 @@ module internal UnaryMetadataIlOp =
|
|||||||
methodGenerics
|
methodGenerics
|
||||||
typeDefn
|
typeDefn
|
||||||
|
|
||||||
let alloc, state = IlMachineState.getOrAllocateType baseClassTypes handle state
|
let alloc, state =
|
||||||
|
IlMachineState.getOrAllocateType loggerFactory baseClassTypes handle state
|
||||||
|
|
||||||
let vt =
|
let vt =
|
||||||
// https://github.com/dotnet/runtime/blob/2b21c73fa2c32fa0195e4a411a435dda185efd08/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs#L92
|
// https://github.com/dotnet/runtime/blob/2b21c73fa2c32fa0195e4a411a435dda185efd08/src/coreclr/System.Private.CoreLib/src/System/RuntimeHandles.cs#L92
|
||||||
@@ -1285,6 +1290,7 @@ module internal UnaryMetadataIlOp =
|
|||||||
|
|
||||||
let state, handle =
|
let state, handle =
|
||||||
IlMachineState.concretizeType
|
IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
assy.Name
|
assy.Name
|
||||||
@@ -1292,7 +1298,8 @@ module internal UnaryMetadataIlOp =
|
|||||||
methodGenerics
|
methodGenerics
|
||||||
typeDefn
|
typeDefn
|
||||||
|
|
||||||
let alloc, state = IlMachineState.getOrAllocateType baseClassTypes handle state
|
let alloc, state =
|
||||||
|
IlMachineState.getOrAllocateType loggerFactory baseClassTypes handle state
|
||||||
|
|
||||||
let vt =
|
let vt =
|
||||||
{
|
{
|
||||||
@@ -1320,6 +1327,7 @@ module internal UnaryMetadataIlOp =
|
|||||||
|
|
||||||
let state, handle =
|
let state, handle =
|
||||||
IlMachineState.concretizeType
|
IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
assy.Name
|
assy.Name
|
||||||
@@ -1327,7 +1335,8 @@ module internal UnaryMetadataIlOp =
|
|||||||
methodGenerics
|
methodGenerics
|
||||||
typeDefn
|
typeDefn
|
||||||
|
|
||||||
let alloc, state = IlMachineState.getOrAllocateType baseClassTypes handle state
|
let alloc, state =
|
||||||
|
IlMachineState.getOrAllocateType loggerFactory baseClassTypes handle state
|
||||||
|
|
||||||
let vt =
|
let vt =
|
||||||
{
|
{
|
||||||
@@ -1369,6 +1378,7 @@ module internal UnaryMetadataIlOp =
|
|||||||
|
|
||||||
let state, typeHandle =
|
let state, typeHandle =
|
||||||
IlMachineState.concretizeType
|
IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
assy.Name
|
assy.Name
|
||||||
|
@@ -2,12 +2,13 @@ namespace WoofWare.PawPrint
|
|||||||
|
|
||||||
open System.Collections.Immutable
|
open System.Collections.Immutable
|
||||||
open System.Reflection
|
open System.Reflection
|
||||||
open System.Reflection.Metadata
|
open Microsoft.Extensions.Logging
|
||||||
|
|
||||||
[<RequireQualifiedAccess>]
|
[<RequireQualifiedAccess>]
|
||||||
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
|
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
|
||||||
module internal UnaryStringTokenIlOp =
|
module internal UnaryStringTokenIlOp =
|
||||||
let execute
|
let execute
|
||||||
|
(loggerFactory : ILoggerFactory)
|
||||||
(baseClassTypes : BaseClassTypes<DumpedAssembly>)
|
(baseClassTypes : BaseClassTypes<DumpedAssembly>)
|
||||||
(op : UnaryStringTokenIlOp)
|
(op : UnaryStringTokenIlOp)
|
||||||
(sh : StringToken)
|
(sh : StringToken)
|
||||||
@@ -66,6 +67,7 @@ module internal UnaryStringTokenIlOp =
|
|||||||
let state, stringType =
|
let state, stringType =
|
||||||
DumpedAssembly.typeInfoToTypeDefn' baseClassTypes state._LoadedAssemblies baseClassTypes.String
|
DumpedAssembly.typeInfoToTypeDefn' baseClassTypes state._LoadedAssemblies baseClassTypes.String
|
||||||
|> IlMachineState.concretizeType
|
|> IlMachineState.concretizeType
|
||||||
|
loggerFactory
|
||||||
baseClassTypes
|
baseClassTypes
|
||||||
state
|
state
|
||||||
baseClassTypes.Corelib.Name
|
baseClassTypes.Corelib.Name
|
||||||
|
Reference in New Issue
Block a user