diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-09-08 12:41:05 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-09-08 12:41:05 -0300 |
commit | 41964648eea1427d53934b886abb68cc8457b019 (patch) | |
tree | b0388dfebe6614d5d49306193faf78f8b9e1a6a1 /lgc.c | |
parent | 502214f8a551cd01d94677f98a40aa51531ef71d (diff) | |
download | lua-41964648eea1427d53934b886abb68cc8457b019.tar.gz lua-41964648eea1427d53934b886abb68cc8457b019.tar.bz2 lua-41964648eea1427d53934b886abb68cc8457b019.zip |
long strings are created directly in final position when possible
(instead of using an auxiliar buffer to first create the string
and then allocate the final string and copy result there)
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lgc.c,v 2.205 2015/03/25 13:42:19 roberto Exp roberto $ | 2 | ** $Id: lgc.c,v 2.206 2015/07/13 13:30:03 roberto Exp roberto $ |
3 | ** Garbage Collector | 3 | ** Garbage Collector |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -769,12 +769,11 @@ static GCObject **sweeptolive (lua_State *L, GCObject **p, int *n) { | |||
769 | */ | 769 | */ |
770 | 770 | ||
771 | /* | 771 | /* |
772 | ** If possible, free concatenation buffer and shrink string table | 772 | ** If possible, shrink string table |
773 | */ | 773 | */ |
774 | static void checkSizes (lua_State *L, global_State *g) { | 774 | static void checkSizes (lua_State *L, global_State *g) { |
775 | if (g->gckind != KGC_EMERGENCY) { | 775 | if (g->gckind != KGC_EMERGENCY) { |
776 | l_mem olddebt = g->GCdebt; | 776 | l_mem olddebt = g->GCdebt; |
777 | luaZ_freebuffer(L, &g->buff); /* free concatenation buffer */ | ||
778 | if (g->strt.nuse < g->strt.size / 4) /* string table too big? */ | 777 | if (g->strt.nuse < g->strt.size / 4) /* string table too big? */ |
779 | luaS_resize(L, g->strt.size / 2); /* shrink it a little */ | 778 | luaS_resize(L, g->strt.size / 2); /* shrink it a little */ |
780 | g->GCestimate += g->GCdebt - olddebt; /* update estimate */ | 779 | g->GCestimate += g->GCdebt - olddebt; /* update estimate */ |