diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-03-10 10:27:19 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-03-10 10:27:19 -0300 |
| commit | 81c6021fb40a254d9a586b0cb53453bba8973d80 (patch) | |
| tree | 3abc818902b69ddbb89eaef0a3e52b0f218ceb6c /lobject.h | |
| parent | a7b8b27dd39f45b9464ffc4226b0616c3ffe5ad7 (diff) | |
| download | lua-81c6021fb40a254d9a586b0cb53453bba8973d80.tar.gz lua-81c6021fb40a254d9a586b0cb53453bba8973d80.tar.bz2 lua-81c6021fb40a254d9a586b0cb53453bba8973d80.zip | |
New implementation for 'tbclist'
- Fixes a bug, by removing dummy nodes together with the node
itself. (The previous implementation could leave dummy nodes in frames
which otherwise had no tbc variables, and therefore would not close
variables; that could leave 'tbclist' pointing higher than 'top', which
could dangle if the stack shrank.)
- Computes MAXDELTA based on the type of delta, to ease changing its
type if needed.
- Instead of 'isdummy', uses 'delta==0' to signal dummy nodes. (Dummy
nodes always have MAXDELTA for their real delta.)
Diffstat (limited to 'lobject.h')
| -rw-r--r-- | lobject.h | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -139,13 +139,14 @@ typedef struct TValue { | |||
| 139 | ** Entries in a Lua stack. Field 'tbclist' forms a list of all | 139 | ** Entries in a Lua stack. Field 'tbclist' forms a list of all |
| 140 | ** to-be-closed variables active in this stack. Dummy entries are | 140 | ** to-be-closed variables active in this stack. Dummy entries are |
| 141 | ** used when the distance between two tbc variables does not fit | 141 | ** used when the distance between two tbc variables does not fit |
| 142 | ** in an unsigned short. | 142 | ** in an unsigned short. They are represented by delta==0, and |
| 143 | ** their real delta is always the maximum value that fits in | ||
| 144 | ** that field. | ||
| 143 | */ | 145 | */ |
| 144 | typedef union StackValue { | 146 | typedef union StackValue { |
| 145 | TValue val; | 147 | TValue val; |
| 146 | struct { | 148 | struct { |
| 147 | TValuefields; | 149 | TValuefields; |
| 148 | lu_byte isdummy; | ||
| 149 | unsigned short delta; | 150 | unsigned short delta; |
| 150 | } tbclist; | 151 | } tbclist; |
| 151 | } StackValue; | 152 | } StackValue; |
