C# 클래스 Monobjc.Generators.CodeGenerator

Base class for .NET code generator.
파일 보기 프로젝트 열기: Monobjc/monobjc

보호된 메소드들

메소드 설명
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