make body->bl an owned pointer

This commit is contained in:
dzaima 2022-01-11 00:32:58 +02:00
parent 3a510f99e5
commit 675a0e8045
2 changed files with 4 additions and 2 deletions

View File

@ -121,7 +121,7 @@ Body* m_nnsDescF(i32 n, char** names) {
Body* body = m_body(n, 0, 0, 0); Body* body = m_body(n, 0, 0, 0);
body->nsDesc = nd; body->nsDesc = nd;
body->bc = (u32*) emptyi32ptr; body->bc = (u32*) emptyi32ptr;
body->bl = bl; body->bl = ptr_inc(bl);
for (usz i = 0; i < n; i++) { for (usz i = 0; i < n; i++) {
body->varData[i] = nd->expGIDs[i]; body->varData[i] = nd->expGIDs[i];
body->varData[i+n] = i; body->varData[i+n] = i;

View File

@ -417,7 +417,7 @@ Block* compileBlock(B block, Comp* comp, bool* bDone, u32* bc, usz bcIA, B allBl
for (i32 i = 0; i < bodyCount; i++) { for (i32 i = 0; i < bodyCount; i++) {
bl->bodies[i] = bodies[i]; bl->bodies[i] = bodies[i];
bodies[i]->bc = (u32*)nbc + bodies[i]->bcTmp; bodies[i]->bc = (u32*)nbc + bodies[i]->bcTmp;
bodies[i]->bl = bl; bodies[i]->bl = ptr_inc(bl);
} }
TSFREE(bodies); TSFREE(bodies);
return bl; return bl;
@ -892,6 +892,7 @@ DEF_FREE(body) {
dec(c->nvmRefs); dec(c->nvmRefs);
#endif #endif
if(c->nsDesc) ptr_decR(c->nsDesc); if(c->nsDesc) ptr_decR(c->nsDesc);
if(c->bl) ptr_decR(c->bl);
} }
DEF_FREE(block) { DEF_FREE(block) {
Block* c = (Block*)x; Block* c = (Block*)x;
@ -924,6 +925,7 @@ void body_visit(Value* x) {
#if JIT_START != -1 #if JIT_START != -1
mm_visit(c->nvmRefs); mm_visit(c->nvmRefs);
#endif #endif
if(c->bl) mm_visitP(c->bl);
if(c->nsDesc) mm_visitP(c->nsDesc); if(c->nsDesc) mm_visitP(c->nsDesc);
} }
void block_visit(Value* x) { void block_visit(Value* x) {