lcode.c File Reference

Go to the source code of this file.

Defines

#define lcode_c
#define LUA_CORE
#define hasjumps(e)   ((e)->t != (e)->f)

Functions

static int isnumeral (expdesc *e)
void luaK_nil (FuncState *fs, int from, int n)
int luaK_jump (FuncState *fs)
void luaK_ret (FuncState *fs, int first, int nret)
static int condjump (FuncState *fs, OpCode op, int A, int B, int C)
static void fixjump (FuncState *fs, int pc, int dest)
int luaK_getlabel (FuncState *fs)
static int getjump (FuncState *fs, int pc)
static Instructiongetjumpcontrol (FuncState *fs, int pc)
static int need_value (FuncState *fs, int list)
static int patchtestreg (FuncState *fs, int node, int reg)
static void removevalues (FuncState *fs, int list)
static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, int dtarget)
static void dischargejpc (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)
void luaK_checkstack (FuncState *fs, int n)
void luaK_reserveregs (FuncState *fs, int n)
static void freereg (FuncState *fs, int reg)
static void freeexp (FuncState *fs, expdesc *e)
static int addk (FuncState *fs, TValue *k, TValue *v)
int luaK_stringK (FuncState *fs, TString *s)
int luaK_numberK (FuncState *fs, lua_Number r)
static int boolK (FuncState *fs, int b)
static int nilK (FuncState *fs)
void luaK_setreturns (FuncState *fs, expdesc *e, int nresults)
void luaK_setoneret (FuncState *fs, expdesc *e)
void luaK_dischargevars (FuncState *fs, expdesc *e)
static int code_label (FuncState *fs, int A, int b, int jump)
static void discharge2reg (FuncState *fs, expdesc *e, int reg)
static void discharge2anyreg (FuncState *fs, expdesc *e)
static void exp2reg (FuncState *fs, expdesc *e, int reg)
void luaK_exp2nextreg (FuncState *fs, expdesc *e)
int luaK_exp2anyreg (FuncState *fs, expdesc *e)
void luaK_exp2val (FuncState *fs, expdesc *e)
int luaK_exp2RK (FuncState *fs, expdesc *e)
void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex)
void luaK_self (FuncState *fs, expdesc *e, expdesc *key)
static void invertjump (FuncState *fs, expdesc *e)
static int jumponcond (FuncState *fs, expdesc *e, int cond)
void luaK_goiftrue (FuncState *fs, expdesc *e)
static void luaK_goiffalse (FuncState *fs, expdesc *e)
static void codenot (FuncState *fs, expdesc *e)
void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k)
static int constfolding (OpCode op, expdesc *e1, expdesc *e2)
static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2)
static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, expdesc *e2)
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e)
void luaK_infix (FuncState *fs, BinOpr op, expdesc *v)
void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2)
void luaK_fixline (FuncState *fs, int line)
static int luaK_code (FuncState *fs, Instruction i, int line)
int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c)
int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc)
void luaK_setlist (FuncState *fs, int base, int nelems, int tostore)

Define Documentation

#define hasjumps (  )     ((e)->t != (e)->f)

Definition at line 27 of file lcode.c.

Referenced by exp2reg(), luaK_exp2anyreg(), and luaK_exp2val().

#define lcode_c

Definition at line 10 of file lcode.c.

#define LUA_CORE

Definition at line 11 of file lcode.c.


Function Documentation

static int addk ( FuncState fs,
TValue k,
TValue v 
) [static]
static int boolK ( FuncState fs,
int  b 
) [static]

Definition at line 264 of file lcode.c.

References addk(), and setbvalue.

Referenced by luaK_exp2RK().

static int code_label ( FuncState fs,
int  A,
int  b,
int  jump 
) [static]

Definition at line 337 of file lcode.c.

References luaK_codeABC(), luaK_getlabel(), and OP_LOADBOOL.

Referenced by exp2reg().

static void codearith ( FuncState fs,
OpCode  op,
expdesc e1,
expdesc e2 
) [static]
static void codecomp ( FuncState fs,
OpCode  op,
int  cond,
expdesc e1,
expdesc e2 
) [static]

Definition at line 681 of file lcode.c.

References condjump(), freeexp(), expdesc::k, luaK_exp2RK(), OP_EQ, expdesc::s, expdesc::u, and VJMP.

Referenced by luaK_posfix().

static void codenot ( FuncState fs,
expdesc e 
) [static]
static int condjump ( FuncState fs,
OpCode  op,
int  A,
int  B,
int  C 
) [static]

Definition at line 74 of file lcode.c.

References luaK_codeABC(), and luaK_jump().

Referenced by codecomp(), and jumponcond().

static int constfolding ( OpCode  op,
expdesc e1,
expdesc e2 
) [static]
static void discharge2anyreg ( FuncState fs,
expdesc e 
) [static]

Definition at line 382 of file lcode.c.

References discharge2reg(), FuncState::freereg, expdesc::k, luaK_reserveregs(), and VNONRELOC.

Referenced by codenot(), and jumponcond().

static void discharge2reg ( FuncState fs,
expdesc e,
int  reg 
) [static]
static void dischargejpc ( FuncState fs  )  [static]

Definition at line 163 of file lcode.c.

References FuncState::jpc, NO_JUMP, NO_REG, patchlistaux(), and FuncState::pc.

Referenced by luaK_code().

static void exp2reg ( FuncState fs,
expdesc e,
int  reg 
) [static]
static void fixjump ( FuncState fs,
int  pc,
int  dest 
) [static]
static void freeexp ( FuncState fs,
expdesc e 
) [static]
static void freereg ( FuncState fs,
int  reg 
) [static]

Definition at line 215 of file lcode.c.

References FuncState::freereg, ISK, lua_assert, and FuncState::nactvar.

Referenced by freeexp(), and luaK_dischargevars().

static int getjump ( FuncState fs,
int  pc 
) [static]

Definition at line 100 of file lcode.c.

References Proto::code, FuncState::f, GETARG_sBx, and NO_JUMP.

Referenced by luaK_concat(), need_value(), patchlistaux(), and removevalues().

static Instruction* getjumpcontrol ( FuncState fs,
int  pc 
) [static]

Definition at line 109 of file lcode.c.

References Proto::code, FuncState::f, GET_OPCODE, and testTMode.

Referenced by invertjump(), need_value(), and patchtestreg().

static void invertjump ( FuncState fs,
expdesc e 
) [static]

Definition at line 516 of file lcode.c.

References GET_OPCODE, GETARG_A, getjumpcontrol(), lua_assert, OP_TEST, OP_TESTSET, expdesc::s, SETARG_A, testTMode, and expdesc::u.

Referenced by codenot(), and luaK_goiftrue().

static int isnumeral ( expdesc e  )  [static]

Definition at line 30 of file lcode.c.

References expdesc::f, expdesc::k, NO_JUMP, expdesc::t, and VKNUM.

Referenced by constfolding(), luaK_infix(), and luaK_prefix().

static int jumponcond ( FuncState fs,
expdesc e,
int  cond 
) [static]
void luaK_checkstack ( FuncState fs,
int  n 
)
static int luaK_code ( FuncState fs,
Instruction  i,
int  line 
) [static]
int luaK_codeABC ( FuncState fs,
OpCode  o,
int  a,
int  b,
int  c 
)
int luaK_codeABx ( FuncState fs,
OpCode  o,
int  a,
unsigned int  bc 
)
void luaK_concat ( FuncState fs,
int *  l1,
int  l2 
)
void luaK_dischargevars ( FuncState fs,
expdesc e 
)
int luaK_exp2anyreg ( FuncState fs,
expdesc e 
)
void luaK_exp2nextreg ( FuncState fs,
expdesc e 
)
int luaK_exp2RK ( FuncState fs,
expdesc e 
)
void luaK_exp2val ( FuncState fs,
expdesc e 
)

Definition at line 436 of file lcode.c.

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

Referenced by luaK_exp2RK(), luaK_posfix(), and yindex().

void luaK_fixline ( FuncState fs,
int  line 
)

Definition at line 792 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 94 of file lcode.c.

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

Referenced by code_label(), exp2reg(), luaK_patchtohere(), repeatstat(), and whilestat().

static void luaK_goiffalse ( FuncState fs,
expdesc e 
) [static]
void luaK_goiftrue ( FuncState fs,
expdesc e 
)
void luaK_indexed ( FuncState fs,
expdesc t,
expdesc k 
)

Definition at line 629 of file lcode.c.

References expdesc::k, luaK_exp2RK(), expdesc::s, expdesc::u, and VINDEXED.

Referenced by field(), and primaryexp().

void luaK_infix ( FuncState fs,
BinOpr  op,
expdesc v 
)
int luaK_jump ( FuncState fs  ) 
void luaK_nil ( FuncState fs,
int  from,
int  n 
)
int luaK_numberK ( FuncState fs,
lua_Number  r 
)

Definition at line 257 of file lcode.c.

References addk(), and setnvalue.

Referenced by discharge2reg(), fornum(), and luaK_exp2RK().

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

Definition at line 169 of file lcode.c.

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

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

void luaK_patchtohere ( FuncState fs,
int  list 
)
void luaK_posfix ( FuncState fs,
BinOpr  op,
expdesc e1,
expdesc e2 
)
void luaK_prefix ( FuncState fs,
UnOpr  op,
expdesc e 
)
void luaK_reserveregs ( FuncState fs,
int  n 
)
void luaK_ret ( FuncState fs,
int  first,
int  nret 
)

Definition at line 69 of file lcode.c.

References luaK_codeABC(), and OP_RETURN.

Referenced by close_func(), and retstat().

void luaK_self ( FuncState fs,
expdesc e,
expdesc key 
)
void luaK_setlist ( FuncState fs,
int  base,
int  nelems,
int  tostore 
)
void luaK_setoneret ( FuncState fs,
expdesc e 
)

Definition at line 292 of file lcode.c.

References GETARG_A, getcode, expdesc::k, expdesc::s, SETARG_B, expdesc::u, VCALL, VNONRELOC, VRELOCABLE, and VVARARG.

Referenced by assignment(), and luaK_dischargevars().

void luaK_setreturns ( FuncState fs,
expdesc e,
int  nresults 
)

Definition at line 280 of file lcode.c.

References FuncState::freereg, getcode, expdesc::k, luaK_reserveregs(), SETARG_A, SETARG_B, SETARG_C, VCALL, and VVARARG.

Referenced by adjust_assign().

void luaK_storevar ( FuncState fs,
expdesc var,
expdesc ex 
)
int luaK_stringK ( FuncState fs,
TString s 
)

Definition at line 250 of file lcode.c.

References addk(), FuncState::L, and setsvalue.

Referenced by codestring(), and singlevar().

static int need_value ( FuncState fs,
int  list 
) [static]

Definition at line 122 of file lcode.c.

References GET_OPCODE, getjump(), getjumpcontrol(), NO_JUMP, and OP_TESTSET.

Referenced by exp2reg().

static int nilK ( FuncState fs  )  [static]

Definition at line 271 of file lcode.c.

References addk(), FuncState::h, FuncState::L, sethvalue, and setnilvalue.

Referenced by luaK_exp2RK().

static void patchlistaux ( FuncState fs,
int  list,
int  vtarget,
int  reg,
int  dtarget 
) [static]

Definition at line 150 of file lcode.c.

References fixjump(), getjump(), next, NO_JUMP, and patchtestreg().

Referenced by dischargejpc(), exp2reg(), and luaK_patchlist().

static int patchtestreg ( FuncState fs,
int  node,
int  reg 
) [static]

Definition at line 131 of file lcode.c.

References CREATE_ABC, GET_OPCODE, GETARG_B, GETARG_C, getjumpcontrol(), NO_REG, OP_TEST, OP_TESTSET, and SETARG_A.

Referenced by patchlistaux(), and removevalues().

static void removevalues ( FuncState fs,
int  list 
) [static]

Definition at line 144 of file lcode.c.

References getjump(), NO_JUMP, NO_REG, and patchtestreg().

Referenced by codenot().


ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:59 2011 by Doxygen 1.6.1