fix m_nsDesc failing to allocate leaving body->nsDesc uninitialized

This commit is contained in:
dzaima 2022-06-03 19:50:26 +03:00
parent 6aada8338e
commit 2dbbb3415e
2 changed files with 3 additions and 3 deletions

View File

@ -108,7 +108,7 @@ B listVars(Scope* sc) {
}
Body* m_body(i32 vam, i32 pos, u32 maxStack, u16 maxPSC) { // leaves varIDs and nsDesc uninitialized
Body* m_body(i32 vam, i32 pos, u32 maxStack, u16 maxPSC) {
Body* body = mm_alloc(fsizeof(Body, varData, i32, vam*2), t_body);
#if JIT_START != -1
@ -124,6 +124,7 @@ Body* m_body(i32 vam, i32 pos, u32 maxStack, u16 maxPSC) { // leaves varIDs and
body->maxPSC = maxPSC;
body->bl = NULL;
body->varAm = (u16)vam;
body->nsDesc = NULL;
return body;
}
@ -363,7 +364,6 @@ Block* compileBlock(B block, Comp* comp, bool* bDone, u32* bc, usz bcIA, B allBl
if (boIA>2) {
m_nsDesc(body, imm, ty, finalVam, nameList, GetU(bodyRepr,2), GetU(bodyRepr,3));
} else {
body->nsDesc = NULL;
for (u64 i = 0; i < vam*2; i++) body->varData[i] = -1;
}

View File

@ -150,7 +150,7 @@ Block* bqn_comp(B str, B path, B args); // consumes all
Block* bqn_compSc(B str, B path, B args, Scope* sc, bool repl); // consumes str,path,args
Block* compile(B bcq, B objs, B blocks, B bodies, B indices, B tokenInfo, B src, B path, Scope* sc);
Scope* m_scope(Body* body, Scope* psc, u16 varAm, i32 initVarAm, B* initVars);
Body* m_body(i32 vam, i32 pos, u32 maxStack, u16 maxPSC); // leaves varIDs and nsDesc uninitialized
Body* m_body(i32 vam, i32 pos, u32 maxStack, u16 maxPSC); // leaves varData uninitialized
void init_comp(B* set, B prim); // doesn't consume; writes into first 3 elements of set
B rebqn_exec(B str, B path, B args, B o); // consumes str,path,args
B listVars(Scope* sc); // doesn't consume; returns bi_N if not accessable