diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-21 12:18:01 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-11-21 12:18:01 -0200 |
commit | b48c6e768035a44ced1af0affa4b8c0970f1bdfd (patch) | |
tree | 30f837065ae8df785f0025ee3e8ab424366db21f | |
parent | aff97fffc4a63cd25af313b4790409477c13d68a (diff) | |
download | lua-b48c6e768035a44ced1af0affa4b8c0970f1bdfd.tar.gz lua-b48c6e768035a44ced1af0affa4b8c0970f1bdfd.tar.bz2 lua-b48c6e768035a44ced1af0affa4b8c0970f1bdfd.zip |
no problem keeping some dead meat while doing collection
-rw-r--r-- | lvm.c | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 1.263 2002/11/18 15:24:11 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.264 2002/11/19 08:50:56 roberto Exp roberto $ |
3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -36,15 +36,6 @@ | |||
36 | #define MAXTAGLOOP 100 | 36 | #define MAXTAGLOOP 100 |
37 | 37 | ||
38 | 38 | ||
39 | static void luaV_checkGC (lua_State *L, StkId top) { | ||
40 | if (G(L)->nblocks >= G(L)->GCthreshold) { | ||
41 | L->top = top; /* limit for active registers */ | ||
42 | luaC_collectgarbage(L); | ||
43 | L->top = L->ci->top; /* restore old top position */ | ||
44 | } | ||
45 | } | ||
46 | |||
47 | |||
48 | const TObject *luaV_tonumber (const TObject *obj, TObject *n) { | 39 | const TObject *luaV_tonumber (const TObject *obj, TObject *n) { |
49 | lua_Number num; | 40 | lua_Number num; |
50 | if (ttisnumber(obj)) return obj; | 41 | if (ttisnumber(obj)) return obj; |
@@ -476,7 +467,7 @@ StkId luaV_execute (lua_State *L) { | |||
476 | int b = GETARG_B(i); | 467 | int b = GETARG_B(i); |
477 | if (b > 0) b = twoto(b-1); | 468 | if (b > 0) b = twoto(b-1); |
478 | sethvalue(ra, luaH_new(L, b, GETARG_C(i))); | 469 | sethvalue(ra, luaH_new(L, b, GETARG_C(i))); |
479 | luaV_checkGC(L, ra+1); | 470 | luaC_checkGC(L); |
480 | break; | 471 | break; |
481 | } | 472 | } |
482 | case OP_SELF: { | 473 | case OP_SELF: { |
@@ -561,7 +552,7 @@ StkId luaV_execute (lua_State *L) { | |||
561 | int c = GETARG_C(i); | 552 | int c = GETARG_C(i); |
562 | luaV_concat(L, c-b+1, c); /* may change `base' (and `ra') */ | 553 | luaV_concat(L, c-b+1, c); /* may change `base' (and `ra') */ |
563 | setobjs2s(RA(i), base+b); | 554 | setobjs2s(RA(i), base+b); |
564 | luaV_checkGC(L, base+c+1); | 555 | luaC_checkGC(L); |
565 | break; | 556 | break; |
566 | } | 557 | } |
567 | case OP_JMP: { | 558 | case OP_JMP: { |
@@ -732,7 +723,7 @@ StkId luaV_execute (lua_State *L) { | |||
732 | } | 723 | } |
733 | } | 724 | } |
734 | setclvalue(ra, ncl); | 725 | setclvalue(ra, ncl); |
735 | luaV_checkGC(L, L->top); | 726 | luaC_checkGC(L); |
736 | break; | 727 | break; |
737 | } | 728 | } |
738 | } | 729 | } |