diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-10-29 12:06:37 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-10-29 12:06:37 -0300 |
| commit | 413a393e6222482f46599e138bebac162610a572 (patch) | |
| tree | 181517f8ec8d56f9101de33f4891729044f244de /lapi.h | |
| parent | ba089bcb08a0efc6c26fb5c1e3c9d61c00cc012c (diff) | |
| download | lua-413a393e6222482f46599e138bebac162610a572.tar.gz lua-413a393e6222482f46599e138bebac162610a572.tar.bz2 lua-413a393e6222482f46599e138bebac162610a572.zip | |
Stack indices changed to union's
That will allow to change pointers to offsets while reallocating
the stack.
Diffstat (limited to 'lapi.h')
| -rw-r--r-- | lapi.h | 17 |
1 files changed, 10 insertions, 7 deletions
| @@ -12,23 +12,26 @@ | |||
| 12 | #include "lstate.h" | 12 | #include "lstate.h" |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | /* Increments 'L->top', checking for stack overflows */ | 15 | /* Increments 'L->top.p', checking for stack overflows */ |
| 16 | #define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ | 16 | #define api_incr_top(L) {L->top.p++; \ |
| 17 | "stack overflow");} | 17 | api_check(L, L->top.p <= L->ci->top.p, \ |
| 18 | "stack overflow");} | ||
| 18 | 19 | ||
| 19 | 20 | ||
| 20 | /* | 21 | /* |
| 21 | ** If a call returns too many multiple returns, the callee may not have | 22 | ** If a call returns too many multiple returns, the callee may not have |
| 22 | ** stack space to accommodate all results. In this case, this macro | 23 | ** stack space to accommodate all results. In this case, this macro |
| 23 | ** increases its stack space ('L->ci->top'). | 24 | ** increases its stack space ('L->ci->top.p'). |
| 24 | */ | 25 | */ |
| 25 | #define adjustresults(L,nres) \ | 26 | #define adjustresults(L,nres) \ |
| 26 | { if ((nres) <= LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } | 27 | { if ((nres) <= LUA_MULTRET && L->ci->top.p < L->top.p) \ |
| 28 | L->ci->top.p = L->top.p; } | ||
| 27 | 29 | ||
| 28 | 30 | ||
| 29 | /* Ensure the stack has at least 'n' elements */ | 31 | /* Ensure the stack has at least 'n' elements */ |
| 30 | #define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ | 32 | #define api_checknelems(L,n) \ |
| 31 | "not enough elements in the stack") | 33 | api_check(L, (n) < (L->top.p - L->ci->func.p), \ |
| 34 | "not enough elements in the stack") | ||
| 32 | 35 | ||
| 33 | 36 | ||
| 34 | /* | 37 | /* |
