diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-06-21 11:51:41 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-06-21 11:51:41 -0400 |
| commit | 3a9cf2508dc7341a6d8ff4b8174064600d704994 (patch) | |
| tree | 63c3196cec86824f237ac82d92aa43c56010e607 /docs/application | |
| parent | 900445604bc38ef43d89f0c11f0cc61ce3cb0bce (diff) | |
update memory objs
Diffstat (limited to 'docs/application')
| -rw-r--r-- | docs/application/buffer.md | 4 | ||||
| -rw-r--r-- | docs/application/error.md | 2 | ||||
| -rw-r--r-- | docs/application/group.md | 3 | ||||
| -rw-r--r-- | docs/application/index.md | 26 | ||||
| -rw-r--r-- | docs/application/map.md | 6 | ||||
| -rw-r--r-- | docs/application/memory.md | 55 | ||||
| -rw-r--r-- | docs/application/name.md | 11 | ||||
| -rw-r--r-- | docs/application/namespace.md | 8 | ||||
| -rw-r--r-- | docs/application/native.md | 2 | ||||
| -rw-r--r-- | docs/application/queue.md | 6 | ||||
| -rw-r--r-- | docs/application/shared.md | 2 | ||||
| -rw-r--r-- | docs/application/thread.md | 5 | ||||
| -rw-r--r-- | docs/application/union.md | 2 |
13 files changed, 52 insertions, 80 deletions
diff --git a/docs/application/buffer.md b/docs/application/buffer.md index 4580fec..881fb27 100644 --- a/docs/application/buffer.md +++ b/docs/application/buffer.md @@ -6,8 +6,8 @@ ```c typedef struct _kpl_buffer { - KPL_POOL_HEADER(_kpl_buffer); - uint32_t byte_length; + KPL_POOL_HEADER(struct _kpl_buffer); + uint64_t byte_length; kpl_interface *interface; uint8_t bytes[]; } kpl_buffer; diff --git a/docs/application/error.md b/docs/application/error.md index 77a97cb..e6fae17 100644 --- a/docs/application/error.md +++ b/docs/application/error.md @@ -6,7 +6,7 @@ ```c typedef struct _kpl_error { - KPL_SLAB_HEADER(_kpl_error); + KPL_SLAB_HEADER(struct _kpl_error); char *file, *function; kpl_class class; int32_t line; diff --git a/docs/application/group.md b/docs/application/group.md index c96c901..286f1ee 100644 --- a/docs/application/group.md +++ b/docs/application/group.md @@ -6,8 +6,7 @@ ```c typedef struct _kpl_group { - KPL_POOL_HEADER(_kpl_group); - uint32_t item_length; + KPL_POOL_HEADER(struct _kpl_group); kpl_class items[]; } kpl_group; ``` diff --git a/docs/application/index.md b/docs/application/index.md index b89d79f..a534225 100644 --- a/docs/application/index.md +++ b/docs/application/index.md @@ -36,17 +36,19 @@ ### Module -### String - -### REPL - -1. ##### Parse -2. ##### Scan -3. ##### Scope -4. ##### Check -5. ##### Eval -6. ##### Ir -7. ##### Jit -8. ##### Exec +### String/REPL + +## Life cycle + +1. ##### [Register](../lifecycle/register.md) +2. ##### [Parse](../lifecycle/parse.md) +3. ##### Scan +4. ##### Scope +5. ##### Check +6. ##### Eval +7. ##### Ir +8. ##### Jit +9. ##### Exec +10. ##### Notify ## Shutdown diff --git a/docs/application/map.md b/docs/application/map.md index fd412e5..1bc8b40 100644 --- a/docs/application/map.md +++ b/docs/application/map.md @@ -6,13 +6,13 @@ ```c typedef struct _kpl_map_bucket { - KPL_SLAB_HEADER(_kpl_map_bucket); + KPL_SLAB_LIST_HEADER(struct _kpl_map_bucket); kpl_any key, value; } kpl_map_bucket; typedef struct _kpl_map { - KPL_POOL_HEADER(_kpl_map); - uint32_t length; + KPL_POOL_HEADER(strcut _kpl_map); + uint64_t length; kpl_interface *key_interface, *value_interface; kpl_map_bucket *head, *tail; kpl_map_bucket *buckets[]; diff --git a/docs/application/memory.md b/docs/application/memory.md index eda866f..fbc6b67 100644 --- a/docs/application/memory.md +++ b/docs/application/memory.md @@ -5,50 +5,27 @@ ## Object Definitions ```c -#define KPL_SLAB_HEADER(STRUCT) struct STRUCT *prev, *next; +#define KPL_SLAB_HEADER(STRUCT) STRCUT *next -typedef struct _kpl_slab_obj { - KPL_SLAB_HEADER(_kpl_slab_obj); +typdef strcut _kpl_slab_obj { + KPL_SLAB_LIST_HEADER(strcut _kpl_slab_obj); } kpl_slab_obj; -typedef struct _kpl_slab { - size_t array_index; - struct _kpl_slab *next; - uint8_t array[]; -} kpl_slab_alloc; +#define KPL_SLAB_LIST_HEADER(STRCUT) STRCUT *prev, *next -typedef struct { - uint32_t object_size, array_size; - _Atomic size_t slab_length; - kpl_slab *slab; - kpl_slab_obj *head; - kpl_mutex mutex; -} kpl_slab; +typdef strcut _kpl_slab_list_obj { + KPL_SLAB_LIST_HEADER(strcut _kpl_slab_list_obj); +} kpl_slab_list_obj; -#define KPL_POOL_HEADER(STRUCT) KPL_SLAB_HEADER(STRUCT); uint32_t obj_byte_size +#define KPL_SLAB_TREE_HEADER(STRUCT) STRUCT *parent, *left, *right, uint8_t tree_weight -typedef struct _kpl_pool_obj { - KPL_POOL_HEADER(_kpl_pool_obj); -} kpl_pool_obj; - -typedef strut { - uint32_t min_obj_size; - _Atomic size_t alloc_byte_size; - kpl_pool_obj *head; - kpl_mutex mutex; -} kpl_pool; -``` - -## Pool Object Size - -The max size of an object in the pool is 2 \*\* 32 +typdef strcut _kpl_slab_tree_obj { + KPL_SLAB_TREE_HEADER(struct _kpl_slab_tree_obj); +} kpl_slab_tree_obj; -This allows for 4 aligned bytes after the `POOL_HEADER` macro +#define KPL_POOL_HEADER(STRCUT) STRCUT *parent, *left, *right, uint8_t tree_weight, uint64_t obj_size : 56 -## Slab Leak Detection - -On debug builds before each slab is freed, all items removed from the slab should be found on the slabs pool - -## List Management - -## Tree Management +typdef struct _kpl_pool_obj { + KPL_POOL_HEADER(struct _kpl_pool_obj); +} kpl_pool_obj; +``` diff --git a/docs/application/name.md b/docs/application/name.md index a94789c..afc5880 100644 --- a/docs/application/name.md +++ b/docs/application/name.md @@ -8,14 +8,7 @@ Each word representing a var, symbol or type gets an `NAME_IDENTIFIER` -> `kpl_n ```c typedef struct _kpl_name { - KPL_POOL_HEADER(_kpl_name); - uint32_t length; - char *c_str[]; + KPL_POOL_HEADER(struct _kpl_name); + char c_str[]; } kpl_name; - -static kpl_name *kpl_name_head; ``` - -## Lookup and Storage - -All `kpl_name*` objects are stored as a tree under `*kpl_name_head` diff --git a/docs/application/namespace.md b/docs/application/namespace.md index ab38d3f..e6809d5 100644 --- a/docs/application/namespace.md +++ b/docs/application/namespace.md @@ -6,12 +6,12 @@ ```c typedef struct _kpl_export { - SLAB_HEADER(_kpl_export); + KPL_SLAB_TREE_HEADER(struct _kpl_export); kpl_type_ptr type; } kpl_export; typedef struct _kpl_namespace_native { - SLAB_HEADER(_kpl_namespace_native); + KPL_SLAB_TREE_HEADER(struct _kpl_namespace_native); kpl_buffer *name; kpl_export *exports; } kpl_namespace_native; @@ -19,12 +19,12 @@ typedef struct _kpl_namespace_native { static kpl_namespace_native *namespace_native_head; typedef struct _kpl_namespace_module { - SLAB_HEADER(_kpl_namespace_module); + KPL_SLAB_TREE_HEADER(struct _kpl_namespace_module); + kpl_type_ptr ast; kpl_queue *parents; kpl_buffer *module_name, *module_string; kpl_export *exports; kpl_task *task; - kpl_type_ptr ast; _Atomic int32_t children; } kpl_namespace_module; diff --git a/docs/application/native.md b/docs/application/native.md index 8cd8f82..705c4ed 100644 --- a/docs/application/native.md +++ b/docs/application/native.md @@ -6,7 +6,7 @@ ```c typedef struct _kpl_native { - KPL_SLAB_HEADER(_kpl_native); + KPL_SLAB_HEADER(struct _kpl_native); kpl_class class; } kpl_native; ``` diff --git a/docs/application/queue.md b/docs/application/queue.md index a04461e..5e8ae15 100644 --- a/docs/application/queue.md +++ b/docs/application/queue.md @@ -6,13 +6,13 @@ ```c typedef struct _kpl_queue_item { - KPL_SLAB_HEADER(_kpl_queue_item); + KPL_SLAB_LIST_HEADER(struct _kpl_queue_item); kpl_any any; } kpl_queue_item; typedef struct _kpl_queue { - KPL_SLAB_HEADER(_kpl_queue); - uint32_t length; + KPL_POOL_HEADER(strcut _kpl_queue); + uint64_t length; kpl_interface *interface; kpl_pool_any *head, *tail; } kpl_queue; diff --git a/docs/application/shared.md b/docs/application/shared.md index 88026f9..e68b590 100644 --- a/docs/application/shared.md +++ b/docs/application/shared.md @@ -6,7 +6,7 @@ ```c typedef struct _kpl_shared { - KPL_SLAB_HEADER(_kpl_shared); + KPL_SLAB_HEADER(struct _kpl_shared); kpl_class data; kpl_mutex mutex; bool mark; diff --git a/docs/application/thread.md b/docs/application/thread.md index 2f85a67..ff03183 100644 --- a/docs/application/thread.md +++ b/docs/application/thread.md @@ -59,9 +59,10 @@ On the start of each thread, set the cpu affinity to its thread id ```text 0 -> length native : arguments -process : arguments, locals, parent +process : arguments, locals closure : arguments, locals, closure function -iterator : arguments, locals, iterator functions, iterator function index +iterator : arguments, locals, iterator function index, iterator functions +regex : captures, function state, regex function ``` ## Per Process Task Queue diff --git a/docs/application/union.md b/docs/application/union.md index fa19e6d..3626f1c 100644 --- a/docs/application/union.md +++ b/docs/application/union.md @@ -6,7 +6,7 @@ ```c typedef struct _kpl_union { - KPL_SLAB_HEADER(_kpl_union); + KPL_SLAB_HEADER(strcut _kpl_union); kpl_class class; uint32_t tag; } kpl_union; |
