Core
Core runtime and utility facilities.
Classes
| Name | Description |
|---|---|
Arena |
Linear allocation arena. |
Typedefs
| Return | Name | Description |
|---|---|---|
void |
printnum_fn |
printnum_fn
void printnum_fn()
Functions
| Return | Name | Description |
|---|---|---|
int |
add |
Adds two integers. |
int |
main |
Runs a small JIT flow and prints a hello-world message. |
void |
arena_init static inline |
Initializes an arena with fixed capacity. |
void * |
arena_alloc static inline |
Allocates aligned memory from the arena. |
void |
arena_free static inline |
Releases arena buffer and resets state. |
add
int add(int a, int b)
Adds two integers.
Parameters
-
aFirst integer. -
bSecond integer.
Returns
The sum of a and b.
main
int main()
Runs a small JIT flow and prints a hello-world message.
Returns
Process exit code.
arena_init
static inline
static inline void arena_init(Arena * a, size_t cap)
Initializes an arena with fixed capacity.
Parameters
-
aArena to initialize. -
capBuffer capacity in bytes.
arena_alloc
static inline
static inline void * arena_alloc(Arena * a, size_t size)
Allocates aligned memory from the arena.
Parameters
-
aArena to allocate from. -
sizeRequested byte size.
Returns
Pointer to allocated storage inside the arena.
arena_free
static inline
static inline void arena_free(Arena * a)
Releases arena buffer and resets state.
Parameters
aArena to release.
Arena
#include <arena.h>
Linear allocation arena.
Public Attributes
| Return | Name | Description |
|---|---|---|
char * |
buf |
Backing buffer for all allocations. |
size_t |
used |
Number of bytes currently consumed. |
size_t |
cap |
Total arena capacity in bytes. |
buf
char * buf
Backing buffer for all allocations.
used
size_t used
Number of bytes currently consumed.
cap
size_t cap
Total arena capacity in bytes.