summaryrefslogtreecommitdiff
path: root/docs
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
parent9d6a15b55bc948227401cb0be721e764e8053b50 (diff)
tracing gc only
Diffstat (limited to 'docs')
-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
-rw-r--r--docs/language/index.md10
-rw-r--r--docs/language/ownership.md2
-rw-r--r--docs/type_system/enum.md2
-rw-r--r--docs/type_system/name.md2
-rw-r--r--docs/type_system/namespace.md2
-rw-r--r--docs/type_system/shared.md17
-rw-r--r--docs/type_system/var.md2
11 files changed, 44 insertions, 42 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 {
diff --git a/docs/language/index.md b/docs/language/index.md
index 8925f96..8ef01fd 100644
--- a/docs/language/index.md
+++ b/docs/language/index.md
@@ -120,6 +120,16 @@ Type[arg]
## Destructuring
+Take values out of a collection
+
+```text
+target [VAR_NAME.TARGET_NAME]
+target [VAR_NAME] // Resolves to VAR_NAME.VAR_NAME
+target [VAR_NAME_AT_INDEX]
+```
+
+### Destructuring Example with Indexes
+
```text
v : Tuple $ (1; 2; 3)
v [a; b; c]
diff --git a/docs/language/ownership.md b/docs/language/ownership.md
index 71e15a7..9f29d8d 100644
--- a/docs/language/ownership.md
+++ b/docs/language/ownership.md
@@ -36,4 +36,6 @@ float_array : Array[F64] $ ()
# Locking
+Prevent access to a container it's contents are modified
+
## References
diff --git a/docs/type_system/enum.md b/docs/type_system/enum.md
index 6b06849..ebcaea6 100644
--- a/docs/type_system/enum.md
+++ b/docs/type_system/enum.md
@@ -12,5 +12,5 @@ Enum[TYPE; Collection[.symbol : Const[Value]]]
```text
E : Enum[I64; .a; .b; .c]
-`log E Enum[I64; .a : 0; .b : 1; .c : 2]
+`log E // Enum[I64; .a : 0; .b : 1; .c : 2]
```
diff --git a/docs/type_system/name.md b/docs/type_system/name.md
index 9d24f65..1b7c82c 100644
--- a/docs/type_system/name.md
+++ b/docs/type_system/name.md
@@ -3,7 +3,7 @@
---
```text
-Name_class `alias Enum[Void; .unknown; .data; .alias; .unique]
+Name_class `alias Enum[Void; .unknown; .is_type; .alias_type; .unique_type]
Name[Name_class; TYPE; NAME_IDENTIFIER]
```
diff --git a/docs/type_system/namespace.md b/docs/type_system/namespace.md
index 68a84b6..8879db4 100644
--- a/docs/type_system/namespace.md
+++ b/docs/type_system/namespace.md
@@ -4,7 +4,7 @@
```text
Namespace_class `alias Enum[Void; .native; .file]
-Namespace[Namespace_class; EXPORTS; PROCESS]
+Namespace[Namespace_class; NAMESPACE_IDENTIFIER]
```
A file with code
diff --git a/docs/type_system/shared.md b/docs/type_system/shared.md
index dd46afa..b6e9ded 100644
--- a/docs/type_system/shared.md
+++ b/docs/type_system/shared.md
@@ -3,22 +3,15 @@
---
```text
-Shared_collector `alias Enum[Void; .unknown; .counting; .tracing]
-Shared[Shared_collector; TYPE]
-
-Shared[TYPE] // Resolves to Shared[.unknown; TYPE]
+Shared[TYPE]
```
-# Garbage Collection Method
-
-## Unknown
-
-Counting or tracing will determined later on
+# Use in Asynchronous Functions
-## Counting
+# Garbage Collection
-## Tracing
+A tracing mark and sweep garbage collector is used
# Mutating
@@ -27,5 +20,5 @@ x : Shared[Array] $ (1; 2; 3)
^ x {[y]
y `push 4
}
-`log x // Shared[.counting; Array[I64]] $ (1; 2; 3; 4)
+`log x // Shared[Array[I64]] $ (1; 2; 3; 4)
```
diff --git a/docs/type_system/var.md b/docs/type_system/var.md
index 12ceace..1cab8ed 100644
--- a/docs/type_system/var.md
+++ b/docs/type_system/var.md
@@ -2,8 +2,6 @@
---
-A unique identifier
-
```text
Var_class `alias Enum[Void; .arg; .local; .loop; .match]