Show / Hide Table of Contents

    Class ObjectEncoder<TObj, TPtr>

    Encodes in-memory objects.

    Inheritance
    System.Object
    ObjectMarshal<TObj>
    ObjectEncoder<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 ObjectEncoder<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

    ObjectEncoder(ModuleBuilder, LLVMTargetDataRef)

    Creates an object encoder.

    Declaration
    public ObjectEncoder(ModuleBuilder compiledModule, LLVMTargetDataRef target)
    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.

    Properties

    | Improve this Doc View Source

    EncodedObjects

    Gets a mapping of objects to their encoded versions.

    Declaration
    public IReadOnlyDictionary<TObj, TPtr> EncodedObjects { get; }
    Property Value
    Type Description
    System.Collections.Generic.IReadOnlyDictionary<TObj, TPtr>

    A mapping of objects to their encoded versions.

    Methods

    | Improve this Doc View Source

    AllocateBuffer(Int32)

    Allocates a GC-managed buffer of a particular size.

    Declaration
    public abstract TPtr AllocateBuffer(int size)
    Parameters
    Type Name Description
    System.Int32 size

    The size of the buffer to allocate.

    Returns
    Type Description
    TPtr

    A pointer to the buffer.

    | Improve this Doc View Source

    CreateObject(IType)

    Creates an object of a particular type.

    Declaration
    public TPtr CreateObject(IType type)
    Parameters
    Type Name Description
    IType type

    The object to create.

    Returns
    Type Description
    TPtr

    An address to the object.

    | Improve this Doc View Source

    Encode(TObj, TPtr)

    Encodes a particular value and writes its encoded representation to a buffer.

    Declaration
    public void Encode(TObj value, TPtr buffer)
    Parameters
    Type Name Description
    TObj value

    A value to encode.

    TPtr buffer

    A buffer to write value's encoded representation to.

    | Improve this Doc View Source

    EncodeBoxPointer(TObj, IType)

    Declaration
    protected TPtr EncodeBoxPointer(TObj box, IType elementType)
    Parameters
    Type Name Description
    TObj box
    IType elementType
    Returns
    Type Description
    TPtr
    | Improve this Doc View Source

    EncodePointer(TPtr, TPtr)

    Stores a pointer at a particular address.

    Declaration
    public abstract void EncodePointer(TPtr address, TPtr value)
    Parameters
    Type Name Description
    TPtr address

    An address to write value to.

    TPtr value

    A value to write to address.

    | Improve this Doc View Source

    GetFieldValues(TObj)

    Gets a mapping of an object's fields to their values..

    Declaration
    public abstract IReadOnlyDictionary<IField, TObj> GetFieldValues(TObj value)
    Parameters
    Type Name Description
    TObj value

    An object.

    Returns
    Type Description
    System.Collections.Generic.IReadOnlyDictionary<IField, TObj>

    A mapping of value's fields to those fields' values.

    | Improve this Doc View Source

    GetGlobalAddress(LLVMValueRef)

    Gets the address of a global variable in memory.

    Declaration
    public abstract TPtr GetGlobalAddress(LLVMValueRef value)
    Parameters
    Type Name Description
    LLVMSharp.LLVMValueRef value

    The global variable to query.

    Returns
    Type Description
    TPtr

    An address to value.

    | 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

    InitializeObject(TPtr, IType)

    Initializes an object at a particular address.

    Declaration
    public void InitializeObject(TPtr address, IType type)
    Parameters
    Type Name Description
    TPtr address

    The object to initialize.

    IType type

    The type of the object to initialize.

    | Improve this Doc View Source

    LoadBoxPointer(TObj)

    Loads the value stored at a particular box pointer.

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

    The pointer whose value is to be loaded.

    Returns
    Type Description
    TObj

    The value stored at the pointer.

    | Improve this Doc View Source

    RegisterEncoded(TObj, TPtr)

    Declaration
    protected void RegisterEncoded(TObj box, TPtr address)
    Parameters
    Type Name Description
    TObj box
    TPtr address
    | Improve this Doc View Source

    TryEncodePrimitive(TObj, TPtr)

    Tries to encode a primitive value.

    Declaration
    public abstract bool TryEncodePrimitive(TObj value, TPtr buffer)
    Parameters
    Type Name Description
    TObj value

    The primitive value to encode.

    TPtr buffer

    A buffer to write value's encoded version to.

    Returns
    Type Description
    System.Boolean

    true if value is a primitive and has been encoded; otherwise, false.

    | Improve this Doc View Source

    TypeOf(TObj)

    Gets the type of a particular value.

    Declaration
    public abstract IType TypeOf(TObj value)
    Parameters
    Type Name Description
    TObj value

    The type of a value.

    Returns
    Type Description
    IType

    A type.

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