aboutsummaryrefslogtreecommitdiff
path: root/src/lj_tab.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_tab.c')
-rw-r--r--src/lj_tab.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lj_tab.c b/src/lj_tab.c
index fc7d0f1c..ef19ba97 100644
--- a/src/lj_tab.c
+++ b/src/lj_tab.c
@@ -149,6 +149,12 @@ GCtab *lj_tab_new(lua_State *L, uint32_t asize, uint32_t hbits)
149 return t; 149 return t;
150} 150}
151 151
152/* The API of this function conforms to lua_createtable(). */
153GCtab *lj_tab_new_ah(lua_State *L, int32_t a, int32_t h)
154{
155 return lj_tab_new(L, (uint32_t)(a > 0 ? a+1 : 0), hsize2hbits(h));
156}
157
152#if LJ_HASJIT 158#if LJ_HASJIT
153GCtab * LJ_FASTCALL lj_tab_new1(lua_State *L, uint32_t ahsize) 159GCtab * LJ_FASTCALL lj_tab_new1(lua_State *L, uint32_t ahsize)
154{ 160{
@@ -198,6 +204,17 @@ GCtab * LJ_FASTCALL lj_tab_dup(lua_State *L, const GCtab *kt)
198 return t; 204 return t;
199} 205}
200 206
207/* Clear a table. */
208void LJ_FASTCALL lj_tab_clear(GCtab *t)
209{
210 clearapart(t);
211 if (t->hmask > 0) {
212 Node *node = noderef(t->node);
213 setmref(node->freetop, &node[t->hmask+1]);
214 clearhpart(t);
215 }
216}
217
201/* Free a table. */ 218/* Free a table. */
202void LJ_FASTCALL lj_tab_free(global_State *g, GCtab *t) 219void LJ_FASTCALL lj_tab_free(global_State *g, GCtab *t)
203{ 220{