sketch out ptr graph building data structures

This commit is contained in:
Ryan Fleury
2024-10-13 20:14:59 -07:00
parent adb8d5237c
commit 8a1dd578a7
2 changed files with 61 additions and 8 deletions
+8 -2
View File
@@ -191,6 +191,13 @@ ptg_builder_thread__entry_point(void *p)
}
}
//- rjf: do task
if(got_task)
{
}
//- rjf: commit results to cache
if(got_task) OS_MutexScopeW(stripe->rw_mutex)
{
@@ -255,8 +262,7 @@ ptg_evictor_thread__entry_point(void *p)
n->is_working == 0)
{
DLLRemove(slot->first, slot->last, n);
arena_clear(n->node_arena);
arena_clear(n->link_arena);
arena_clear(n->arena);
SLLStackPush(stripe->free_node, n);
}
}
+53 -6
View File
@@ -31,13 +31,61 @@ struct PTG_Link
U32 to;
};
typedef struct PTG_NodeChunkNode PTG_NodeChunkNode;
struct PTG_NodeChunkNode
{
PTG_NodeChunkNode *next;
PTG_Node *v;
U64 count;
U64 cap;
};
typedef struct PTG_NodeChunkList PTG_NodeChunkList;
struct PTG_NodeChunkList
{
PTG_NodeChunkNode *first;
PTG_NodeChunkNode *last;
U64 chunk_count;
U64 total_count;
};
typedef struct PTG_NodeArray PTG_NodeArray;
struct PTG_NodeArray
{
PTG_Node *v;
U64 count;
};
typedef struct PTG_LinkChunkNode PTG_LinkChunkNode;
struct PTG_LinkChunkNode
{
PTG_LinkChunkNode *next;
PTG_Link *v;
U64 count;
U64 cap;
};
typedef struct PTG_LinkChunkList PTG_LinkChunkList;
struct PTG_LinkChunkList
{
PTG_LinkChunkNode *first;
PTG_LinkChunkNode *last;
U64 chunk_count;
U64 total_count;
};
typedef struct PTG_LinkArray PTG_LinkArray;
struct PTG_LinkArray
{
PTG_Link *v;
U64 count;
};
typedef struct PTG_Graph PTG_Graph;
struct PTG_Graph
{
PTG_Node *nodes;
U64 nodes_count;
PTG_Link *links;
U64 links_count;
PTG_NodeArray nodes;
PTG_LinkArray links;
};
typedef struct PTG_GraphNode PTG_GraphNode;
@@ -58,8 +106,7 @@ struct PTG_GraphNode
B32 is_working;
// rjf: content
Arena *node_arena;
Arena *link_arena;
Arena *arena;
PTG_Graph graph;
};