mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
expand SSM during loadfile
This commit is contained in:
@@ -1175,6 +1175,7 @@ LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,
|
|||||||
}
|
}
|
||||||
luaS_expandshr(4096);
|
luaS_expandshr(4096);
|
||||||
int err = luaL_loadfilex_(eL, filename, mode);
|
int err = luaL_loadfilex_(eL, filename, mode);
|
||||||
|
luaS_expandshr(-4096);
|
||||||
if (err != LUA_OK) {
|
if (err != LUA_OK) {
|
||||||
size_t sz = 0;
|
size_t sz = 0;
|
||||||
const char * msg = lua_tolstring(eL, -1, &sz);
|
const char * msg = lua_tolstring(eL, -1, &sz);
|
||||||
|
|||||||
@@ -544,8 +544,13 @@ internshrstr (lua_State *L, const char *str, size_t l) {
|
|||||||
LUA_API void
|
LUA_API void
|
||||||
luaS_expandshr(int n) {
|
luaS_expandshr(int n) {
|
||||||
struct shrmap * s = &SSM;
|
struct shrmap * s = &SSM;
|
||||||
if (s->n < n) {
|
if (n < 0) {
|
||||||
ATOM_ADD(&s->n, n);
|
if (-n > s->n) {
|
||||||
|
n = -s->n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ATOM_ADD(&s->n, n);
|
||||||
|
if (n > 0) {
|
||||||
int t = (s->total + s->n) * 5 / 4;
|
int t = (s->total + s->n) * 5 / 4;
|
||||||
if (t > s->mask) {
|
if (t > s->mask) {
|
||||||
shrstr_expandpage(t);
|
shrstr_expandpage(t);
|
||||||
|
|||||||
Reference in New Issue
Block a user