lua/lcode.h File Reference

#include "llex.h"
#include "lobject.h"
#include "lopcodes.h"
#include "lparser.h"

Go to the source code of this file.

Defines

#define NO_JUMP   (-1)
#define binopistest(op)   ((op) >= OPR_NE)
#define getcode(fs, e)   ((fs)->f->code[(e)->info])
#define luaK_codeAsBx(fs, o, A, sBx)   luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)

Enumerations

enum  BinOpr {
  OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV,
  OPR_POW, OPR_CONCAT, OPR_NE, OPR_EQ,
  OPR_LT, OPR_LE, OPR_GT, OPR_GE,
  OPR_AND, OPR_OR, OPR_NOBINOPR
}
enum  UnOpr { OPR_MINUS, OPR_NOT, OPR_NOUNOPR }

Functions

int luaK_code (FuncState *fs, Instruction i, int line)
int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx)
int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C)
void luaK_fixline (FuncState *fs, int line)
void luaK_nil (FuncState *fs, int from, int n)
void luaK_reserveregs (FuncState *fs, int n)
void luaK_checkstack (FuncState *fs, int n)
int luaK_stringK (FuncState *fs, TString *s)
int luaK_numberK (FuncState *fs, lua_Number r)
void luaK_dischargevars (FuncState *fs, expdesc *e)
int luaK_exp2anyreg (FuncState *fs, expdesc *e)
void luaK_exp2nextreg (FuncState *fs, expdesc *e)
void luaK_exp2val (FuncState *fs, expdesc *e)
int luaK_exp2RK (FuncState *fs, expdesc *e)
void luaK_self (FuncState *fs, expdesc *e, expdesc *key)
void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k)
void luaK_goiftrue (FuncState *fs, expdesc *e)
void luaK_goiffalse (FuncState *fs, expdesc *e)
void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e)
void luaK_setcallreturns (FuncState *fs, expdesc *var, int nresults)
int luaK_jump (FuncState *fs)
void luaK_patchlist (FuncState *fs, int list, int target)
void luaK_patchtohere (FuncState *fs, int list)
void luaK_concat (FuncState *fs, int *l1, int l2)
int luaK_getlabel (FuncState *fs)
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v)
void luaK_infix (FuncState *fs, BinOpr op, expdesc *v)
void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2)


Define Documentation

#define binopistest ( op   )     ((op) >= OPR_NE)

Definition at line 35 of file lcode.h.

#define getcode ( fs,
 )     ((fs)->f->code[(e)->info])

Definition at line 40 of file lcode.h.

Referenced by discharge2reg(), jumponcond(), luaK_posfix(), luaK_setcallreturns(), and retstat().

#define luaK_codeAsBx ( fs,
o,
A,
sBx   )     luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)

Definition at line 42 of file lcode.h.

Referenced by forbody(), forlist(), and luaK_jump().

#define NO_JUMP   (-1)

Definition at line 20 of file lcode.h.

Referenced by block(), enterblock(), forbody(), forlist(), ifstat(), init_exp(), luaK_concat(), luaK_dischargejpc(), luaK_exp2reg(), luaK_fixjump(), luaK_getjump(), luaK_goiffalse(), luaK_goiftrue(), luaK_infix(), luaK_jump(), luaK_patchlistaux(), luaK_posfix(), need_value(), open_func(), and whilestat().


Enumeration Type Documentation

enum BinOpr

Enumerator:
OPR_ADD 
OPR_SUB 
OPR_MULT 
OPR_DIV 
OPR_POW 
OPR_CONCAT 
OPR_NE 
OPR_EQ 
OPR_LT 
OPR_LE 
OPR_GT 
OPR_GE 
OPR_AND 
OPR_OR 
OPR_NOBINOPR 

Definition at line 26 of file lcode.h.

enum UnOpr

Enumerator:
OPR_MINUS 
OPR_NOT 
OPR_NOUNOPR 

Definition at line 37 of file lcode.h.


Function Documentation

void luaK_checkstack ( FuncState fs,
int  n 
)

Definition at line 195 of file lcode.c.

References cast, FuncState::f, FuncState::freereg, FuncState::ls, luaX_syntaxerror(), MAXSTACK, and Proto::maxstacksize.

Referenced by forlist(), and luaK_reserveregs().

int luaK_code ( FuncState fs,
Instruction  i,
int  line 
)

Definition at line 729 of file lcode.c.

References Proto::code, FuncState::f, FuncState::L, Proto::lineinfo, luaK_dischargejpc(), luaM_growvector, MAX_INT, FuncState::pc, Proto::sizecode, and Proto::sizelineinfo.

Referenced by luaK_codeABC(), luaK_codeABx(), and whilestat().

int luaK_codeABC ( FuncState fs,
OpCode  o,
int  A,
int  B,
int  C 
)

Definition at line 744 of file lcode.c.

References CREATE_ABC, getOpMode, iABC, LexState::lastline, FuncState::ls, lua_assert, and luaK_code().

Referenced by breakstat(), close_func(), code_label(), codebinop(), codenot(), constructor(), discharge2reg(), forbody(), fornum(), funcargs(), leaveblock(), luaK_condjump(), luaK_dischargevars(), luaK_nil(), luaK_posfix(), luaK_prefix(), luaK_self(), luaK_storevar(), pushclosure(), recfield(), and retstat().

int luaK_codeABx ( FuncState fs,
OpCode  o,
int  A,
unsigned int  Bx 
)

Definition at line 750 of file lcode.c.

References CREATE_ABx, getOpMode, iABx, iAsBx, LexState::lastline, FuncState::ls, lua_assert, and luaK_code().

Referenced by closelistfield(), discharge2reg(), fornum(), lastlistfield(), luaK_dischargevars(), luaK_storevar(), and pushclosure().

void luaK_concat ( FuncState fs,
int *  l1,
int  l2 
)

Definition at line 181 of file lcode.c.

References luaK_fixjump(), luaK_getjump(), next, and NO_JUMP.

Referenced by breakstat(), ifstat(), luaK_exp2reg(), luaK_goiffalse(), luaK_goiftrue(), luaK_jump(), luaK_patchtohere(), luaK_posfix(), and whilestat().

void luaK_dischargevars ( FuncState fs,
expdesc e 
)

Definition at line 283 of file lcode.c.

References expdesc::aux, freereg(), expdesc::info, expdesc::k, luaK_codeABC(), luaK_codeABx(), luaK_setcallreturns(), OP_GETGLOBAL, OP_GETTABLE, OP_GETUPVAL, VCALL, VGLOBAL, VINDEXED, VLOCAL, VNONRELOC, VRELOCABLE, and VUPVAL.

Referenced by codenot(), discharge2reg(), luaK_exp2anyreg(), luaK_exp2nextreg(), luaK_exp2val(), luaK_goiffalse(), luaK_goiftrue(), luaK_posfix(), and prefixexp().

int luaK_exp2anyreg ( FuncState fs,
expdesc e 
)

Definition at line 406 of file lcode.c.

References hasjumps, expdesc::info, expdesc::k, luaK_dischargevars(), luaK_exp2nextreg(), luaK_exp2reg(), FuncState::nactvar, and VNONRELOC.

Referenced by luaK_exp2RK(), luaK_exp2val(), luaK_prefix(), luaK_self(), luaK_storevar(), luaY_field(), primaryexp(), and retstat().

void luaK_exp2nextreg ( FuncState fs,
expdesc e 
)

Definition at line 398 of file lcode.c.

References freeexp(), FuncState::freereg, luaK_dischargevars(), luaK_exp2reg(), and luaK_reserveregs().

Referenced by adjust_assign(), closelistfield(), constructor(), exp1(), explist1(), funcargs(), lastlistfield(), luaK_exp2anyreg(), luaK_infix(), luaK_posfix(), primaryexp(), and retstat().

int luaK_exp2RK ( FuncState fs,
expdesc e 
)

Definition at line 428 of file lcode.c.

References expdesc::info, expdesc::k, luaK_exp2anyreg(), luaK_exp2val(), MAXARG_C, MAXSTACK, nil_constant(), FuncState::nk, VK, and VNIL.

Referenced by luaK_indexed(), luaK_infix(), luaK_posfix(), luaK_self(), luaK_storevar(), and recfield().

void luaK_exp2val ( FuncState fs,
expdesc e 
)

Definition at line 420 of file lcode.c.

References hasjumps, luaK_dischargevars(), and luaK_exp2anyreg().

Referenced by luaK_exp2RK(), luaK_posfix(), luaK_prefix(), and luaY_index().

void luaK_fixline ( FuncState fs,
int  line 
)

Definition at line 724 of file lcode.c.

References FuncState::f, Proto::lineinfo, and FuncState::pc.

Referenced by forbody(), funcargs(), and funcstat().

int luaK_getlabel ( FuncState fs  ) 

Definition at line 78 of file lcode.c.

References FuncState::lasttarget, and FuncState::pc.

Referenced by code_label(), forbody(), luaK_exp2reg(), luaK_patchtohere(), repeatstat(), and whilestat().

void luaK_goiffalse ( FuncState fs,
expdesc e 
)

Definition at line 548 of file lcode.c.

References expdesc::info, jumponcond(), expdesc::k, luaK_concat(), luaK_dischargevars(), luaK_jump(), NO_JUMP, expdesc::t, VFALSE, VJMP, VNIL, and VTRUE.

Referenced by luaK_infix(), and whilestat().

void luaK_goiftrue ( FuncState fs,
expdesc e 
)

Definition at line 522 of file lcode.c.

References expdesc::f, expdesc::info, invertjump(), jumponcond(), expdesc::k, luaK_concat(), luaK_dischargevars(), luaK_jump(), NO_JUMP, VFALSE, VJMP, VK, and VTRUE.

Referenced by cond(), and luaK_infix().

void luaK_indexed ( FuncState fs,
expdesc t,
expdesc k 
)

Definition at line 608 of file lcode.c.

References expdesc::aux, expdesc::k, luaK_exp2RK(), and VINDEXED.

Referenced by luaY_field(), and primaryexp().

void luaK_infix ( FuncState fs,
BinOpr  op,
expdesc v 
)

Definition at line 631 of file lcode.c.

References expdesc::f, luaK_exp2nextreg(), luaK_exp2RK(), luaK_goiffalse(), luaK_goiftrue(), luaK_patchtohere(), NO_JUMP, OPR_AND, OPR_CONCAT, OPR_OR, and expdesc::t.

Referenced by subexpr().

int luaK_jump ( FuncState fs  ) 

Definition at line 44 of file lcode.c.

References FuncState::jpc, luaK_codeAsBx, luaK_concat(), NO_JUMP, and OP_JMP.

Referenced by breakstat(), forbody(), fornum(), ifstat(), luaK_condjump(), luaK_exp2reg(), luaK_goiffalse(), luaK_goiftrue(), and whilestat().

void luaK_nil ( FuncState fs,
int  from,
int  n 
)

Definition at line 28 of file lcode.c.

References Proto::code, FuncState::f, GET_OPCODE, GETARG_A, GETARG_B, FuncState::lasttarget, luaK_codeABC(), OP_LOADNIL, FuncState::pc, and SETARG_B.

Referenced by adjust_assign(), and discharge2reg().

int luaK_numberK ( FuncState fs,
lua_Number  r 
)

Definition at line 255 of file lcode.c.

References addk(), and setnvalue.

Referenced by fornum(), luaK_prefix(), and simpleexp().

void luaK_patchlist ( FuncState fs,
int  list,
int  target 
)

Definition at line 165 of file lcode.c.

References lua_assert, luaK_patchlistaux(), luaK_patchtohere(), NO_REG, and FuncState::pc.

Referenced by forbody(), repeatstat(), and whilestat().

void luaK_patchtohere ( FuncState fs,
int  list 
)

Definition at line 175 of file lcode.c.

References FuncState::jpc, luaK_concat(), and luaK_getlabel().

Referenced by cond(), forbody(), ifstat(), leaveblock(), luaK_exp2reg(), luaK_infix(), luaK_patchlist(), and whilestat().

void luaK_posfix ( FuncState fs,
BinOpr  op,
expdesc v1,
expdesc v2 
)

Definition at line 680 of file lcode.c.

References expdesc::aux, codebinop(), expdesc::f, freeexp(), GET_OPCODE, GETARG_B, getcode, expdesc::info, expdesc::k, lua_assert, luaK_codeABC(), luaK_concat(), luaK_dischargevars(), luaK_exp2nextreg(), luaK_exp2RK(), luaK_exp2val(), NO_JUMP, OP_CONCAT, OPR_AND, OPR_CONCAT, OPR_OR, SETARG_B, expdesc::t, and VRELOCABLE.

Referenced by subexpr().

void luaK_prefix ( FuncState fs,
UnOpr  op,
expdesc v 
)

Definition at line 614 of file lcode.c.

References codenot(), freeexp(), expdesc::info, expdesc::k, luaK_codeABC(), luaK_exp2anyreg(), luaK_exp2val(), luaK_numberK(), nvalue, OP_UNM, OPR_MINUS, ttisnumber, VK, and VRELOCABLE.

Referenced by subexpr().

void luaK_reserveregs ( FuncState fs,
int  n 
)

Definition at line 205 of file lcode.c.

References FuncState::freereg, and luaK_checkstack().

Referenced by adjust_assign(), code_params(), discharge2anyreg(), fornum(), localfunc(), luaK_exp2nextreg(), and luaK_self().

void luaK_self ( FuncState fs,
expdesc e,
expdesc key 
)

Definition at line 482 of file lcode.c.

References freeexp(), FuncState::freereg, CCallS::func, expdesc::info, expdesc::k, luaK_codeABC(), luaK_exp2anyreg(), luaK_exp2RK(), luaK_reserveregs(), OP_SELF, and VNONRELOC.

Referenced by primaryexp().

void luaK_setcallreturns ( FuncState fs,
expdesc var,
int  nresults 
)

Definition at line 272 of file lcode.c.

References GETARG_A, getcode, expdesc::info, expdesc::k, SETARG_C, VCALL, and VNONRELOC.

Referenced by adjust_assign(), assignment(), exprstat(), funcargs(), lastlistfield(), luaK_dischargevars(), and retstat().

void luaK_storevar ( FuncState fs,
expdesc var,
expdesc e 
)

Definition at line 451 of file lcode.c.

References expdesc::aux, freeexp(), expdesc::info, expdesc::k, lua_assert, luaK_codeABC(), luaK_codeABx(), luaK_exp2anyreg(), luaK_exp2reg(), luaK_exp2RK(), OP_SETGLOBAL, OP_SETTABLE, OP_SETUPVAL, VGLOBAL, VINDEXED, VLOCAL, and VUPVAL.

Referenced by assignment(), funcstat(), and localfunc().

int luaK_stringK ( FuncState fs,
TString s 
)

Definition at line 248 of file lcode.c.

References addk(), and setsvalue.

Referenced by codestring(), and singlevaraux().


Generated on Fri Oct 12 08:44:55 2007 for rpm by  doxygen 1.5.2