summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-06-11 03:06:32 +0200
committerMitya Selivanov <automainint@guattari.tech>2024-06-11 03:06:32 +0200
commitcb331e69ae60c61d35dd595c71408bc7fb73cca6 (patch)
tree44e78232b5eddb7ba915527a781f50e234eedd01
parent5c27be976a5d2fafc104060a16b21a80aff642b1 (diff)
downloadbxgen-cb331e69ae60c61d35dd595c71408bc7fb73cca6.zip
Add asserts
-rwxr-xr-xbxgen.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/bxgen.c b/bxgen.c
index 00bfb88..6c9acf0 100755
--- a/bxgen.c
+++ b/bxgen.c
@@ -401,16 +401,17 @@ void proc_node_remove(pool_t *pool, i64 proc, i64 node) {
proc_t *p = &pool->entities[proc].proc;
node_t *n = &pool->entities[node].node;
+ // TODO
+ // Implement large entities.
+
assert(n->index_in_proc != UNDEFINED);
+ assert(p->nodes[n->index_in_proc] == node);
if (n->op == CTRL_RET) {
assert(p->ret_index != UNDEFINED);
p->ret_index = UNDEFINED;
}
- // TODO
- // Implement large entities.
-
p->nodes[n->index_in_proc] = UNDEFINED;
n->index_in_proc = UNDEFINED;
}
@@ -462,11 +463,12 @@ void unit_proc_remove(pool_t *pool, i64 unit, i64 proc) {
unit_t *u = &pool->entities[unit].unit;
proc_t *p = &pool->entities[proc].proc;
- assert(p->index_in_unit != UNDEFINED);
-
// TODO
// Implement large entities.
+ assert(p->index_in_unit != UNDEFINED);
+ assert(u->procs[p->index_in_unit] == proc);
+
u->procs[p->index_in_unit] = UNDEFINED;
p->index_in_unit = UNDEFINED;
}