Show / Hide Table of Contents

    Class ObjectDecoder<TObj, TPtr>

    Decodes in-memory representations of objects.

    Inheritance
    System.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, Int32)
    ObjectMarshal<TObj>.GetFieldOffset(IField)
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    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

    | Improve this Doc 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.

    LLVMSharp.LLVMTargetDataRef target

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

    System.Collections.Generic.IReadOnlyDictionary<TPtr, TObj> existingObjects

    Properties

    | Improve this Doc 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
    System.Collections.Generic.IReadOnlyDictionary<TPtr, TObj>

    A mapping of pointers to objects.

    Methods

    | Improve this Doc 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.

    | Improve this Doc 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.

    | Improve this Doc 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
    | Improve this Doc View Source

    IndexPointer(TPtr, Int32)

    Adds an offset to a pointer.

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

    A base pointer.

    System.Int32 offset

    An offset to add to pointer.

    Returns
    Type Description
    TPtr

    A modified pointer.

    | Improve this Doc 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.

    | Improve this Doc 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.

    | Improve this Doc 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.

    | Improve this Doc 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
    System.Boolean

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

    | Improve this Doc 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
    System.Boolean

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

    | Improve this Doc 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.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX