** clear entries with unmarked values from all weaktables in list 'l' up ** to element 'f' */
| 806 | ** to element 'f' |
| 807 | */ |
| 808 | static void clearbyvalues (global_State *g, GCObject *l, GCObject *f) { |
| 809 | for (; l != f; l = gco2t(l)->gclist) { |
| 810 | Table *h = gco2t(l); |
| 811 | Node *n, *limit = gnodelast(h); |
| 812 | unsigned int i; |
| 813 | unsigned int asize = h->asize; |
| 814 | for (i = 0; i < asize; i++) { |
| 815 | GCObject *o = gcvalarr(h, i); |
| 816 | if (iscleared(g, o)) /* value was collected? */ |
| 817 | *getArrTag(h, i) = LUA_VEMPTY; /* remove entry */ |
| 818 | } |
| 819 | for (n = gnode(h, 0); n < limit; n++) { |
| 820 | if (iscleared(g, gcvalueN(gval(n)))) /* unmarked value? */ |
| 821 | setempty(gval(n)); /* remove entry */ |
| 822 | if (isempty(gval(n))) /* is entry empty? */ |
| 823 | clearkey(n); /* clear its key */ |
| 824 | } |
| 825 | } |
| 826 | } |
| 827 | |
| 828 | |
| 829 | static void freeupval (lua_State *L, UpVal *uv) { |