eris: Fix a bug in eris GC handling
This commit is contained in:
@@ -1269,13 +1269,15 @@ u_proto(Info *info) { /* ... proto */
|
||||
p->maxstacksize = READ_VALUE(uint8_t);
|
||||
|
||||
/* Read byte code. */
|
||||
p->sizecode = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->code, 0, p->sizecode, Instruction);
|
||||
int sizecode = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->code, 0, sizecode, Instruction);
|
||||
p->sizecode = sizecode;
|
||||
READ(p->code, p->sizecode, Instruction);
|
||||
|
||||
/* Read constants. */
|
||||
p->sizek = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->k, 0, p->sizek, TValue);
|
||||
int sizek = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->k, 0, sizek, TValue);
|
||||
p->sizek = sizek;
|
||||
/* Set all values to nil to avoid confusing the GC. */
|
||||
for (i = 0, n = p->sizek; i < n; ++i) {
|
||||
eris_setnilvalue(&p->k[i]);
|
||||
@@ -1291,8 +1293,9 @@ u_proto(Info *info) { /* ... proto */
|
||||
poppath(info);
|
||||
|
||||
/* Read child protos. */
|
||||
p->sizep = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->p, 0, p->sizep, Proto*);
|
||||
int sizep = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->p, 0, sizep, Proto*);
|
||||
p->sizep = sizep;
|
||||
/* Null all entries to avoid confusing the GC. */
|
||||
memset(p->p, 0, p->sizep * sizeof(Proto*));
|
||||
pushpath(info, ".protos");
|
||||
@@ -1313,8 +1316,9 @@ u_proto(Info *info) { /* ... proto */
|
||||
poppath(info);
|
||||
|
||||
/* Read upvalues. */
|
||||
p->sizeupvalues = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->upvalues, 0, p->sizeupvalues, Upvaldesc);
|
||||
int sizeupvalues = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->upvalues, 0, sizeupvalues, Upvaldesc);
|
||||
p->sizeupvalues = sizeupvalues;
|
||||
for (i = 0, n = p->sizeupvalues; i < n; ++i) {
|
||||
p->upvalues[i].name = NULL;
|
||||
p->upvalues[i].instack = READ_VALUE(uint8_t);
|
||||
@@ -1334,13 +1338,16 @@ u_proto(Info *info) { /* ... proto */
|
||||
lua_pop(info->L, 1); /* ... proto */
|
||||
|
||||
/* Read line information. */
|
||||
p->sizelineinfo = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->lineinfo, 0, p->sizelineinfo, int);
|
||||
int sizelineinfo = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->lineinfo, 0, sizelineinfo, int);
|
||||
p->sizelineinfo = sizelineinfo;
|
||||
|
||||
READ(p->lineinfo, p->sizelineinfo, int);
|
||||
|
||||
/* Read locals info. */
|
||||
p->sizelocvars = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->locvars, 0, p->sizelocvars, LocVar);
|
||||
int sizelocvars = READ_VALUE(int);
|
||||
eris_reallocvector(info->L, p->locvars, 0, sizelocvars, LocVar);
|
||||
p->sizelocvars = sizelocvars;
|
||||
/* Null the variable names to avoid confusing the GC. */
|
||||
for (i = 0, n = p->sizelocvars; i < n; ++i) {
|
||||
p->locvars[i].varname = NULL;
|
||||
|
||||
Reference in New Issue
Block a user