diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-06-10 10:21:32 -0400 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-06-10 10:21:32 -0400 |
| commit | aebce1e48e81559ffe5f496af855a1140d8e0107 (patch) | |
| tree | 4ae6a60e627e26a8cf748fef80de8929ddd2e83e /docs/application | |
| parent | 2ed2fbbc6f233f8aedf14e5d064451c3dea90d87 (diff) | |
rename shared qualifier to gc
Diffstat (limited to 'docs/application')
| -rw-r--r-- | docs/application/buffer.md | 2 | ||||
| -rw-r--r-- | docs/application/gc.md | 12 | ||||
| -rw-r--r-- | docs/application/interface.md | 2 | ||||
| -rw-r--r-- | docs/application/io.md | 2 | ||||
| -rw-r--r-- | docs/application/namespace.md | 2 | ||||
| -rw-r--r-- | docs/application/pool.md | 5 | ||||
| -rw-r--r-- | docs/application/thread.md | 5 | ||||
| -rw-r--r-- | docs/application/type.md | 8 |
8 files changed, 24 insertions, 14 deletions
diff --git a/docs/application/buffer.md b/docs/application/buffer.md index 230c2d6..f8dff41 100644 --- a/docs/application/buffer.md +++ b/docs/application/buffer.md @@ -9,7 +9,7 @@ typedef struct _kpl_buffer { POOL_HEADER(_kpl_buffer); uint32_t byte_length; kpl_interface *interface; - uint8_t bytes; + uint8_t bytes[]; } kpl_buffer; ``` diff --git a/docs/application/gc.md b/docs/application/gc.md index e171a05..764285b 100644 --- a/docs/application/gc.md +++ b/docs/application/gc.md @@ -5,14 +5,19 @@ ## Object Definition ```c +typedef enum : uint16_t { + LOCK_MUTEX = 1 << 0, +} kpl_gc_flags; + typedef struct _kpl_gc { POOL_HEADER(_kpl_gc); _Atomic bool mark; + int16_t flags; kpl_any any; pthread_mutex_t mutex; } kpl_gc; -static _Atomic size_t gc_threads; +static _Atomic int32_t gc_threads; static pthread_mutex_t gc_head_mutex; @@ -25,5 +30,6 @@ static kpl_gc *gc_head_sweep, *gc_head; 2. This task moves the `gc_head` to the `gc_head_sweep` 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 `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 `gc_head_sweep` is done -5. What remains on the `gc_head_sweep` is added to `gc_head` +4. The async queue is moved to a temp queue and as each item on the tmep queue is marked it is moved back to the async queue +5. A sweep on the `gc_head_sweep` is done +6. What remains on the `gc_head_sweep` is added to `gc_head` diff --git a/docs/application/interface.md b/docs/application/interface.md index 8a5dc69..da4f4bb 100644 --- a/docs/application/interface.md +++ b/docs/application/interface.md @@ -28,6 +28,8 @@ typedef bool kpl_any_eq_fn(const kpl_any a, const kpl_any b); typedef ssize_t kpl_any_cmp_fn(const kpl_any a, const kpl_any b); +typedef void kpl_any_gc_mark(kpl_any a); + typedef void kpl_any_free_fn(kpl_any a); // TODO write diff --git a/docs/application/io.md b/docs/application/io.md index 7ac8dd8..301d0b4 100644 --- a/docs/application/io.md +++ b/docs/application/io.md @@ -2,4 +2,4 @@ --- -All IO is done through linux io_uring +All Io is done through linux io_uring diff --git a/docs/application/namespace.md b/docs/application/namespace.md index df4dc59..70bbc2d 100644 --- a/docs/application/namespace.md +++ b/docs/application/namespace.md @@ -10,8 +10,6 @@ typedef struct _kpl_export { kpl_type_ptr type; } kpl_export; -static queue *export_storage; - typedef struct _kpl_native_namespace { POOL_HEADER(_kpl_native_namespace); kpl_buffer *name; diff --git a/docs/application/pool.md b/docs/application/pool.md index f9baac6..ddbd3ee 100644 --- a/docs/application/pool.md +++ b/docs/application/pool.md @@ -11,9 +11,12 @@ typedef struct _kpl_pool_obj { POOL_HEADER(_kpl_pool_obj); } kpl_pool_obj; +typedef void kpl_pool_on_fn(void *obj); + typedef strut { - _Atomic size_t allocs; + _Atomic int32_t allocs; kpl_pool_obj *root; + kpl_pool_on_fn *on_init, *on_free; pthread_mutex_t mutex; } kpl_pool; diff --git a/docs/application/thread.md b/docs/application/thread.md index 7e13d71..fd5bb5d 100644 --- a/docs/application/thread.md +++ b/docs/application/thread.md @@ -17,6 +17,7 @@ typedef struct _kpl_task { kpl_group *state; kpl_interface *ret_interface; kpl_result ret; + _Atomic int32_t ref_count; } kpl_task; typedef struct { @@ -27,9 +28,9 @@ typedef struct { #define KPL_MAX_THREADS 64 -static uint16_t available_threads; // find with sched_getaffinity +static int32_t available_threads; // find with sched_getaffinity -static _Atomic uint16_t running_threads; // init to available_threads +static _Atomic int32_t running_threads; // init to available_threads static kpl_task *async_queue_head, *async_queue_tail; diff --git a/docs/application/type.md b/docs/application/type.md index 1967386..735d752 100644 --- a/docs/application/type.md +++ b/docs/application/type.md @@ -15,15 +15,15 @@ typedef struct { static const kpl_type_ptr kpl_type_ptr_null = { UINT16_MAX, UINT16_MAX }; -typedef enum : uint8_t { +typedef enum : uint16_t { // ... } kpl_type_template; -typedef enum : uint8_t { +typedef enum : uint16_t { CONST = 1 << 0 EMPTY = 1 << 1, REF = 1 << 2, - SHARED = 1 << 3, + GC = 1 << 3 } kpl_type_flags; typedef union { @@ -33,7 +33,7 @@ typedef union { typedef struct { kpl_type_template template; kpl_type_flags flags; - _Atomic unt16_t ref_count; + _Atomic int32_t ref_count; kpl_type_ptr self, prev, next, parent; kpl_type_body body; } kpl_type; |
