12 private DynamicScope m_scope;
14 private byte[] m_exceptions;
16 private byte[] m_code;
18 private byte[] m_localSignature;
20 private int m_maxStackSize;
22 private int m_methodSignature;
24 internal byte[] LocalSignature
28 if (m_localSignature ==
null)
32 return m_localSignature;
36 internal byte[] Exceptions => m_exceptions;
38 internal byte[] Code => m_code;
40 internal int MaxStackSize => m_maxStackSize;
46 internal DynamicScope DynamicScope => m_scope;
52 m_methodSignature = m_scope.GetTokenFor(methodSignature);
53 m_exceptions = EmptyArray<byte>.Value;
54 m_code = EmptyArray<byte>.Value;
55 m_localSignature = EmptyArray<byte>.Value;
59 internal void GetCallableMethod(RuntimeModule module,
DynamicMethod dm)
61 dm.m_methodHandle =
ModuleHandle.GetDynamicMethod(dm, module, m_method.
Name, (
byte[])m_scope[m_methodSignature],
new DynamicResolver(
this));
67 public void SetCode(
byte[] code,
int maxStackSize)
69 m_code = ((code !=
null) ? ((
byte[])code.Clone()) : EmptyArray<byte>.Value);
70 m_maxStackSize = maxStackSize;
83 public unsafe
void SetCode(
byte* code,
int codeSize,
int maxStackSize)
89 if (codeSize > 0 && code ==
null)
93 m_code =
new byte[codeSize];
94 for (
int i = 0; i < codeSize; i++)
99 m_maxStackSize = maxStackSize;
106 m_exceptions = ((exceptions !=
null) ? ((
byte[])exceptions.Clone()) : EmptyArray<byte>.Value);
117 [CLSCompliant(
false)]
120 if (exceptionsSize < 0)
124 if (exceptionsSize > 0 && exceptions ==
null)
128 m_exceptions =
new byte[exceptionsSize];
129 for (
int i = 0; i < exceptionsSize; i++)
131 m_exceptions[i] = *exceptions;
140 m_localSignature = ((localSignature !=
null) ? ((
byte[])localSignature.Clone()) : EmptyArray<byte>.Value);
151 [CLSCompliant(
false)]
154 if (signatureSize < 0)
158 if (signatureSize > 0 && localSignature ==
null)
162 m_localSignature =
new byte[signatureSize];
163 for (
int i = 0; i < signatureSize; i++)
165 m_localSignature[i] = *localSignature;
173 [SecuritySafeCritical]
176 return DynamicScope.GetTokenFor(method);
184 return DynamicScope.GetTokenFor(method);
193 return DynamicScope.GetTokenFor(method, contextType);
201 return DynamicScope.GetTokenFor(field);
210 return DynamicScope.GetTokenFor(field, contextType);
218 return DynamicScope.GetTokenFor(type);
226 return DynamicScope.GetTokenFor(literal);
234 return DynamicScope.GetTokenFor(signature);
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Defines and represents a dynamic method that can be compiled, executed, and discarded....
int GetTokenFor(RuntimeFieldHandle field, RuntimeTypeHandle contextType)
Gets a token, valid in the scope of the current T:System.Reflection.Emit.DynamicILInfo,...
Represents a field using an internal metadata token.
The exception that is thrown when the value of an argument is outside the allowable range of values a...
Represents a runtime handle for a module.
int GetTokenFor(RuntimeMethodHandle method)
Gets a token, valid in the scope of the current T:System.Reflection.Emit.DynamicILInfo,...
Represents a type using an internal metadata token.
Provides methods for building signatures.
Provides information about, and means to manipulate, the current environment and platform....
T:System.RuntimeMethodHandle is a handle to the internal metadata representation of a method.
override string Name
Gets the name of the dynamic method.
void SetCode(byte[] code, int maxStackSize)
Sets the code body of the associated dynamic method.
void SetExceptions(byte[] exceptions)
Sets the exception metadata for the associated dynamic method.
unsafe void SetLocalSignature(byte *localSignature, int signatureSize)
Sets the local variable signature that describes the layout of local variables for the associated dyn...
static SignatureHelper GetLocalVarSigHelper()
Returns a signature helper for a local variable.
int GetTokenFor(DynamicMethod method)
Gets a token, valid in the scope of the current T:System.Reflection.Emit.DynamicILInfo,...
int GetTokenFor(string literal)
Gets a token, valid in the scope of the current T:System.Reflection.Emit.DynamicILInfo,...
int GetTokenFor(RuntimeMethodHandle method, RuntimeTypeHandle contextType)
Gets a token, valid in the scope of the current T:System.Reflection.Emit.DynamicILInfo,...
unsafe void SetExceptions(byte *exceptions, int exceptionsSize)
Sets the exception metadata for the associated dynamic method.
Provides support for alternative ways to generate the Microsoft intermediate language (MSIL) and meta...
void SetLocalSignature(byte[] localSignature)
Sets the local variable signature that describes the layout of local variables for the associated dyn...
int GetTokenFor(byte[] signature)
Gets a token, valid in the scope of the current T:System.Reflection.Emit.DynamicILInfo,...
unsafe void SetCode(byte *code, int codeSize, int maxStackSize)
Sets the code body of the associated dynamic method.
int GetTokenFor(RuntimeTypeHandle type)
Gets a token, valid in the scope of the current T:System.Reflection.Emit.DynamicILInfo,...
int GetTokenFor(RuntimeFieldHandle field)
Gets a token, valid in the scope of the current T:System.Reflection.Emit.DynamicILInfo,...