Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 39 lines (36 sloc) 1.622 kb
fd6e1da @tj Added lua instructions
authored
1
2 # Lua VM instructions
3
4 __MOVE__ A B R(A) := R(B)
5 __LOADK__ A Bx R(A) := K(Bx)
6 __LOADBOOL__ A B C R(A) := (Bool)B; if (C) PC++
7 __LOADNIL__ A B R(A) := ... := R(B) := nil
8 __GETUPVAL__ A B R(A) := U[B]
9 __GETGLOBAL__ A Bx R(A) := G[K(Bx)]
10 __GETTABLE__ A B C R(A) := R(B)[RK(C)]
11 __SETGLOBAL__ A Bx G[K(Bx)] := R(A)
12 __SETUPVAL__ A B U[B] := R(A)
13 __SETTABLE__ A B C R(A)[RK(B)] := RK(C)
14 __NEWTABLE__ A B C R(A) := {} (size = B,C)
15 __SELF__ A B C R(A+1) := R(B); R(A) := R(B)[RK(C)]
16 __ADD__ A B C R(A) := RK(B) + RK(C)
17 __SUB__ A B C R(A) := RK(B) - RK(C)
18 __MUL__ A B C R(A) := RK(B) * RK(C)
19 __DIV__ A B C R(A) := RK(B) / RK(C)
20 __POW__ A B C R(A) := RK(B) ^ RK(C)
21 __UNM__ A B R(A) := -R(B)
22 __NOT__ A B R(A) := not R(B)
23 __CONCAT__ A B C R(A) := R(B) .. ... .. R(C)
24 __JMP__ sBx PC += sBx
25 __EQ__ A B C if ((RK(B) == RK(C)) ~= A) then PC++
26 __LT__ A B C if ((RK(B) < RK(C)) ~= A) then PC++
27 __LE__ A B C if ((RK(B) <= RK(C)) ~= A) then PC++
28 __TEST__ A B C if (R(B) <=> C) then R(A) := R(B) else PC++
29 __CALL__ A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1))
30 __TAILCALL__ A B C return R(A)(R(A+1), ... ,R(A+B-1))
31 __RETURN__ A B return R(A), ... ,R(A+B-2) (see note)
32 __FORLOOP__ A sBx R(A)+=R(A+2); if R(A) <?= R(A+1) then PC+= sBx
33 __TFORLOOP__ A C R(A+2), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
34 __TFORPREP__ A sBx if type(R(A)) == table then R(A+1):=R(A), R(A):=next;
35 __SETLIST__ A Bx R(A)[Bx-Bx%FPF+i] := R(A+i), 1 <= i <= Bx%FPF+1
36 __SETLISTO__ A Bx
37 __CLOSE__ A close stack variables up to R(A)
38 __CLOSURE__ A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n))
Something went wrong with that request. Please try again.