bugfix: make proto shared

This commit is contained in:
Cloud Wu
2020-12-18 19:20:15 +08:00
parent 8022a53e50
commit 4d88f96ed6
3 changed files with 3 additions and 2 deletions

View File

@@ -301,7 +301,7 @@ const char *luaF_getlocalname (const Proto *f, int local_number, int pc) {
void luaF_shareproto (Proto *f) {
int i;
if (f == NULL)
if (f == NULL || isshared(f))
return;
makeshared(f);
luaS_share(f->source);

View File

@@ -57,7 +57,7 @@ int luaS_eqshrstr (TString *a, TString *b) {
}
void luaS_share (TString *ts) {
if (ts == NULL)
if (ts == NULL || isshared(ts))
return;
makeshared(ts);
ts->id = ATOM_DEC(&STRID);

View File

@@ -41,6 +41,7 @@ mark_shared(lua_State *L) {
} else if (!lua_iscfunction(L, idx)) {
LClosure *f = (LClosure *)lua_topointer(L, idx);
makeshared(f);
lua_sharefunction(L, idx);
}
break;
case LUA_TSTRING: