aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-07-18 10:36:14 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-07-18 10:36:14 -0300
commitca41b43f53562e64abe433d6346d174c92548603 (patch)
tree03f7a99f76359fc1e0bbc45fc13e579ff2aafabb /lgc.c
parent3511e186cde4b78f268d17199d0f46fb3eaa9638 (diff)
downloadlua-ca41b43f53562e64abe433d6346d174c92548603.tar.gz
lua-ca41b43f53562e64abe433d6346d174c92548603.tar.bz2
lua-ca41b43f53562e64abe433d6346d174c92548603.zip
type 'TString' refers directly to the structure inside the union
(union used only for size purposes)
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lgc.c b/lgc.c
index ac1c6a46..87d6ca6c 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.c,v 2.185 2014/07/17 17:27:49 roberto Exp roberto $ 2** $Id: lgc.c,v 2.186 2014/07/18 12:17:54 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*/
@@ -83,9 +83,6 @@
83#define markobject(g,t) \ 83#define markobject(g,t) \
84 { if ((t) && iswhite(obj2gco(t))) reallymarkobject(g, obj2gco(t)); } 84 { if ((t) && iswhite(obj2gco(t))) reallymarkobject(g, obj2gco(t)); }
85 85
86#define markstring(g,t) \
87 { if ((t) && iswhite(ts2gco(t))) reallymarkobject(g, ts2gco(t)); }
88
89static void reallymarkobject (global_State *g, GCObject *o); 86static void reallymarkobject (global_State *g, GCObject *o);
90 87
91 88
@@ -451,15 +448,15 @@ static int traverseproto (global_State *g, Proto *f) {
451 int i; 448 int i;
452 if (f->cache && iswhite(obj2gco(f->cache))) 449 if (f->cache && iswhite(obj2gco(f->cache)))
453 f->cache = NULL; /* allow cache to be collected */ 450 f->cache = NULL; /* allow cache to be collected */
454 markstring(g, f->source); 451 markobject(g, f->source);
455 for (i = 0; i < f->sizek; i++) /* mark literals */ 452 for (i = 0; i < f->sizek; i++) /* mark literals */
456 markvalue(g, &f->k[i]); 453 markvalue(g, &f->k[i]);
457 for (i = 0; i < f->sizeupvalues; i++) /* mark upvalue names */ 454 for (i = 0; i < f->sizeupvalues; i++) /* mark upvalue names */
458 markstring(g, f->upvalues[i].name); 455 markobject(g, f->upvalues[i].name);
459 for (i = 0; i < f->sizep; i++) /* mark nested protos */ 456 for (i = 0; i < f->sizep; i++) /* mark nested protos */
460 markobject(g, f->p[i]); 457 markobject(g, f->p[i]);
461 for (i = 0; i < f->sizelocvars; i++) /* mark local-variable names */ 458 for (i = 0; i < f->sizelocvars; i++) /* mark local-variable names */
462 markstring(g, f->locvars[i].varname); 459 markobject(g, f->locvars[i].varname);
463 return sizeof(Proto) + sizeof(Instruction) * f->sizecode + 460 return sizeof(Proto) + sizeof(Instruction) * f->sizecode +
464 sizeof(Proto *) * f->sizep + 461 sizeof(Proto *) * f->sizep +
465 sizeof(TValue) * f->sizek + 462 sizeof(TValue) * f->sizek +
@@ -702,7 +699,7 @@ static void freeobj (lua_State *L, GCObject *o) {
702 case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break; 699 case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break;
703 case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break; 700 case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break;
704 case LUA_TSHRSTR: 701 case LUA_TSHRSTR:
705 luaS_remove(L, rawgco2ts(o)); /* remove it from hash table */ 702 luaS_remove(L, gco2ts(o)); /* remove it from hash table */
706 /* go through */ 703 /* go through */
707 case LUA_TLNGSTR: { 704 case LUA_TLNGSTR: {
708 luaM_freemem(L, o, sizestring(gco2ts(o))); 705 luaM_freemem(L, o, sizestring(gco2ts(o)));