|
Loom C API
Public Loom compiler C API
|
Per-worker scratch workspace. More...
Go to the source code of this file.
Data Structures | |
| struct | loomc_workspace_options_t |
| Workspace creation options. More... | |
| struct | loomc_workspace_statistics_t |
| Monotonic allocation statistics for a workspace block pool. More... | |
Typedefs | |
| typedef struct loomc_workspace_t | loomc_workspace_t |
| Mutable per-worker scratch workspace. | |
Functions | |
| loomc_status_t | loomc_workspace_create (const loomc_workspace_options_t *options, loomc_allocator_t allocator, loomc_workspace_t **out_workspace) |
| Creates a mutable workspace for one worker at a time. | |
| void | loomc_workspace_query_statistics (const loomc_workspace_t *workspace, loomc_workspace_statistics_t *out_statistics) |
| Queries a monotonic snapshot of workspace allocation statistics. | |
| void | loomc_workspace_retain (loomc_workspace_t *workspace) |
| Retains workspace for another owner. | |
| void | loomc_workspace_trim (loomc_workspace_t *workspace) |
| Trims idle arena blocks owned by workspace. | |
| void | loomc_workspace_release (loomc_workspace_t *workspace) |
| Releases workspace and all storage it owns. | |
Per-worker scratch workspace.
A workspace owns the arena block pool used by parsing, indexing, linking, cloning, and compiling. High-throughput embedders normally create one workspace per worker thread or task-system worker and reuse it across operations.
| typedef struct loomc_workspace_t loomc_workspace_t |
Mutable per-worker scratch workspace.
| loomc_status_t loomc_workspace_create | ( | const loomc_workspace_options_t * | options, |
| loomc_allocator_t | allocator, | ||
| loomc_workspace_t ** | out_workspace ) |
Creates a mutable workspace for one worker at a time.
| options | Workspace allocation options, or NULL for defaults. |
| allocator | Host allocator used for workspace-owned storage. |
| out_workspace | Receives the created workspace on success. |
| void loomc_workspace_query_statistics | ( | const loomc_workspace_t * | workspace, |
| loomc_workspace_statistics_t * | out_statistics ) |
Queries a monotonic snapshot of workspace allocation statistics.
| workspace | Workspace to inspect. Passing NULL returns zeroed statistics. |
| out_statistics | Receives the snapshot. Passing NULL is allowed. |
| void loomc_workspace_release | ( | loomc_workspace_t * | workspace | ) |
Releases workspace and all storage it owns.
| workspace | Workspace to release. Passing NULL is allowed. |
| void loomc_workspace_retain | ( | loomc_workspace_t * | workspace | ) |
Retains workspace for another owner.
| workspace | Workspace to retain. Passing NULL is allowed. |
| void loomc_workspace_trim | ( | loomc_workspace_t * | workspace | ) |
Trims idle arena blocks owned by workspace.
| workspace | Workspace to trim. |