From 4da9de3213a28c7e17945168acdb06308bb41df8 Mon Sep 17 00:00:00 2001 From: nodist Date: Tue, 9 Jun 2026 10:07:44 -0400 Subject: use group for tuple and table --- docs/application/gc.md | 10 +++++----- docs/application/group.md | 13 +++++++++++++ docs/application/index.md | 2 +- docs/application/namespace.md | 4 +++- docs/application/thread.md | 4 ++-- docs/application/tuple.md | 13 ------------- 6 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 docs/application/group.md delete mode 100644 docs/application/tuple.md (limited to 'docs/application') diff --git a/docs/application/gc.md b/docs/application/gc.md index 9364e12..ff538ee 100644 --- a/docs/application/gc.md +++ b/docs/application/gc.md @@ -15,16 +15,16 @@ typedef struct _kpl_gc { pthread_mutex_t mutex; } kpl_gc; -static _Atomic size_t marked_threads; +static _Atomic size_t gc_threads; -static kpl_gc *old_gc_head, *gc_head, *gc_tail; +static kpl_gc *old_gc_head, *gc_head; ``` ## Counting `ref_count` starts at 1 -Each assign increments the reference count, each time it goes out of scope the reference count is decreased +Each assign increments the `ref_count`, each time it goes out of scope the `ref_count` is decreased When `ref_count` hits 0, data is freed @@ -33,6 +33,6 @@ When `ref_count` hits 0, data is freed 1. Once triggered add a init task to the async queue 2. This task moves the `gc_head` to the `old_gc_head` and sets the `gc_wait` to off for each thread 3. Each thread will run down its queue queue marking found gc objects -3. Once all have run and `marked_threads == available_threads` add a mark and sweep task to the async queue +3. Once all have run and `gc_threads == available_threads` add a mark and sweep task to the async queue 4. Async task goes down async queue and does final mark, then a sweep on the `old_gc_head` is done -5. What remains on the `old_gc_head` is added to the gc tail +5. What remains on the `old_gc_head` is added to `gc_head` diff --git a/docs/application/group.md b/docs/application/group.md new file mode 100644 index 0000000..2d5ed4b --- /dev/null +++ b/docs/application/group.md @@ -0,0 +1,13 @@ +# Group + +--- + +## Object Definitions + +```c +typedef struct _kpl_group { + POOL_HEADER(_kpl_group); + uint32_t item_length; + kpl_class items[]; +} kpl_group; +``` diff --git a/docs/application/index.md b/docs/application/index.md index f4a013b..9f316bc 100644 --- a/docs/application/index.md +++ b/docs/application/index.md @@ -16,7 +16,7 @@ * ##### [Thread](./thread.md) * ##### [Io](./io.md) * ##### [Gc](./gc.md) -* ##### [Tuple](./tuple.md) +* ##### [Group](./group.md) * ##### [Buffer](./buffer.md) * ##### [Map](./map.md) * ##### [Queue](./queue.md) diff --git a/docs/application/namespace.md b/docs/application/namespace.md index 6891376..41d9ee5 100644 --- a/docs/application/namespace.md +++ b/docs/application/namespace.md @@ -7,11 +7,13 @@ ```c typedef struct _kpl_export { POOL_HEADER(_kpl_export); - _Atomic int32_t ref_count; + kpl_type_ptr type; kpl_buffer *name; kpl_class *class; } kpl_export; +static kpl_export *export_head; + typedef struct _kpl_native_namespace { POOL_HEADER(_kpl_native_namespace); kpl_buffer *name; diff --git a/docs/application/thread.md b/docs/application/thread.md index ba67a7e..7e13d71 100644 --- a/docs/application/thread.md +++ b/docs/application/thread.md @@ -14,7 +14,7 @@ typedef struct _kpl_task { _Atomic bool join_ready; uint16_t worker_id; kpl_task_fn *fn; - kpl_tuple *state; + kpl_group *state; kpl_interface *ret_interface; kpl_result ret; } kpl_task; @@ -45,7 +45,7 @@ static kpl_thread threads[KPL_MAX_THREADS]; ```text 0 -> length native : arguments -process : arguments, locals +process : arguments, locals, parent closure : arguments, locals, closure function iterator : arguments, locals, iterator functions, iterator function index ``` diff --git a/docs/application/tuple.md b/docs/application/tuple.md deleted file mode 100644 index e0e926c..0000000 --- a/docs/application/tuple.md +++ /dev/null @@ -1,13 +0,0 @@ -# Tuple - ---- - -## Object Definitions - -```c -typedef struct _kpl_tuple { - POOL_HEADER(_kpl_tuple); - uint32_t item_length; - kpl_class items[]; -} kpl_tuple; -``` -- cgit v1.2.3