diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-18 14:58:15 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-18 14:58:15 -0300 |
| commit | d36a31e6739bcd39c84f637344227af87cfd0ee5 (patch) | |
| tree | 68b0049215b0b6cf2a8109e24cb154175bf02c4d /lvm.c | |
| parent | 024a6071cac749504e0b26a915bda4f52c41a892 (diff) | |
| download | lua-github-d36a31e6739bcd39c84f637344227af87cfd0ee5.tar.gz | |
Reviving HARDMEMTESTS
This commit brings a new implementation for HARDMEMTESTS, which forces
an emergency GC whenever possible. It also fixes some issues detected
with this option:
- A small bug in lvm.c: a closure could be collected by an emergency
GC while being initialized.
- Some tests: a memory address can be immediatly reused after a GC;
for instance, two consecutive '{}' expressions can return exactly the
same address, if the first one is not anchored.
Diffstat (limited to 'lvm.c')
| -rw-r--r-- | lvm.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1038,7 +1038,10 @@ void luaV_finishOp (lua_State *L) { ** errors. (That is, it will not return to the interpreter main loop ** after changing the stack or hooks.) */ -#define halfProtect(exp) (savepc(L), (exp)) +#define halfProtect(exp) (savestate(L,ci), (exp)) + +/* idem, but without changing the stack */ +#define halfProtectNT(exp) (savepc(L), (exp)) #define checkGC(L,c) \ @@ -1620,7 +1623,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { vmcase(OP_RETURN0) { if (L->hookmask) { L->top = ra; - halfProtect(luaD_poscall(L, ci, 0)); /* no hurry... */ + halfProtectNT(luaD_poscall(L, ci, 0)); /* no hurry... */ } else { /* do the 'poscall' here */ int nres = ci->nresults; @@ -1634,7 +1637,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { vmcase(OP_RETURN1) { if (L->hookmask) { L->top = ra + 1; - halfProtect(luaD_poscall(L, ci, 1)); /* no hurry... */ + halfProtectNT(luaD_poscall(L, ci, 1)); /* no hurry... */ } else { /* do the 'poscall' here */ int nres = ci->nresults; |
