eris: fix subtle GC-related bug in table sequence patch
This commit is contained in:
@@ -424,12 +424,6 @@ void luaH_resize (lua_State *L, Table *t, int nasize, int nhsize) {
|
|||||||
/* create new hash part with appropriate size */
|
/* create new hash part with appropriate size */
|
||||||
setnodevector(L, t, nhsize);
|
setnodevector(L, t, nhsize);
|
||||||
nhsize = truesizenode(t);
|
nhsize = truesizenode(t);
|
||||||
/* resize the sequence array */
|
|
||||||
int oldseqlen = oldasize + oldhsize;
|
|
||||||
int newseqlen = nasize + nhsize;
|
|
||||||
if (newseqlen < t->nnkeys)
|
|
||||||
luaG_runerror(L, "table sequence vector not large enough?");
|
|
||||||
luaM_reallocvector(L, t->sequence, oldseqlen, newseqlen, int);
|
|
||||||
/* possibly shrink the array part */
|
/* possibly shrink the array part */
|
||||||
if (nasize < oldasize) {
|
if (nasize < oldasize) {
|
||||||
t->sizearray = nasize;
|
t->sizearray = nasize;
|
||||||
@@ -453,6 +447,10 @@ void luaH_resize (lua_State *L, Table *t, int nasize, int nhsize) {
|
|||||||
/* delete the old node vector */
|
/* delete the old node vector */
|
||||||
if (!isdummy(nold))
|
if (!isdummy(nold))
|
||||||
luaM_freearray(L, nold, cast(size_t, oldhsize));
|
luaM_freearray(L, nold, cast(size_t, oldhsize));
|
||||||
|
/* resize the sequence array */
|
||||||
|
int oldseqlen = oldasize + oldhsize;
|
||||||
|
int newseqlen = nasize + nhsize;
|
||||||
|
luaM_reallocvector(L, t->sequence, oldseqlen, newseqlen, int);
|
||||||
/* recalculate the entire sequence vector */
|
/* recalculate the entire sequence vector */
|
||||||
int total = 0;
|
int total = 0;
|
||||||
for (i = nasize - 1; i >= 0; i--) {
|
for (i = nasize - 1; i >= 0; i--) {
|
||||||
@@ -699,6 +697,7 @@ void luaH_setnil(Table *t, ANode *anode) {
|
|||||||
** barrier and invalidate the TM cache.
|
** barrier and invalidate the TM cache.
|
||||||
*/
|
*/
|
||||||
void luaH_setupdate (lua_State *L, Table *t, const TValue *key, TValue *value, const TValue *getres) {
|
void luaH_setupdate (lua_State *L, Table *t, const TValue *key, TValue *value, const TValue *getres) {
|
||||||
|
checksequence(t);
|
||||||
if (!ttisnil(getres)) {
|
if (!ttisnil(getres)) {
|
||||||
if (ttisnil(value)) {
|
if (ttisnil(value)) {
|
||||||
/* replacing a non-nil value with nil */
|
/* replacing a non-nil value with nil */
|
||||||
|
|||||||
Reference in New Issue
Block a user