commit b2262ab68260d61dc1ee558531219e81273bd15f
parent 9ac75111be0b9fb9f158355e66589fb2c82d4fa5
Author: m21c <ho*******@gmail.com>
Date: Fri, 19 Jun 2026 16:37:30 +0200
worked on mem management: dataflow
Diffstat:
| M | compiler.c | | | 34 | +++++++++++++++++----------------- |
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/compiler.c b/compiler.c
@@ -5370,7 +5370,7 @@ For each section there will be a DF-Conduct associated with it.
static Block *
makeblock(BlockKind kind, Env *env)
{
- Block *block = myalloc(&arenas->block, Block);
+ Block *block = myalloc(&env->arenas->block, Block);
block->kind = kind;
block->env = env;
@@ -5379,9 +5379,9 @@ makeblock(BlockKind kind, Env *env)
}
static Conduct *
-makeconduct(ConductKind kind, Node *label)
+makeconduct(Env *env, ConductKind kind, Node *label)
{
- Conduct *conduct = myalloc(&arenas->conduct, Conduct);
+ Conduct *conduct = myalloc(&env->arenas->conduct, Conduct);
conduct->kind = kind;
conduct->label = label;
@@ -5390,12 +5390,12 @@ makeconduct(ConductKind kind, Node *label)
}
static void
-transfergists(Conduct *source, Conduct *dest);
+transfergists(Env *env, Conduct *source, Conduct *dest);
static void
appendconduct(Block *parent, ConductKind kind, Node *label)
{
- Conduct *conduct = makeconduct(kind, label);
+ Conduct *conduct = makeconduct(parent->env, kind, label);
if (!parent)
return;
@@ -5405,7 +5405,7 @@ appendconduct(Block *parent, ConductKind kind, Node *label)
listappend(parent, conduct);
if (conduct->prev)
- transfergists(conduct->prev, conduct);
+ transfergists(parent->env, conduct->prev, conduct);
}
static void
@@ -5422,13 +5422,13 @@ appendblock(Conduct *parent, BlockKind kind, Env *env)
listappend(parent, block);
- transfergists(parent, block->tail);
+ transfergists(env, parent, block->tail);
}
static Gist *
-makegist(Decl *decl, Node *where, bool init)
+makegist(Env *env, Decl *decl, Node *where, bool init)
{
- Gist *gist = myalloc(&arenas->gist, Gist);
+ Gist *gist = myalloc(&env->arenas->gist, Gist);
gist->decl = decl;
gist->where = where;
@@ -5446,12 +5446,12 @@ appendgist(Conduct *conduct, Gist *info)
}
static void
-transfergists(Conduct *source, Conduct *dest)
+transfergists(Env *env, Conduct *source, Conduct *dest)
{
Gist *info;
for (info = source->gists.head; info; info = info->next) {
- Gist *copy = makegist(NULL, NULL, false);
+ Gist *copy = makegist(env, NULL, NULL, false);
*copy = *info;
@@ -5513,7 +5513,7 @@ gistread(Conduct *conduct, Node *node)
}
static void
-gistwrite(Conduct *conduct, Node *node, bool init)
+gistwrite(Env *env, Conduct *conduct, Node *node, bool init)
{
Decl *decl;
Gist *info;
@@ -5525,7 +5525,7 @@ gistwrite(Conduct *conduct, Node *node, bool init)
info = getgist(conduct, decl);
if (!info) {
- info = makegist(decl, node, init);
+ info = makegist(env, decl, node, init);
appendgist(conduct, info);
return;
}
@@ -5581,7 +5581,7 @@ fetchblocks(Block *block, Node *expr)
case OSUFINC: case OSUFDEC:
fetchblocks(block, lhs);
gistread(block->tail, lhs);
- gistwrite(block->tail, lhs, true);
+ gistwrite(block->env, block->tail, lhs, true);
return;
/* binary read */
@@ -5607,7 +5607,7 @@ fetchblocks(Block *block, Node *expr)
gistread(block->tail, rhs);
fetchblocks(block, lhs);
- gistwrite(block->tail, lhs, true);
+ gistwrite(block->env, block->tail, lhs, true);
return;
/* binary read/write */
@@ -5621,7 +5621,7 @@ fetchblocks(Block *block, Node *expr)
fetchblocks(block, lhs);
gistread(block->tail, lhs);
- gistwrite(block->tail, lhs, true);
+ gistwrite(block->env, block->tail, lhs, true);
return;
case ASTMT:
@@ -5650,7 +5650,7 @@ fetchblocks(Block *block, Node *expr)
appendconduct(block, CSCOPE, NULL);
}
- gistwrite(block->tail, expr, !!lhs);
+ gistwrite(block->env, block->tail, expr, !!lhs);
return;
case ASCOPE: