New implementation for constants

VLOCAL expressions keep a reference to their corresponding 'Vardesc',
and 'Upvaldesc' (for upvalues) has a field 'ro' (read-only). So, it is
easier to check whether a variable is read-only. The decoupling in
VLOCAL between 'vidx' ('Vardesc' index) and 'sidx' (stack index)
should also help the forthcoming implementation of compile-time
constant propagation.
This commit is contained in:
Roberto Ierusalimschy
2019-07-09 10:43:17 -03:00
parent e888976bc6
commit 54f7b46c1e
8 changed files with 125 additions and 131 deletions

View File

@@ -203,6 +203,7 @@ static void LoadUpvalues (LoadState *S, Proto *f) {
for (i = 0; i < n; i++) {
f->upvalues[i].instack = LoadByte(S);
f->upvalues[i].idx = LoadByte(S);
f->upvalues[i].ro = LoadByte(S);
}
}