From 224c245a875a6f28c01e93d037329c708ef81dd4 Mon Sep 17 00:00:00 2001 From: nodist Date: Wed, 15 Jul 2026 20:40:49 -0400 Subject: type var definitions --- docs/application/group.md | 1 + docs/application/index.md | 10 ++++++---- docs/application/namespace.md | 29 ++++++++++++----------------- docs/application/type.md | 16 +++++++++++++++- 4 files changed, 34 insertions(+), 22 deletions(-) (limited to 'docs/application') diff --git a/docs/application/group.md b/docs/application/group.md index 1294afe..7ed6382 100644 --- a/docs/application/group.md +++ b/docs/application/group.md @@ -7,6 +7,7 @@ ```c typedef struct _kpl_group { KPL_DYNAMIC_OBJ_HEADER(); + int32_t item_length; kpl_class items[]; } kpl_group; ``` diff --git a/docs/application/index.md b/docs/application/index.md index 6c84525..0dd4b7e 100644 --- a/docs/application/index.md +++ b/docs/application/index.md @@ -40,6 +40,7 @@ * Built In Alias 5. Initialize IO * Size of registered sparse buffers +6. Initialize Jit ## Main @@ -62,7 +63,8 @@ ## Shutdown -1. Clean up IO -2. Clean up types -3. Clean up tasks -4. Clean up allocators +1. Clean up Jit +2. Clean up IO +3. Clean up types +4. Clean up tasks +5. Clean up allocators diff --git a/docs/application/namespace.md b/docs/application/namespace.md index e9842cd..cd1f89e 100644 --- a/docs/application/namespace.md +++ b/docs/application/namespace.md @@ -5,29 +5,24 @@ ## Object Definitions ```c -typedef struct _kpl_export { - int32_t tree_weight; - struct _kpl_export *tree_left, *tree_right; - kpl_type *type; -} kpl_export; +#define KPL_TREE_HEADER() uint32_t tree_weight, module_id; struct _kpl_namespace_tree *tree_left, *tree_right; kpl_buffer *name + +typedef struct _kpl_namespace_tree { + KPL_TREE_HEADER(); +} kpl_namespace_tree_obj; typedef struct _kpl_namespace_native { - int32_t tree_weight; - struct _kpl_namespace_native *tree_left, *tree_right; - const char *name; - kpl_export *export_tree; + KPL_TREE_HEADER(); + kpl_type *export_var_tree; } kpl_namespace_native; static kpl_namespace_native *namespace_native_tree; typedef struct _kpl_namespace_module { - uint32_t module_id; - int32_t tree_weight; - struct _kpl_namespace_module *tree_left, *tree_right; - kpl_buffer *module_string, *module_name; - kpl_export *export_tree; + KPL_TREE_HEADER(); + kpl_buffer *body; + kpl_type *ast, *export_var_tree; kpl_mutex export_mutex; - kpl_type *ast; } kpl_namespace_module; static kpl_namespace_module *namespace_module_tree; @@ -73,7 +68,7 @@ Add a [Register](../lifecycle/register.md) task to `namespace_module_mutex` ### ``export` -Add exports directly to the namespaces `export_tree`, thread safe +Add exports directly to the namespaces `export_var_tree`, thread safe ## String/REPL @@ -94,7 +89,7 @@ Since the native modules are loaded statically the `native_module_tree` becomes 1. Add find namespace task to the `namespace_module_mutex`, the namespace not existing is an error 2. Add a get export task to the namespaces `export_mutex` 3. The `export_mutex` will not start processing it's queue until the namespace notifies that it's and unlocks its `export_mutex` -4. The importer will get a copy of the read only `export_tree` +4. The importer will get a copy of the read only `export_var_tree` # AVL Tree Storage and Lookup diff --git a/docs/application/type.md b/docs/application/type.md index f028fba..3a831b2 100644 --- a/docs/application/type.md +++ b/docs/application/type.md @@ -26,6 +26,17 @@ typedef struct { int32_t position, module_id; } kpl_token; +typedef enum { + NONE, + GENERAL_REGISTER, + XMM_REGISTER, + STACK +} kpl_native_storage; + +typedef struct { + uint8_t storage : 2, id : 6; +} kpl_native_id; + typedef struct _kpl_type { kpl_type_template template; uint8_t qualifiers; @@ -33,7 +44,10 @@ typedef struct _kpl_type { union { kpl_token token; struct { - int32_t id, tree_weight; + kpl_native_id native_id; + int8_t process_state_id; // -1 not used + uint16_t tree_weight; + struct _kpl_type *function; } var; } meta; _Atomic ssize_t ref_count; -- cgit v1.2.3