rewrite SSM and clonefunction

This commit is contained in:
Cloud Wu
2019-04-16 21:16:13 +08:00
committed by 云风
parent 2d6d2c75a4
commit 2ceb642b5d
32 changed files with 934 additions and 645 deletions

View File

@@ -36,10 +36,8 @@
LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed);
LUAI_FUNC unsigned int luaS_hashlongstr (TString *ts);
LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b);
LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
LUAI_FUNC void luaS_clearcache (global_State *g);
LUAI_FUNC void luaS_init (lua_State *L);
LUAI_FUNC void luaS_remove (lua_State *L, TString *ts);
LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s);
LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l);
LUAI_FUNC TString *luaS_new (lua_State *L, const char *str);
@@ -47,10 +45,26 @@ LUAI_FUNC TString *luaS_createlngstrobj (lua_State *L, size_t l);
#define ENABLE_SHORT_STRING_TABLE
LUA_API void luaS_initshr();
LUA_API void luaS_exitshr();
LUA_API void luaS_expandshr(int n);
LUAI_FUNC TString *luaS_clonestring(lua_State *L, TString *);
LUA_API int luaS_shrinfo(lua_State *L);
struct ssm_info {
int total;
int longest;
int slots;
size_t size;
double variance;
};
struct ssm_collect {
void *key;
int n;
};
LUA_API void luaS_initssm();
LUA_API void luaS_exitssm();
LUA_API void luaS_infossm(struct ssm_info *info);
LUA_API int luaS_collectssm(struct ssm_collect *info);
LUAI_FUNC void luaS_mark(global_State *g, TString *s);
LUAI_FUNC void luaS_fix(global_State *g, TString *s);
LUAI_FUNC void luaS_collect(global_State *g, int closed);
#endif