diff options
author | Mike Pall <mike> | 2015-05-19 01:59:29 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2015-05-19 01:59:29 +0200 |
commit | b82fc3ddc032dfc3da813cda9715d356975922e7 (patch) | |
tree | 21e5a68db18a8b3bc339c0e1b3a5c8825ab1e75a /src/lj_tab.c | |
parent | d8cfc370ef182ff3240ffd1e27e33d4594fde658 (diff) | |
download | luajit-b82fc3ddc032dfc3da813cda9715d356975922e7.tar.gz luajit-b82fc3ddc032dfc3da813cda9715d356975922e7.tar.bz2 luajit-b82fc3ddc032dfc3da813cda9715d356975922e7.zip |
Bump table allocations retroactively if they grow later on.
Diffstat (limited to 'src/lj_tab.c')
-rw-r--r-- | src/lj_tab.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lj_tab.c b/src/lj_tab.c index a9f43835..88bf1089 100644 --- a/src/lj_tab.c +++ b/src/lj_tab.c | |||
@@ -246,7 +246,7 @@ void LJ_FASTCALL lj_tab_free(global_State *g, GCtab *t) | |||
246 | /* -- Table resizing ------------------------------------------------------ */ | 246 | /* -- Table resizing ------------------------------------------------------ */ |
247 | 247 | ||
248 | /* Resize a table to fit the new array/hash part sizes. */ | 248 | /* Resize a table to fit the new array/hash part sizes. */ |
249 | static void resizetab(lua_State *L, GCtab *t, uint32_t asize, uint32_t hbits) | 249 | void lj_tab_resize(lua_State *L, GCtab *t, uint32_t asize, uint32_t hbits) |
250 | { | 250 | { |
251 | Node *oldnode = noderef(t->node); | 251 | Node *oldnode = noderef(t->node); |
252 | uint32_t oldasize = t->asize; | 252 | uint32_t oldasize = t->asize; |
@@ -383,7 +383,7 @@ static void rehashtab(lua_State *L, GCtab *t, cTValue *ek) | |||
383 | asize += countint(ek, bins); | 383 | asize += countint(ek, bins); |
384 | na = bestasize(bins, &asize); | 384 | na = bestasize(bins, &asize); |
385 | total -= na; | 385 | total -= na; |
386 | resizetab(L, t, asize, hsize2hbits(total)); | 386 | lj_tab_resize(L, t, asize, hsize2hbits(total)); |
387 | } | 387 | } |
388 | 388 | ||
389 | #if LJ_HASFFI | 389 | #if LJ_HASFFI |
@@ -395,7 +395,7 @@ void lj_tab_rehash(lua_State *L, GCtab *t) | |||
395 | 395 | ||
396 | void lj_tab_reasize(lua_State *L, GCtab *t, uint32_t nasize) | 396 | void lj_tab_reasize(lua_State *L, GCtab *t, uint32_t nasize) |
397 | { | 397 | { |
398 | resizetab(L, t, nasize+1, t->hmask > 0 ? lj_fls(t->hmask)+1 : 0); | 398 | lj_tab_resize(L, t, nasize+1, t->hmask > 0 ? lj_fls(t->hmask)+1 : 0); |
399 | } | 399 | } |
400 | 400 | ||
401 | /* -- Table getters ------------------------------------------------------- */ | 401 | /* -- Table getters ------------------------------------------------------- */ |