C# Класс Monobjc.Generators.CodeGenerator

Base class for .NET code generator.
Показать файл Открыть проект

Защищенные методы

Метод Описание
CodeGenerator ( DynamicAssembly assembly, bool is64Bits )

Initializes a new instance of the CodeGenerator class.

CreateLocalBuilderForInvocationResult ( ILGenerator generator, Type returnType, Type nativeReturnType ) : LocalBuilder

Creates a local builder to store the result of the invocation.

CreateLocalVariableForByRefParameters ( ILGenerator generator, ParameterInfo parameterInfos ) : ByRefParameter[]

Emit local variable for each by-ref parameters. These variables will hold the result until the marshalling occurs.

EmitLoadArgument ( ILGenerator generator, int index ) : void
EmitManagedToNativeMarshallingForByRefParameters ( ILGenerator generator, Type nativeParameterTypes, ByRefParameter byRefLocalVariables ) : void

Emit the code needed to marshal back the local variables to by-ref parameters.

EmitNativeToManagedMarshallingForByRefParameters ( ILGenerator generator, Type nativeParameterTypes, ByRefParameter byRefLocalVariables ) : void

For by-ref parameters passed as reference (without [out] attribute), we first set the value of local variables

EmitParametersLoadingOnStack ( ILGenerator generator, Type parameterTypes, Type nativeParameterTypes, ByRefParameter byRefLocalVariables, int parameterOffset ) : void

Genenerate optimized IL for stacking parameters : - For the third or fourth parameter, use the short OpCode - For all the parameters left, use the long OpCode

GetReturnType ( MethodBase methodBase ) : Type

Gets the return type of the method base.

GetUniqueName ( MethodBase methodBase ) : String

Gets a unique name of the method base.

UnwrapResultOfInvocation ( ILGenerator generator, LocalBuilder result, Type returnType, Type nativeReturnType, bool hasByRef ) : void

Unwraps the result of invocation.

Приватные методы

Метод Описание
DefineProxyDelegateFieldInfo ( TypeBuilder typeBuilder, MethodTuple methodTuple ) : FieldInfo

Defines the proxy delegate field info.

DefineStaticConstructor ( TypeBuilder typeBuilder, IEnumerable methodTuples ) : void

Defines a static constructor.

EmitManagedToNativeMarshallingCast ( ILGenerator generator, LocalBuilder local, Type localType, int i ) : void
EmitNativeToManagedMarshallingCast ( ILGenerator generator, Type localType ) : void

Emits the native to managed marshalling cast.

Описание методов

CodeGenerator() защищенный Метод

Initializes a new instance of the CodeGenerator class.
protected CodeGenerator ( DynamicAssembly assembly, bool is64Bits )
assembly DynamicAssembly The assembly.
is64Bits bool

CreateLocalBuilderForInvocationResult() защищенный статический Метод

Creates a local builder to store the result of the invocation.
protected static CreateLocalBuilderForInvocationResult ( ILGenerator generator, Type returnType, Type nativeReturnType ) : LocalBuilder
generator ILGenerator The IL generator.
returnType Type The return type.
nativeReturnType Type The native return type.
Результат LocalBuilder

CreateLocalVariableForByRefParameters() защищенный статический Метод

Emit local variable for each by-ref parameters. These variables will hold the result until the marshalling occurs.
protected static CreateLocalVariableForByRefParameters ( ILGenerator generator, ParameterInfo parameterInfos ) : ByRefParameter[]
generator ILGenerator
parameterInfos ParameterInfo
Результат ByRefParameter[]

EmitLoadArgument() защищенный статический Метод

protected static EmitLoadArgument ( ILGenerator generator, int index ) : void
generator ILGenerator
index int
Результат void

EmitManagedToNativeMarshallingForByRefParameters() защищенный Метод

Emit the code needed to marshal back the local variables to by-ref parameters.
protected EmitManagedToNativeMarshallingForByRefParameters ( ILGenerator generator, Type nativeParameterTypes, ByRefParameter byRefLocalVariables ) : void
generator ILGenerator
nativeParameterTypes Type
byRefLocalVariables ByRefParameter
Результат void

EmitNativeToManagedMarshallingForByRefParameters() защищенный Метод

For by-ref parameters passed as reference (without [out] attribute), we first set the value of local variables
protected EmitNativeToManagedMarshallingForByRefParameters ( ILGenerator generator, Type nativeParameterTypes, ByRefParameter byRefLocalVariables ) : void
generator ILGenerator
nativeParameterTypes Type
byRefLocalVariables ByRefParameter
Результат void

EmitParametersLoadingOnStack() защищенный статический Метод

Genenerate optimized IL for stacking parameters : - For the third or fourth parameter, use the short OpCode - For all the parameters left, use the long OpCode
protected static EmitParametersLoadingOnStack ( ILGenerator generator, Type parameterTypes, Type nativeParameterTypes, ByRefParameter byRefLocalVariables, int parameterOffset ) : void
generator ILGenerator
parameterTypes Type
nativeParameterTypes Type
byRefLocalVariables ByRefParameter
parameterOffset int
Результат void

GetReturnType() защищенный статический Метод

Gets the return type of the method base.
protected static GetReturnType ( MethodBase methodBase ) : Type
methodBase MethodBase
Результат Type

GetUniqueName() защищенный статический Метод

Gets a unique name of the method base.
protected static GetUniqueName ( MethodBase methodBase ) : String
methodBase MethodBase
Результат String

UnwrapResultOfInvocation() защищенный статический Метод

Unwraps the result of invocation.
protected static UnwrapResultOfInvocation ( ILGenerator generator, LocalBuilder result, Type returnType, Type nativeReturnType, bool hasByRef ) : void
generator ILGenerator Generator.
result LocalBuilder Result.
returnType Type Return type.
nativeReturnType Type Native return type.
hasByRef bool If set to true has by reference.
Результат void