diff --git a/3rd/lua/README b/3rd/lua/README index a77dc6bf..efb71d70 100644 --- a/3rd/lua/README +++ b/3rd/lua/README @@ -1,5 +1,6 @@ This is a modify version of lua 5.3.1 (http://www.lua.org/ftp/lua-5.3.1.tar.gz) . -For detail : http://lua-users.org/lists/lua-l/2014-03/msg00489.html - - +For detail , + Shared Proto : http://lua-users.org/lists/lua-l/2014-03/msg00489.html + Shared short string table : http://blog.codingnow.com/2015/08/lua_vm_share_string.html + \ No newline at end of file diff --git a/3rd/lua/lstring.h b/3rd/lua/lstring.h index b3cfa1b7..a28ff0a0 100644 --- a/3rd/lua/lstring.h +++ b/3rd/lua/lstring.h @@ -43,6 +43,8 @@ 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); +#define ENABLE_SHORT_STRING_TABLE + LUA_API void luaS_initshr(); LUA_API void luaS_exitshr(); LUA_API void luaS_expandshr(int n); diff --git a/skynet-src/luashrtbl.h b/skynet-src/luashrtbl.h index 6f566038..824a0c85 100644 --- a/skynet-src/luashrtbl.h +++ b/skynet-src/luashrtbl.h @@ -1,11 +1,10 @@ #ifndef LUA_SHORT_STRING_TABLE_H #define LUA_SHORT_STRING_TABLE_H -#ifndef DISABLE_SHORT_STRING - #include "lstring.h" -#else +// If you use modified lua, this macro would be defined in lstring.h +#ifndef ENABLE_SHORT_STRING_TABLE static inline int luaS_shrinfo(lua_State *L) { return 0; } static inline void luaS_initshr() {}