summaryrefslogtreecommitdiff
path: root/docs/application
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-06-09 18:37:35 -0400
committernodist <kevin.comas.git@gmail.com>2026-06-09 18:37:35 -0400
commit2ed2fbbc6f233f8aedf14e5d064451c3dea90d87 (patch)
tree1fb763551926b18b43b1e310e6babe46c870c9f6 /docs/application
parent9d6a15b55bc948227401cb0be721e764e8053b50 (diff)
tracing gc only
Diffstat (limited to 'docs/application')
-rw-r--r--docs/application/gc.md23
-rw-r--r--docs/application/name.md2
-rw-r--r--docs/application/namespace.md22
-rw-r--r--docs/application/type.md2
4 files changed, 24 insertions, 25 deletions
diff --git a/docs/application/gc.md b/docs/application/gc.md
index ff538ee..e171a05 100644
--- a/docs/application/gc.md
+++ b/docs/application/gc.md
@@ -7,32 +7,23 @@
```c
typedef struct _kpl_gc {
POOL_HEADER(_kpl_gc);
- union {
- _Atomic int32_t ref_count;
- _Atomic bool mark;
- } method;
+ _Atomic bool mark;
kpl_any any;
pthread_mutex_t mutex;
} kpl_gc;
static _Atomic size_t gc_threads;
-static kpl_gc *old_gc_head, *gc_head;
-```
-
-## Counting
-
-`ref_count` starts at 1
+static pthread_mutex_t gc_head_mutex;
-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
+static kpl_gc *gc_head_sweep, *gc_head;
+```
## Tracing
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
+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 `old_gc_head` is done
-5. What remains on the `old_gc_head` is added to `gc_head`
+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`
diff --git a/docs/application/name.md b/docs/application/name.md
index 0fcc669..fe3f0eb 100644
--- a/docs/application/name.md
+++ b/docs/application/name.md
@@ -18,4 +18,4 @@ static kpl_name *kpl_name_head;
## Lookup and Storage
-All `kpl_name*` objects are stored as a tree under `kpl_name_head`
+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 63d1f1a..df4dc59 100644
--- a/docs/application/namespace.md
+++ b/docs/application/namespace.md
@@ -8,11 +8,9 @@
typedef struct _kpl_export {
POOL_HEADER(_kpl_export);
kpl_type_ptr type;
- kpl_buffer *name;
- kpl_class *class;
} kpl_export;
-static kpl_export *export_head;
+static queue *export_storage;
typedef struct _kpl_native_namespace {
POOL_HEADER(_kpl_native_namespace);
@@ -20,6 +18,8 @@ typedef struct _kpl_native_namespace {
kpl_export *exports;
} kpl_native_namespace;
+static kpl_native_namespace *native_namespace_head;
+
typedef struct _kpl_file_namespace {
POOL_HEADER(_kpl_file_namespace);
kpl_type_ptr ast;
@@ -27,17 +27,27 @@ typedef struct _kpl_file_namespace {
kpl_buffer *file_name, *file_string;
kpl_export *exports;
kpl_task *task;
- _Atomic size_t children;
+ _Atomic int32_t children;
} kpl_file_namespace;
+static kpl_file_namespace *file_namespace_head;
+
typedef struct _kpl_string_namespace {
- _Atomic int16_t children;
- kpl_type_ptr ast;
kpl_buffer *string;
kpl_task *task;
+ kpl_type_ptr ast;
+ _Atomic int32_t children;
} kpl_string_namespace;
```
+Each `NAMESPACE_IDENTIFIER` maps to `kpl_native_namespace*` or `kpl_file_namespace*` depending on `Namespace_class`
+
+## Lookup and Storage
+
+The native and namespace objects are stored as a tree under `native_namespace_head` and `file_namespace_head`
+
+The exports are stored under a tree for both the native and namespace objects
+
# Registering
## Native
diff --git a/docs/application/type.md b/docs/application/type.md
index a89302e..1967386 100644
--- a/docs/application/type.md
+++ b/docs/application/type.md
@@ -24,8 +24,6 @@ typedef enum : uint8_t {
EMPTY = 1 << 1,
REF = 1 << 2,
SHARED = 1 << 3,
- COUTING = 1 << 4,
- TRACING = 1 << 5
} kpl_type_flags;
typedef union {