aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-10-26 10:38:50 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-10-26 10:38:50 -0300
commit6e9b719694bffb8de711f182d405ec37d32ae0b1 (patch)
tree943fcd9aacd2f7845acfd955e1bb0a9607576fa4 /lopcodes.h
parent34840301b529686ce8168828b140a478a5d44b53 (diff)
downloadlua-6e9b719694bffb8de711f182d405ec37d32ae0b1.tar.gz
lua-6e9b719694bffb8de711f182d405ec37d32ae0b1.tar.bz2
lua-6e9b719694bffb8de711f182d405ec37d32ae0b1.zip
More uniformity in code generation for 'for' loops
Added new instruction 'OP_TFORPREP' to prepare a generic for loop. Currently it is equivalent to a jump (but with a format 'iABx', similar to other for-loop preparing instructions), but soon it will be the place to create upvalues for closing loop states.
Diffstat (limited to 'lopcodes.h')
-rw-r--r--lopcodes.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lopcodes.h b/lopcodes.h
index 4d144000..4797d7c3 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -282,6 +282,7 @@ OP_FORLOOP,/* A Bx R(A)+=R(A+2);
282 if R(A) <?= R(A+1) then { pc-=Bx; R(A+3)=R(A) } */ 282 if R(A) <?= R(A+1) then { pc-=Bx; R(A+3)=R(A) } */
283OP_FORPREP,/* A Bx R(A)-=R(A+2); pc+=Bx */ 283OP_FORPREP,/* A Bx R(A)-=R(A+2); pc+=Bx */
284 284
285OP_TFORPREP,/* A Bx create upvalue A; pc+=Bx */
285OP_TFORCALL,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); */ 286OP_TFORCALL,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); */
286OP_TFORLOOP,/* A Bx if R(A+1) ~= nil then { R(A)=R(A+1); pc -= Bx } */ 287OP_TFORLOOP,/* A Bx if R(A+1) ~= nil then { R(A)=R(A+1); pc -= Bx } */
287 288