Class ObjectDecoder<TObj, TPtr>
Decodes in-memory representations of objects.
Inherited Members
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 SourceObjectDecoder(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 SourceExistingObjects
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 SourceCreateObject(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 |
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 |
DecodeFieldlike(IType, TPtr)
Declaration
protected TObj DecodeFieldlike(IType fieldType, TPtr fieldPtr)
Parameters
| Type | Name | Description |
|---|---|---|
| IType | fieldType | |
| TPtr | fieldPtr |
Returns
| Type | Description |
|---|---|
| TObj |
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 |
Returns
| Type | Description |
|---|---|
| TPtr | A modified pointer. |
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. |
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 |
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 |
| IField | field | A field to update. |
| TObj | value | The value to assign to |
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 |
|
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 |
| TObj | obj | The primitive object to update. |
| IType | type | The type of |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
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 |