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-d36a31e6739bcd39c84f637344227af87cfd0ee5.tar.gz lua-d36a31e6739bcd39c84f637344227af87cfd0ee5.tar.bz2 lua-d36a31e6739bcd39c84f637344227af87cfd0ee5.zip | |
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) { | |||
| 1038 | ** errors. (That is, it will not return to the interpreter main loop | 1038 | ** errors. (That is, it will not return to the interpreter main loop |
| 1039 | ** after changing the stack or hooks.) | 1039 | ** after changing the stack or hooks.) |
| 1040 | */ | 1040 | */ |
| 1041 | #define halfProtect(exp) (savepc(L), (exp)) | 1041 | #define halfProtect(exp) (savestate(L,ci), (exp)) |
| 1042 | |||
| 1043 | /* idem, but without changing the stack */ | ||
| 1044 | #define halfProtectNT(exp) (savepc(L), (exp)) | ||
| 1042 | 1045 | ||
| 1043 | 1046 | ||
| 1044 | #define checkGC(L,c) \ | 1047 | #define checkGC(L,c) \ |
| @@ -1620,7 +1623,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1620 | vmcase(OP_RETURN0) { | 1623 | vmcase(OP_RETURN0) { |
| 1621 | if (L->hookmask) { | 1624 | if (L->hookmask) { |
| 1622 | L->top = ra; | 1625 | L->top = ra; |
| 1623 | halfProtect(luaD_poscall(L, ci, 0)); /* no hurry... */ | 1626 | halfProtectNT(luaD_poscall(L, ci, 0)); /* no hurry... */ |
| 1624 | } | 1627 | } |
| 1625 | else { /* do the 'poscall' here */ | 1628 | else { /* do the 'poscall' here */ |
| 1626 | int nres = ci->nresults; | 1629 | int nres = ci->nresults; |
| @@ -1634,7 +1637,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1634 | vmcase(OP_RETURN1) { | 1637 | vmcase(OP_RETURN1) { |
| 1635 | if (L->hookmask) { | 1638 | if (L->hookmask) { |
| 1636 | L->top = ra + 1; | 1639 | L->top = ra + 1; |
| 1637 | halfProtect(luaD_poscall(L, ci, 1)); /* no hurry... */ | 1640 | halfProtectNT(luaD_poscall(L, ci, 1)); /* no hurry... */ |
| 1638 | } | 1641 | } |
| 1639 | else { /* do the 'poscall' here */ | 1642 | else { /* do the 'poscall' here */ |
| 1640 | int nres = ci->nresults; | 1643 | int nres = ci->nresults; |
