Search Results for

    Show / Hide Table of Contents

    Class ObjectDecoder<TObj, TPtr>

    Decodes in-memory representations of objects.

    Inheritance
    object
    ObjectMarshal<TObj>
    ObjectDecoder<TObj, TPtr>
    Inherited Members
    ObjectMarshal<TObj>.CompiledModule
    ObjectMarshal<TObj>.Target
    ObjectMarshal<TObj>.MetadataSize
    ObjectMarshal<TObj>.SizeOf(IType)
    ObjectMarshal<TObj>.SizeOfWithMetadata(IType, out int)
    ObjectMarshal<TObj>.GetFieldOffset(IField)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Flame.Llvm
    Assembly: Flame.Llvm.dll
    Syntax
    public abstract class ObjectDecoder<TObj, TPtr> : ObjectMarshal<TObj>
    Type Parameters
    Name Description
    TObj

    The type of a decoded object.

    TPtr

    The type of a pointer to an encoded object.

    Constructors

    | Edit this page View Source

    ObjectDecoder(ModuleBuilder, LLVMTargetDataRef, IReadOnlyDictionary<TPtr, TObj>)

    Creates an object decoder.

    Declaration
    public ObjectDecoder(ModuleBuilder compiledModule, LLVMTargetDataRef target, IReadOnlyDictionary<TPtr, TObj> existingObjects)
    Parameters
    Type Name Description
    ModuleBuilder compiledModule

    A compiled LLVM module to inspect for type data layouts.

    LLVMTargetDataRef target

    A target data layout to use for determining the precise layout of data types.

    IReadOnlyDictionary<TPtr, TObj> existingObjects

    Properties

    | Edit this page View Source

    ExistingObjects

    Gets a mapping of pointers to existing objects. When a key in this dictionary is encountered during decoding, the corresponding value is updated. Pointers that are not keys in this dictionary are mapped to objects that are newly created during decoding.

    Declaration
    public IReadOnlyDictionary<TPtr, TObj> ExistingObjects { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<TPtr, TObj>

    A mapping of pointers to objects.

    Methods

    | Edit this page View Source

    CreateObject(IType)

    Creates a new object of a particular type.

    Declaration
    public abstract TObj CreateObject(IType type)
    Parameters
    Type Name Description
    IType type

    The type of object to create.

    Returns
    Type Description
    TObj

    An instance of type.

    | Edit this page View Source

    Decode(TPtr)

    Decodes an object stored at a particular address.

    Declaration
    public TObj Decode(TPtr pointer)
    Parameters
    Type Name Description
    TPtr pointer

    A pointer to an object to decode.

    Returns
    Type Description
    TObj

    A decoded version of the object stored at pointer.

    | Edit this page View Source

    DecodeFieldlike(IType, TPtr)

    Declaration
    protected TObj DecodeFieldlike(IType fieldType, TPtr fieldPtr)
    Parameters
    Type Name Description
    IType fieldType
    TPtr fieldPtr
    Returns
    Type Description
    TObj
    | Edit this page View Source

    IndexPointer(TPtr, int)

    Adds an offset to a pointer.

    Declaration
    public abstract TPtr IndexPointer(TPtr pointer, int offset)
    Parameters
    Type Name Description
    TPtr pointer

    A base pointer.

    int offset

    An offset to add to pointer.

    Returns
    Type Description
    TPtr

    A modified pointer.

    | Edit this page View Source

    LoadBoxPointer(TPtr)

    Dereferences a pointer to a boxed object reference.

    Declaration
    public abstract TPtr LoadBoxPointer(TPtr pointer)
    Parameters
    Type Name Description
    TPtr pointer

    The pointer to dereference.

    Returns
    Type Description
    TPtr

    A boxed object reference.

    | Edit this page View Source

    RegisterDecoded(TPtr, TObj)

    Registers an object as the decoded or updated version of the data at a particular address.

    Declaration
    protected void RegisterDecoded(TPtr pointer, TObj obj)
    Parameters
    Type Name Description
    TPtr pointer

    A pointer to a decoded object.

    TObj obj

    An object that corresponds to the decoded or updated version of pointer.

    | Edit this page View Source

    SetField(TObj, IField, TObj)

    Updates the value of an object's field.

    Declaration
    public abstract void SetField(TObj obj, IField field, TObj value)
    Parameters
    Type Name Description
    TObj obj

    An object that contains field.

    IField field

    A field to update.

    TObj value

    The value to assign to field in obj.

    | Edit this page View Source

    TryDecodePrimitive(TPtr, IType, out TObj)

    Decodes a primitive object stored at a particular address, provided that the object is indeed a primitive object.

    Declaration
    public abstract bool TryDecodePrimitive(TPtr pointer, IType type, out TObj obj)
    Parameters
    Type Name Description
    TPtr pointer

    The address of the object to decode.

    IType type

    The type of the object to decode.

    TObj obj

    A decoded primitive object.

    Returns
    Type Description
    bool

    true if the object stored at pointer is a primitive object and has been decoded; otherwise, false.

    | Edit this page View Source

    TryUpdatePrimitive(TPtr, TObj, IType)

    Updates a primitive object's data with data stored at a particular address, provided that the object is indeed a primitive object.

    Declaration
    public abstract bool TryUpdatePrimitive(TPtr pointer, TObj obj, IType type)
    Parameters
    Type Name Description
    TPtr pointer

    The address of obj's new data.

    TObj obj

    The primitive object to update.

    IType type

    The type of obj.

    Returns
    Type Description
    bool

    true if obj is a primitive object and has been updated; otherwise, false.

    | Edit this page View Source

    TypeOf(TPtr)

    Gets the type of an in-memory object stored at a particular address.

    Declaration
    public abstract IType TypeOf(TPtr pointer)
    Parameters
    Type Name Description
    TPtr pointer

    A pointer to an in-memory object.

    Returns
    Type Description
    IType

    The type of the object at address pointer.

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX