GenericGraphSlot
Description
Type-erased slot layout used by the runtime helpers in Source/Misra/Std/Container/Graph.c. GraphSlot(T) below is the typed variant; both have identical layout (the data field is a pointer, and void * / T * share representation).
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Graph.c:44:
}
static bool graph_slot_is_occupied(const GenericGraphSlot *slot) {
return (slot->flags & GRAPH_SLOT_OCCUPIED) != 0;
}- In
Graph.c:48:
}
static bool graph_slot_is_marked(const GenericGraphSlot *slot) {
return (slot->flags & GRAPH_SLOT_MARKED) != 0;
}- In
Graph.c:58:
}
static GenericGraphSlot *graph_slot_ptr_raw(GenericGraph *graph, u32 index) {
return VecPtrAt(&graph->slots, index);
}- In
Graph.c:62:
}
static const GenericGraphSlot *graph_slot_ptr_const_raw(const GenericGraph *graph, u32 index) {
return VecPtrAt((GraphSlots *)&graph->slots, index);
}- In
Graph.c:69:
u32 index;
u32 generation;
const GenericGraphSlot *slot;
index = GraphNodeIdIndex(node_id);- In
Graph.c:90:
}
static GenericGraphSlot *graph_require_live_slot(GenericGraph *graph, GraphNodeId node_id) {
graph_validate_node_id(graph, node_id);
return graph_slot_ptr_raw(graph, GraphNodeIdIndex(node_id));- In
Graph.c:95:
}
static const GenericGraphSlot *graph_require_live_slot_const(const GenericGraph *graph, GraphNodeId node_id) {
graph_validate_node_id(graph, node_id);
return graph_slot_ptr_const_raw(graph, GraphNodeIdIndex(node_id));- In
Graph.c:145:
}
static void graph_ensure_slot_generation_available(GenericGraphSlot *slot) {
if (slot->generation == UINT32_MAX) {
LOG_FATAL("graph slot generation exhausted");- In
Graph.c:151:
}
static void graph_release_slot(GenericGraph *graph, GenericGraphSlot *slot, size item_size) {
if (!graph_slot_is_occupied(slot)) {
return;- In
Graph.c:268:
while (idx < neighbors->length) {
GraphNodeId neighbor_id = VecAt(neighbors, idx);
const GenericGraphSlot *slot;
graph_validate_node_index_raw(graph, GraphNodeIdIndex(neighbor_id));- In
Graph.c:341:
for (slot_index = 0; slot_index < graph->slots.length; slot_index++) {
const GenericGraphSlot *slot = VecPtrAt((GraphSlots *)&graph->slots, slot_index);
GraphNodeId self_id = graph_make_node_id((u32)slot_index, slot->generation);
u64 neighbor_i;- In
Graph.c:364:
for (neighbor_i = 0; neighbor_i < slot->out_neighbors.length; neighbor_i++) {
GraphNodeId neighbor_id = VecAt(&slot->out_neighbors, neighbor_i);
const GenericGraphSlot *target_slot;
graph_validate_node_id(graph, neighbor_id);- In
Graph.c:375:
for (neighbor_i = 0; neighbor_i < slot->in_neighbors.length; neighbor_i++) {
GraphNodeId predecessor_id = VecAt(&slot->in_neighbors, neighbor_i);
const GenericGraphSlot *source_slot;
graph_validate_node_id(graph, predecessor_id);- In
Graph.c:444:
clear_graph(graph, item_size);
deinit_vec(GENERIC_VEC(&graph->slots), sizeof(GenericGraphSlot));
deinit_vec(GENERIC_VEC(&graph->free_indices), sizeof(u32));
deinit_vec(GENERIC_VEC(&graph->pending_edge_removals), sizeof(GraphPendingEdgeRemoval));- In
Graph.c:465:
for (slot_index = 0; slot_index < graph->slots.length; slot_index++) {
GenericGraphSlot *slot = VecPtrAt(&graph->slots, slot_index);
if (graph_slot_is_occupied(slot)) {
graph_release_slot(graph, slot, item_size);- In
Graph.c:501:
success = reserve_vec(GENERIC_VEC(&graph->free_indices), sizeof(u32), n) &&
reserve_vec(GENERIC_VEC(&graph->slots), sizeof(GenericGraphSlot), n);
if (!success) {
return false;- In
Graph.c:515:
GraphNodeId graph_push_node(GenericGraph *graph, const void *item_data, size item_size) {
GraphNodeId node_id;
GenericGraphSlot slot;
GenericGraphSlot *slot_ptr;
u32 slot_index;- In
Graph.c:516:
GraphNodeId node_id;
GenericGraphSlot slot;
GenericGraphSlot *slot_ptr;
u32 slot_index;- In
Graph.c:581:
GENERIC_VEC(&graph->slots),
(char *)&slot,
sizeof(GenericGraphSlot),
graph->slots.length,
1- In
Graph.c:618:
u32 index;
u32 generation;
GenericGraphSlot *slot;
if (!graph) {- In
Graph.c:757:
u64 graph_node_visit(GraphNode node) {
GenericGraph *graph;
GenericGraphSlot *slot;
node = graph_validate_node_handle(node);- In
Graph.c:773:
void graph_node_unvisit(GraphNode node) {
GenericGraph *graph;
GenericGraphSlot *slot;
node = graph_validate_node_handle(node);- In
Graph.c:784:
u64 graph_node_visit_count(GraphNode node) {
GenericGraph *graph;
const GenericGraphSlot *slot;
node = graph_validate_node_handle(node);- In
Graph.c:798:
bool graph_mark_node_for_deletion(GraphNode node) {
GenericGraph *graph;
GenericGraphSlot *slot;
node = graph_validate_node_handle(node);- In
Graph.c:815:
bool graph_node_marked_for_deletion(GraphNode node) {
GenericGraph *graph;
const GenericGraphSlot *slot;
node = graph_validate_node_handle(node);- In
Graph.c:826:
bool graph_unmark_node_for_deletion(GraphNode node) {
GenericGraph *graph;
GenericGraphSlot *slot;
node = graph_validate_node_handle(node);- In
Graph.c:911:
for (slot_index = 0; slot_index < graph->slots.length; slot_index++) {
GenericGraphSlot *slot = VecPtrAt(&graph->slots, slot_index);
if (graph_slot_is_occupied(slot) && graph_slot_is_marked(slot)) {
GraphNodeId marked_id = graph_make_node_id((u32)slot_index, slot->generation);- In
Graph.c:919:
for (slot_index = 0; slot_index < graph->slots.length; slot_index++) {
GenericGraphSlot *slot = VecPtrAt(&graph->slots, slot_index);
if (graph_slot_is_occupied(slot) && !graph_slot_is_marked(slot)) {
GraphNodeId live_id = graph_make_node_id((u32)slot_index, slot->generation);- In
Graph.c:927:
for (slot_index = 0; slot_index < graph->slots.length; slot_index++) {
GenericGraphSlot *slot = VecPtrAt(&graph->slots, slot_index);
if (graph_slot_is_occupied(slot) && graph_slot_is_marked(slot)) {
if (slot->out_neighbors.length || slot->in_neighbors.length) {- In
Graph.c:971:
while (iter->slot_index < iter->graph->slots.length) {
u32 index = (u32)iter->slot_index;
GenericGraphSlot *slot = VecPtrAt(&iter->graph->slots, iter->slot_index);
iter->slot_index += 1;- In
Graph.Init.c:47:
// `graph.slots` is the typed `Vec(GraphSlot(int))`, so iterate via
// the runtime-shared layout to avoid an anonymous-struct annotation.
GenericGraphSlot *slot = (GenericGraphSlot *)VecPtrAt(&GENERIC_GRAPH(&graph)->slots, slot_index);
result = result && (slot->data == NULL);
result = result && (slot->visit_count == 0);- In
Type.h:90:
u32 generation;
u32 flags;
} GenericGraphSlot;
typedef Vec(GenericGraphSlot) GraphSlots;- In
Type.h:92:
} GenericGraphSlot;
typedef Vec(GenericGraphSlot) GraphSlots;
typedef Vec(u32) GraphFreeIndices;
Last updated on