lua/lcode.c File Reference

#include <stdlib.h>
#include "lua.h"
#include "lcode.h"
#include "ldebug.h"
#include "ldo.h"
#include "llex.h"
#include "lmem.h"
#include "lobject.h"
#include "lopcodes.h"
#include "lparser.h"
#include "ltable.h"

Go to the source code of this file.

Defines

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

Functions

void luaK_nil (FuncState *fs, int from, int n)
int luaK_jump (FuncState *fs)
static int luaK_condjump (FuncState *fs, OpCode op, int A, int B, int C)
static void luaK_fixjump (FuncState *fs, int pc, int dest)
int luaK_getlabel (FuncState *fs)
static int luaK_getjump (FuncState *fs, int pc)
static Instructiongetjumpcontrol (FuncState *fs, int pc)
static int need_value (FuncState *fs, int list, int cond)
static void patchtestreg (Instruction *i, int reg)
static void luaK_patchlistaux (FuncState *fs, int list, int ttarget, int treg, int ftarget, int freg, int dtarget)
static void luaK_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, TObject *k, TObject *v)
int luaK_stringK (FuncState *fs, TString *s)
int luaK_numberK (FuncState *fs, lua_Number r)
static int nil_constant (FuncState *fs)
void luaK_setcallreturns (FuncState *fs, expdesc *e, int nresults)
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 luaK_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 *exp)
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)
void luaK_goiffalse (FuncState *fs, expdesc *e)
static void codenot (FuncState *fs, expdesc *e)
void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k)
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e)
void luaK_infix (FuncState *fs, BinOpr op, expdesc *v)
static void codebinop (FuncState *fs, expdesc *res, BinOpr op, int o1, int o2)
void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2)
void luaK_fixline (FuncState *fs, int line)
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)


Define Documentation

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

Definition at line 25 of file lcode.c.

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

#define lcode_c

Definition at line 10 of file lcode.c.


Function Documentation

static int addk ( FuncState fs,
TObject k,
TObject v 
) [static]

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

Definition at line 315 of file lcode.c.

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

Referenced by luaK_exp2reg().

static void codebinop ( FuncState fs,
expdesc res,
BinOpr  op,
int  o1,
int  o2 
) [static]

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

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

Definition at line 360 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 freeexp ( FuncState fs,
expdesc e 
) [static]

static void freereg ( FuncState fs,
int  reg 
) [static]

Definition at line 211 of file lcode.c.

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

Referenced by freeexp(), and luaK_dischargevars().

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

Definition at line 95 of file lcode.c.

References Proto::code, FuncState::f, GET_OPCODE, OpModeT, and testOpMode.

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

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

Definition at line 495 of file lcode.c.

References GET_OPCODE, GETARG_A, getjumpcontrol(), expdesc::info, lua_assert, OP_TEST, OpModeT, SETARG_A, and testOpMode.

Referenced by codenot(), and luaK_goiftrue().

static int jumponcond ( FuncState fs,
expdesc e,
int  cond 
) [static]

void luaK_checkstack ( FuncState fs,
int  n 
)

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_concat ( FuncState fs,
int *  l1,
int  l2 
)

static int luaK_condjump ( FuncState fs,
OpCode  op,
int  A,
int  B,
int  C 
) [static]

Definition at line 54 of file lcode.c.

References luaK_codeABC(), and luaK_jump().

Referenced by codebinop(), and jumponcond().

static void luaK_dischargejpc ( FuncState fs  )  [static]

Definition at line 157 of file lcode.c.

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

Referenced by luaK_code().

void luaK_dischargevars ( FuncState fs,
expdesc e 
)

int luaK_exp2anyreg ( FuncState fs,
expdesc e 
)

void luaK_exp2nextreg ( FuncState fs,
expdesc e 
)

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

int luaK_exp2RK ( FuncState fs,
expdesc e 
)

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().

static void luaK_fixjump ( FuncState fs,
int  pc,
int  dest 
) [static]

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().

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

Definition at line 84 of file lcode.c.

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

Referenced by luaK_concat(), luaK_patchlistaux(), and need_value().

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 
)

void luaK_goiftrue ( FuncState fs,
expdesc e 
)

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 
)

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 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().

static void luaK_patchlistaux ( FuncState fs,
int  list,
int  ttarget,
int  treg,
int  ftarget,
int  freg,
int  dtarget 
) [static]

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_self ( FuncState fs,
expdesc e,
expdesc key 
)

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

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

int luaK_stringK ( FuncState fs,
TString s 
)

Definition at line 248 of file lcode.c.

References addk(), and setsvalue.

Referenced by codestring(), and singlevaraux().

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

Definition at line 110 of file lcode.c.

References GET_OPCODE, GETARG_C, getjumpcontrol(), luaK_getjump(), NO_JUMP, and OP_TEST.

Referenced by luaK_exp2reg().

static int nil_constant ( FuncState fs  )  [static]

Definition at line 262 of file lcode.c.

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

Referenced by luaK_exp2RK().

static void patchtestreg ( Instruction i,
int  reg 
) [static]

Definition at line 121 of file lcode.c.

References GETARG_B, NO_REG, and SETARG_A.

Referenced by luaK_patchlistaux().


Generated on Fri Dec 12 13:02:11 2008 for rpm by  doxygen 1.5.6