** set GCdebt to a new value keeping the value (totalbytes + GCdebt) ** invariant (and avoiding underflows in 'totalbytes') */
| 96 | ** invariant (and avoiding underflows in 'totalbytes') |
| 97 | */ |
| 98 | void luaE_setdebt (global_State *g, l_mem debt) { |
| 99 | l_mem tb = gettotalbytes(g); |
| 100 | lua_assert(tb > 0); |
| 101 | if (debt < tb - MAX_LMEM) |
| 102 | debt = tb - MAX_LMEM; /* will make 'totalbytes == MAX_LMEM' */ |
| 103 | g->totalbytes = tb - debt; |
| 104 | g->GCdebt = debt; |
| 105 | } |
| 106 | |
| 107 | |
| 108 | CallInfo *luaE_extendCI (lua_State *L) { |