aboutsummaryrefslogtreecommitdiff
path: root/lparser.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-10 13:54:51 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-10 13:54:51 -0300
commit7ca3c40b50b385ead6b8bc4c54de97b61d11a12a (patch)
tree5c5998f39760b07e05135df56b8a828f2fb685c1 /lparser.h
parent8a3a49250ce4a7e46ec9e90810a61d9f97aece3d (diff)
downloadlua-7ca3c40b50b385ead6b8bc4c54de97b61d11a12a.tar.gz
lua-7ca3c40b50b385ead6b8bc4c54de97b61d11a12a.tar.bz2
lua-7ca3c40b50b385ead6b8bc4c54de97b61d11a12a.zip
Another way to compile goto's
The compilation of a goto or a label just create an entry and generate boilerplate code for the gotos. As we don't know yet whether it needs a CLOSE, we code a jump followed by a CLOSE, which is then dead code. When a block ends (and then we know for sure whether there are variables that need to be closed), we check the goto's against the labels of that block. When closing a goto against a label, if it needs a CLOSE, the compiler swaps the order of the jump and the CLOSE, making the CLOSE active.
Diffstat (limited to 'lparser.h')
-rw-r--r--lparser.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lparser.h b/lparser.h
index 589befdb..a8004fa0 100644
--- a/lparser.h
+++ b/lparser.h
@@ -112,7 +112,7 @@ typedef struct Labeldesc {
112 int pc; /* position in code */ 112 int pc; /* position in code */
113 int line; /* line where it appeared */ 113 int line; /* line where it appeared */
114 lu_byte nactvar; /* number of active variables in that position */ 114 lu_byte nactvar; /* number of active variables in that position */
115 lu_byte close; /* goto that escapes upvalues */ 115 lu_byte close; /* true for goto that escapes upvalues */
116} Labeldesc; 116} Labeldesc;
117 117
118 118