diff options
| -rw-r--r-- | docs/application/index.md | 7 | ||||
| -rw-r--r-- | docs/application/map.md | 16 | ||||
| -rw-r--r-- | docs/application/pool.md | 2 | ||||
| -rw-r--r-- | docs/application/queue.md | 8 | ||||
| -rw-r--r-- | docs/application/thread.md | 12 | ||||
| -rw-r--r-- | docs/application/type.md | 40 |
6 files changed, 70 insertions, 15 deletions
diff --git a/docs/application/index.md b/docs/application/index.md index 2717005..49fd22d 100644 --- a/docs/application/index.md +++ b/docs/application/index.md @@ -32,14 +32,13 @@ ### String/REPL -## Evaluation - 1. ##### Scan 2. ##### Parse 3. ##### Scope 4. ##### Check 5. ##### Eval -6. ##### Jit -7. ##### Exec +6. ##### Ir +7. ##### Jit +8. ##### Exec ## Shutdown diff --git a/docs/application/map.md b/docs/application/map.md index b9d8fa0..fd238e9 100644 --- a/docs/application/map.md +++ b/docs/application/map.md @@ -1,3 +1,19 @@ # Map --- + +## Object Definitions + +```c +typedef struct _kpl_map_bucket { + POOL_HEADER(_kpl_map_bucket); + kpl_any key, value; +} kpl_map_bucket; + +typedef struct _kpl_map { + POOL_HEADER(_kpl_map); + int32_t used; + kpl_interface *key_interface, *value_interface; + kpl_map_bucket *buckets[]; +} kpl_map; +``` diff --git a/docs/application/pool.md b/docs/application/pool.md index a73dd82..46602bf 100644 --- a/docs/application/pool.md +++ b/docs/application/pool.md @@ -10,6 +10,8 @@ typedef struct _kpl_pool_obj { POOL_HEADER(_kpl_pool_obj); } kpl_pool_obj; + +static kpl_pool_obj *kpl_pool_head; ``` ## List Management diff --git a/docs/application/queue.md b/docs/application/queue.md index 21ec995..bff1dd7 100644 --- a/docs/application/queue.md +++ b/docs/application/queue.md @@ -2,16 +2,18 @@ --- +## Object Definitions + ```c typedef struct _kpl_queue_item { POOL_HEADER(_kpl_queue_item); - kpl_interface *interface; - kpl_class class; + kpl_any any; } kpl_queue_item; typedef struct _kpl_queue { POOL_HEADER(_kpl_queue); uint32_t length; - kpl_queue_item *head, *tail; + kpl_interface *interface; + kpl_pool_any *head, *tail; } kpl_queue; ``` diff --git a/docs/application/thread.md b/docs/application/thread.md index 56d8566..3dc0b2f 100644 --- a/docs/application/thread.md +++ b/docs/application/thread.md @@ -26,17 +26,17 @@ typedef struct { #define KPL_MAX_THREADS 64 -uint16_t available_threads; // find with sched_getaffinity +static uint16_t available_threads; // find with sched_getaffinity -_Atomic uint16_t running_threads; // init to available_threads +static _Atomic uint16_t running_threads; // init to available_threads -kpl_task *async_queue_head, *async_queue_tail; +static kpl_task *async_queue_head, *async_queue_tail; -pthread_mutex_t async_mutex; +static pthread_mutex_t async_mutex; -pthread_cond_t async_cond; +static pthread_cond_t async_cond; -kpl_thread threads[KPL_MAX_THREADS]; +static kpl_thread threads[KPL_MAX_THREADS]; ``` ## Task State diff --git a/docs/application/type.md b/docs/application/type.md index eae1425..52b28de 100644 --- a/docs/application/type.md +++ b/docs/application/type.md @@ -2,6 +2,42 @@ --- -## Allocation - ## Object Definitions + +```c +#define KPL_TYPE_BLOCK_ARRAY_SIZE UINT16_MAX + +#define KPL_TYPE_BLOCKS_SIZE UINT16_MAX + +typedef struct { + uint16_t block_index, array_index; +} kpl_type_ptr; + +static const kpl_type_ptr kpl_type_ptr_null = { UINT16_MAX, UINT16_MAX }; + +typedef enum __attribute__((packed)) { + // ... +} kpl_type_template; + +typedef enum __attribute__((packed)) { + // .. +} kpl_type_flags; + +typedef union { + // ... +} kpl_type_body; + +typedef struct { + kpl_type_template template; + uint16_t flags; + kpl_type_ptr self, prev, next, parent; + _Atomic int32_t ref_count; + kpl_type_body body; +} kpl_type; + +static size_t type_array_block_index; + +static kpl_type *type_array_blocks[KPL_TYPE_BLOCKS_SIZE]; + +static kpl_type_ptr type_pool_head; +``` |
