Class ValueFactory
- Namespace
- Echo.Platforms.AsmResolver.Emulation
- Assembly
- Echo.Platforms.AsmResolver.dll
Provides a service for querying information about- and constructing new values.
public class ValueFactory
- Inheritance
-
ValueFactory
- Inherited Members
Constructors
ValueFactory(ModuleDefinition, bool)
Creates a new value factory.
public ValueFactory(ModuleDefinition contextModule, bool is32Bit)
Parameters
contextModuleModuleDefinitionThe manifest module to use for context.
is32BitboolA value indicating whether the environment is a 32-bit or 64-bit system.
Properties
ArrayHeaderSize
Gets the number of bytes prepended to the data of the array.
public uint ArrayHeaderSize { get; }
Property Value
ArrayLengthOffset
Gets the offset within an array object that indexes the start of the Length field.
public uint ArrayLengthOffset { get; }
Property Value
BitVectorPool
Gets the bitvector pool that this factory uses for creating and reusing bit vectors.
public BitVectorPool BitVectorPool { get; }
Property Value
ClrMockMemory
Gets the CLR mock memory used for managing method tables (types).
public ClrMockMemory ClrMockMemory { get; }
Property Value
ContextModule
Gets the manifest module to use for context.
public ModuleDefinition ContextModule { get; }
Property Value
DecimalType
Gets a reference to the decimal type.
public ITypeDescriptor DecimalType { get; }
Property Value
DelegateMethodPtrField
Get a reference to the Delegate _methodPtr field.
public IFieldDescriptor DelegateMethodPtrField { get; }
Property Value
DelegateTargetField
Get a reference to the Delegate _target field.
public IFieldDescriptor DelegateTargetField { get; }
Property Value
DelegateType
Gets a reference to the Delegate type.
public ITypeDescriptor DelegateType { get; }
Property Value
IndexOutOfRangeExceptionType
Gets a reference to the IndexOutOfRangeException type.
public ITypeDescriptor IndexOutOfRangeExceptionType { get; }
Property Value
InvalidCastExceptionType
Gets a reference to the InvalidCastException type.
public ITypeDescriptor InvalidCastExceptionType { get; }
Property Value
InvalidProgramExceptionType
Gets a reference to the InvalidProgramException type.
public ITypeDescriptor InvalidProgramExceptionType { get; }
Property Value
Is32Bit
Gets a value indicating whether the environment is a 32-bit or 64-bit system.
public bool Is32Bit { get; }
Property Value
Marshaller
Gets the service responsible for marshalling values into stack slots and back.
public CliMarshaller Marshaller { get; }
Property Value
MissingMethodExceptionType
Gets a reference to the MissingMethodException type.
public ITypeDescriptor MissingMethodExceptionType { get; }
Property Value
NullReferenceExceptionType
Gets a reference to the NullReferenceException type.
public ITypeDescriptor NullReferenceExceptionType { get; }
Property Value
ObjectHeaderSize
Gets the size of an object header.
public uint ObjectHeaderSize { get; }
Property Value
OverflowExceptionType
Gets a reference to the OverflowException type.
public ITypeDescriptor OverflowExceptionType { get; }
Property Value
PointerSize
Gets the size in bytes of a pointer in the current environment.
public uint PointerSize { get; }
Property Value
StackOverflowExceptionType
Gets a reference to the StackOverflowException type.
public ITypeDescriptor StackOverflowExceptionType { get; }
Property Value
StringHeaderSize
Gets the number of bytes prepended to the characters of the string.
public uint StringHeaderSize { get; }
Property Value
StringLengthOffset
Gets the offset within an string object that indexes the start of the Length field.
public uint StringLengthOffset { get; }
Property Value
TypeInitializationExceptionType
Gets a reference to the TypeInitializationException type.
public TypeDefinition TypeInitializationExceptionType { get; }
Property Value
Methods
CreateBoolean(Trilean)
Creates a new 32-bit vector from the bit vector pool containing the boolean value.
public BitVector CreateBoolean(Trilean value)
Parameters
valueTrileanThe value.
Returns
- BitVector
The vector.
CreateNativeInteger(bool)
Creates a new native integer bit vector.
public BitVector CreateNativeInteger(bool initialize)
Parameters
initializebooltrueif the value should be set to 0,falseif the integer should remain unknown.
Returns
- BitVector
The constructed bit vector.
CreateNativeInteger(long)
Creates a new native integer bit vector.
public BitVector CreateNativeInteger(long value)
Parameters
valuelongThe value to initialize the integer with.
Returns
- BitVector
The constructed bit vector.
CreateNull()
Creates a new native integer bit vector containing the null reference.
public BitVector CreateNull()
Returns
- BitVector
The constructed bit vector.
CreateValue(TypeSignature, bool)
Creates a new bit vector that can be used to represent an instance of the provided type.
public BitVector CreateValue(TypeSignature type, bool initialize)
Parameters
typeTypeSignatureThe type to represent.
initializebooltrueif the value should be set to 0,falseif the value should remain unknown.
Returns
- BitVector
The constructed bit vector.
GetArrayElementOffset(TypeSignature, long)
Calculates the offset to the element within an array.
public long GetArrayElementOffset(TypeSignature elementType, long index)
Parameters
elementTypeTypeSignatureThe element type.
indexlongThe element's index.
Returns
- long
The offset, relative to the start of an array object.
GetArrayObjectSize(ITypeDescriptor, int)
Computes the total size of an array object.
public uint GetArrayObjectSize(ITypeDescriptor elementType, int elementCount)
Parameters
elementTypeITypeDescriptorThe type of elements the array stores.
elementCountintThe number of elements.
Returns
- uint
The total size in bytes.
GetFieldMemoryLayout(IFieldDescriptor)
Obtains memory layout information of a field.
public FieldMemoryLayout GetFieldMemoryLayout(IFieldDescriptor field)
Parameters
fieldIFieldDescriptorThe field.
Returns
- FieldMemoryLayout
The memory layout information.
Exceptions
- ArgumentException
Occurs when the field could not be resolved.
GetObjectSize(ITypeDescriptor)
Computes the total size of an object.
public uint GetObjectSize(ITypeDescriptor type)
Parameters
typeITypeDescriptorThe type of object to measure.
Returns
- uint
The total size in bytes.
GetStringObjectSize(int)
Computes the total size of a string object.
public uint GetStringObjectSize(int length)
Parameters
lengthintThe number of characters in the string.
Returns
- uint
The total size in bytes.
GetTypeContentsMemoryLayout(ITypeDescriptor)
Obtains the memory layout of a type in the current environment. If the provided type is a reference type, then it will measure the size of the contents behind the object reference.
public TypeMemoryLayout GetTypeContentsMemoryLayout(ITypeDescriptor type)
Parameters
typeITypeDescriptorThe type to measure.
Returns
- TypeMemoryLayout
The measured layout.
Exceptions
- ArgumentOutOfRangeException
Occurs when the type could not be measured.
GetTypeValueMemoryLayout(ITypeDescriptor)
Obtains the memory layout of a type in the current environment. If the provided type is a reference type, then it will measure the object reference itself, and not the contents behind the reference.
public TypeMemoryLayout GetTypeValueMemoryLayout(ITypeDescriptor type)
Parameters
typeITypeDescriptorThe type to measure.
Returns
- TypeMemoryLayout
The measured layout.
Exceptions
- ArgumentOutOfRangeException
Occurs when the type could not be measured.
RentBoolean(Trilean)
Rents a 32-bit vector from the bit vector pool containing the boolean value.
public BitVector RentBoolean(Trilean value)
Parameters
valueTrileanThe value.
Returns
- BitVector
The vector
RentNativeInteger(bool)
Rents a native integer bit vector from the bit vector pool.
public BitVector RentNativeInteger(bool initialize)
Parameters
initializebooltrueif the value should be set to 0,falseif the integer should remain unknown.
Returns
- BitVector
The rented bit vector.
RentNativeInteger(long)
Rents a native integer bit vector from the bit vector pool.
public BitVector RentNativeInteger(long value)
Parameters
valuelongThe value to initialize the integer with.
Returns
- BitVector
The rented bit vector.
RentNull()
Rents a new native integer bit vector containing the null reference.
public BitVector RentNull()
Returns
- BitVector
The constructed bit vector.
RentValue(TypeSignature, bool)
Rents a bit vector from the pool that can be used to represent an instance of the provided type.
public BitVector RentValue(TypeSignature type, bool initialize)
Parameters
typeTypeSignatureThe type to represent.
initializebooltrueif the value should be set to 0,falseif the value should remain unknown.
Returns
- BitVector
The rented bit vector.