Collection of functions, static initializers and data loaded from CBO files.
More...
#include <bond/vm/codesegment.h>
Collection of functions, static initializers and data loaded from CBO files.
A CodeSegment is produced by CboLoader and consumed by the VM. It supports looking up functions and data entries by qualified name, and calling static initializers before an application's entry point is invoked.
◆ CodeSegment()
| Bond::CodeSegment::CodeSegment |
( |
const Function * | functionTable, |
|
|
size_t | functionCount, |
|
|
const Function * | staticInitializerTable, |
|
|
size_t | staticInitializerCount, |
|
|
const DataEntry * | dataTable, |
|
|
size_t | dataCount ) |
|
inline |
Constructs a CodeSegment from prebuilt tables.
- Parameters
-
| functionTable | Array of callable functions. |
| functionCount | Number of entries in functionTable. |
| staticInitializerTable | Array of static initializer functions. |
| staticInitializerCount | Number of entries in staticInitializerTable. |
| dataTable | Array of named data entries. |
| dataCount | Number of entries in dataTable. |
◆ CallStaticInitializers()
| void Bond::CodeSegment::CallStaticInitializers |
( |
VM & | vm | ) |
const |
Calls all static initializer functions in this code segment.
- Parameters
-
| vm | VM instance used to invoke initializer functions. |
◆ GetDataCount()
| size_t Bond::CodeSegment::GetDataCount |
( |
| ) |
const |
|
inline |
Returns the number of data entries in the data table.
- Returns
- Data table size.
◆ GetDataEntry() [1/2]
| const DataEntry * Bond::CodeSegment::GetDataEntry |
( |
const char * | qualifiedName | ) |
const |
Finds a data entry by qualified name string.
- Parameters
-
| qualifiedName | Fully qualified data entry name string. |
- Returns
- Pointer to the data entry, or
nullptr if it is not found.
◆ GetDataEntry() [2/2]
Finds a data entry by qualified name.
- Parameters
-
| qualifiedName | Fully qualified data entry name. |
- Returns
- Pointer to the data entry, or
nullptr if it is not found.
◆ GetDataEntryAtIndex()
| const DataEntry & Bond::CodeSegment::GetDataEntryAtIndex |
( |
uint32_t | dataIndex | ) |
const |
|
inline |
Returns the data entry at the specified index.
- Parameters
-
| dataIndex | Index of the data entry in the data table. |
- Returns
- Reference to the data entry at
dataIndex.
◆ GetDataEntryIndex() [1/2]
| int32_t Bond::CodeSegment::GetDataEntryIndex |
( |
const char * | qualifiedName | ) |
const |
Gets the index of a data entry by qualified name string.
- Parameters
-
| qualifiedName | Fully qualified data entry name string. |
- Returns
- Data entry index, or -1 if it is not found.
◆ GetDataEntryIndex() [2/2]
| int32_t Bond::CodeSegment::GetDataEntryIndex |
( |
const QualifiedName & | qualifiedName | ) |
const |
Gets the index of a data entry by qualified name.
- Parameters
-
| qualifiedName | Fully qualified data entry name. |
- Returns
- Data entry index, or -1 if it is not found.
◆ GetFunction() [1/2]
| const Function * Bond::CodeSegment::GetFunction |
( |
const char * | qualifiedName | ) |
const |
Finds a function by qualified name string.
- Parameters
-
| qualifiedName | Fully qualified function name string. |
- Returns
- Pointer to the function, or
nullptr if it is not found.
◆ GetFunction() [2/2]
Finds a function by qualified name.
- Parameters
-
| qualifiedName | Fully qualified function name. |
- Returns
- Pointer to the function, or
nullptr if it is not found.
◆ GetFunctionAtIndex()
| const Function & Bond::CodeSegment::GetFunctionAtIndex |
( |
uint32_t | functionIndex | ) |
const |
|
inline |
Returns the function at the specified index.
- Parameters
-
| functionIndex | Index of the function in the function table. |
- Returns
- Reference to the function at
functionIndex.
◆ GetFunctionCount()
| size_t Bond::CodeSegment::GetFunctionCount |
( |
| ) |
const |
|
inline |
Returns the number of functions in the function table.
- Returns
- Function table size.
◆ GetFunctionIndex() [1/2]
| int32_t Bond::CodeSegment::GetFunctionIndex |
( |
const char * | qualifiedName | ) |
const |
Gets the index of a function by qualified name string.
- Parameters
-
| qualifiedName | Fully qualified function name string. |
- Returns
- Function index, or -1 if it is not found.
◆ GetFunctionIndex() [2/2]
| int32_t Bond::CodeSegment::GetFunctionIndex |
( |
const QualifiedName & | qualifiedName | ) |
const |
Gets the index of a function by qualified name.
- Parameters
-
| qualifiedName | Fully qualified function name. |
- Returns
- Function index, or -1 if it is not found.
◆ GetStaticInitializerAtIndex()
| const Function & Bond::CodeSegment::GetStaticInitializerAtIndex |
( |
uint32_t | initializerIndex | ) |
const |
|
inline |
Returns the static initializer at the specified index.
- Parameters
-
| initializerIndex | Index of the static initializer. |
- Returns
- Reference to the static initializer at
initializerIndex.
◆ GetStaticInitializerCount()
| size_t Bond::CodeSegment::GetStaticInitializerCount |
( |
| ) |
const |
|
inline |
Returns the number of static initializers.
- Returns
- Static initializer table size.
The documentation for this class was generated from the following file:
- include/bond/vm/codesegment.h