The Battle for Wesnoth  1.15.12+dev
Macros | Functions
lcode.cpp File Reference
#include "lprefix.h"
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include "lua.h"
#include "lcode.h"
#include "ldebug.h"
#include "ldo.h"
#include "lgc.h"
#include "llex.h"
#include "lmem.h"
#include "lobject.h"
#include "lopcodes.h"
#include "lparser.h"
#include "lstring.h"
#include "ltable.h"
#include "lvm.h"
Include dependency graph for lcode.cpp:

Go to the source code of this file.

Macros

#define lcode_c
 
#define LUA_CORE
 
#define MAXREGS   255
 
#define hasjumps(e)   ((e)->t != (e)->f)
 
#define MAXIWTHABS   120
 
#define LIMLINEDIFF   0x80
 

Functions

static int codesJ (FuncState *fs, OpCode o, int sj, int k)
 
l_noret luaK_semerror (LexState *ls, const char *msg)
 
static int tonumeral (const expdesc *e, TValue *v)
 
static TValueconst2val (FuncState *fs, const expdesc *e)
 
int luaK_exp2const (FuncState *fs, const expdesc *e, TValue *v)
 
static Instructionpreviousinstruction (FuncState *fs)
 
void luaK_nil (FuncState *fs, int from, int n)
 
static int getjump (FuncState *fs, int pc)
 
static void fixjump (FuncState *fs, int pc, int dest)
 
void luaK_concat (FuncState *fs, int *l1, int l2)
 
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, int k)
 
int luaK_getlabel (FuncState *fs)
 
static Instructiongetjumpcontrol (FuncState *fs, int pc)
 
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)
 
void luaK_patchlist (FuncState *fs, int list, int target)
 
void luaK_patchtohere (FuncState *fs, int list)
 
static void savelineinfo (FuncState *fs, Proto *f, int line)
 
static void removelastlineinfo (FuncState *fs)
 
static void removelastinstruction (FuncState *fs)
 
int luaK_code (FuncState *fs, Instruction i)
 
int luaK_codeABCk (FuncState *fs, OpCode o, int a, int b, int c, int k)
 
int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc)
 
int luaK_codeAsBx (FuncState *fs, OpCode o, int a, int bc)
 
static int codeextraarg (FuncState *fs, int a)
 
static int luaK_codek (FuncState *fs, int reg, int k)
 
void luaK_checkstack (FuncState *fs, int n)
 
void luaK_reserveregs (FuncState *fs, int n)
 
static void freereg (FuncState *fs, int reg)
 
static void freeregs (FuncState *fs, int r1, int r2)
 
static void freeexp (FuncState *fs, expdesc *e)
 
static void freeexps (FuncState *fs, expdesc *e1, expdesc *e2)
 
static int addk (FuncState *fs, TValue *key, TValue *v)
 
static int stringK (FuncState *fs, TString *s)
 
static int luaK_intK (FuncState *fs, lua_Integer n)
 
static int luaK_numberK (FuncState *fs, lua_Number r)
 
static int boolF (FuncState *fs)
 
static int boolT (FuncState *fs)
 
static int nilK (FuncState *fs)
 
static int fitsC (lua_Integer i)
 
static int fitsBx (lua_Integer i)
 
void luaK_int (FuncState *fs, int reg, lua_Integer i)
 
static void luaK_float (FuncState *fs, int reg, lua_Number f)
 
static void const2exp (TValue *v, expdesc *e)
 
void luaK_setreturns (FuncState *fs, expdesc *e, int nresults)
 
static void str2K (FuncState *fs, expdesc *e)
 
void luaK_setoneret (FuncState *fs, expdesc *e)
 
void luaK_dischargevars (FuncState *fs, expdesc *e)
 
static void discharge2reg (FuncState *fs, expdesc *e, int reg)
 
static void discharge2anyreg (FuncState *fs, expdesc *e)
 
static int code_loadbool (FuncState *fs, int A, OpCode op)
 
static int need_value (FuncState *fs, int list)
 
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_exp2anyregup (FuncState *fs, expdesc *e)
 
void luaK_exp2val (FuncState *fs, expdesc *e)
 
static int luaK_exp2K (FuncState *fs, expdesc *e)
 
int luaK_exp2RK (FuncState *fs, expdesc *e)
 
static void codeABRK (FuncState *fs, OpCode o, int a, int b, expdesc *ec)
 
void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex)
 
void luaK_self (FuncState *fs, expdesc *e, expdesc *key)
 
static void negatecondition (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)
 
static int isKstr (FuncState *fs, expdesc *e)
 
int luaK_isKint (expdesc *e)
 
static int isCint (expdesc *e)
 
static int isSCint (expdesc *e)
 
static int isSCnumber (expdesc *e, int *pi, int *isfloat)
 
void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k)
 
static int validop (int op, TValue *v1, TValue *v2)
 
static int constfolding (FuncState *fs, int op, expdesc *e1, const expdesc *e2)
 
static void codeunexpval (FuncState *fs, OpCode op, expdesc *e, int line)
 
static void finishbinexpval (FuncState *fs, expdesc *e1, expdesc *e2, OpCode op, int v2, int flip, int line, OpCode mmop, TMS event)
 
static void codebinexpval (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2, int line)
 
static void codebini (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2, int flip, int line, TMS event)
 
static int finishbinexpneg (FuncState *fs, expdesc *e1, expdesc *e2, OpCode op, int line, TMS event)
 
static void swapexps (expdesc *e1, expdesc *e2)
 
static void codearith (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2, int flip, int line)
 
static void codecommutative (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2, int line)
 
static void codebitwise (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2, int line)
 
static void codeorder (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2)
 
static void codeeq (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2)
 
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line)
 
void luaK_infix (FuncState *fs, BinOpr op, expdesc *v)
 
static void codeconcat (FuncState *fs, expdesc *e1, expdesc *e2, int line)
 
void luaK_posfix (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2, int line)
 
void luaK_fixline (FuncState *fs, int line)
 
void luaK_settablesize (FuncState *fs, int pc, int ra, int asize, int hsize)
 
void luaK_setlist (FuncState *fs, int base, int nelems, int tostore)
 
static int finaltarget (Instruction *code, int i)
 
void luaK_finish (FuncState *fs)
 

Macro Definition Documentation

◆ hasjumps

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

◆ lcode_c

#define lcode_c

Definition at line 7 of file lcode.cpp.

◆ LIMLINEDIFF

#define LIMLINEDIFF   0x80

Definition at line 327 of file lcode.cpp.

Referenced by savelineinfo().

◆ LUA_CORE

#define LUA_CORE

Definition at line 8 of file lcode.cpp.

◆ MAXIWTHABS

#define MAXIWTHABS   120

Definition at line 322 of file lcode.cpp.

Referenced by removelastlineinfo(), and savelineinfo().

◆ MAXREGS

#define MAXREGS   255

Definition at line 34 of file lcode.cpp.

Referenced by luaK_checkstack().

Function Documentation

◆ addk()

static int addk ( FuncState fs,
TValue key,
TValue v 
)
static

◆ boolF()

static int boolF ( FuncState fs)
static

Definition at line 612 of file lcode.cpp.

References addk(), and setbfvalue.

Referenced by luaK_exp2K().

◆ boolT()

static int boolT ( FuncState fs)
static

Definition at line 622 of file lcode.cpp.

References addk(), and setbtvalue.

Referenced by luaK_exp2K().

◆ code_loadbool()

static int code_loadbool ( FuncState fs,
int  A,
OpCode  op 
)
static

Definition at line 875 of file lcode.cpp.

References luaK_codeABC, and luaK_getlabel().

Referenced by exp2reg().

◆ codeABRK()

static void codeABRK ( FuncState fs,
OpCode  o,
int  a,
int  b,
expdesc ec 
)
static

Definition at line 1025 of file lcode.cpp.

References expdesc::info, luaK_codeABCk(), luaK_exp2RK(), and expdesc::u.

Referenced by luaK_self(), and luaK_storevar().

◆ codearith()

static void codearith ( FuncState fs,
BinOpr  opr,
expdesc e1,
expdesc e2,
int  flip,
int  line 
)
static

◆ codebinexpval()

static void codebinexpval ( FuncState fs,
OpCode  op,
expdesc e1,
expdesc e2,
int  line 
)
static

Definition at line 1378 of file lcode.cpp.

References cast, finishbinexpval(), lua_assert, luaK_exp2anyreg(), OP_ADD, OP_MMBIN, OP_SHR, and TM_ADD.

Referenced by codearith(), codebitwise(), and luaK_posfix().

◆ codebini()

static void codebini ( FuncState fs,
OpCode  op,
expdesc e1,
expdesc e2,
int  flip,
int  line,
TMS  event 
)
static

◆ codebitwise()

static void codebitwise ( FuncState fs,
BinOpr  opr,
expdesc e1,
expdesc e2,
int  line 
)
static

◆ codecommutative()

static void codecommutative ( FuncState fs,
BinOpr  op,
expdesc e1,
expdesc e2,
int  line 
)
static

Definition at line 1452 of file lcode.cpp.

References cast, codearith(), codebini(), isSCint(), OP_ADDI, OPR_ADD, swapexps(), TM_ADD, and tonumeral().

Referenced by luaK_posfix().

◆ codeconcat()

static void codeconcat ( FuncState fs,
expdesc e1,
expdesc e2,
int  line 
)
static

◆ codeeq()

static void codeeq ( FuncState fs,
BinOpr  opr,
expdesc e1,
expdesc e2 
)
static

◆ codeextraarg()

static int codeextraarg ( FuncState fs,
int  a 
)
static

Definition at line 448 of file lcode.cpp.

References CREATE_Ax, lua_assert, luaK_code(), MAXARG_Ax, and OP_EXTRAARG.

Referenced by luaK_codek(), and luaK_setlist().

◆ codenot()

static void codenot ( FuncState fs,
expdesc e 
)
static

◆ codeorder()

static void codeorder ( FuncState fs,
OpCode  op,
expdesc e1,
expdesc e2 
)
static

◆ codesJ()

static int codesJ ( FuncState fs,
OpCode  o,
int  sj,
int  k 
)
static

Definition at line 437 of file lcode.cpp.

References CREATE_sJ, getOpMode, isJ, lua_assert, luaK_code(), MAXARG_sJ, and OFFSET_sJ.

Referenced by luaK_jump().

◆ codeunexpval()

static void codeunexpval ( FuncState fs,
OpCode  op,
expdesc e,
int  line 
)
static

Definition at line 1345 of file lcode.cpp.

References freeexp(), expdesc::info, expdesc::k, luaK_codeABC, luaK_exp2anyreg(), luaK_fixline(), expdesc::u, and VRELOC.

Referenced by luaK_prefix().

◆ condjump()

static int condjump ( FuncState fs,
OpCode  op,
int  A,
int  B,
int  C,
int  k 
)
static

Definition at line 221 of file lcode.cpp.

References luaK_codeABCk(), and luaK_jump().

Referenced by codeeq(), codeorder(), and jumponcond().

◆ const2exp()

static void const2exp ( TValue v,
expdesc e 
)
static

◆ const2val()

static TValue* const2val ( FuncState fs,
const expdesc e 
)
static

◆ constfolding()

static int constfolding ( FuncState fs,
int  op,
expdesc e1,
const expdesc e2 
)
static

◆ discharge2anyreg()

static void discharge2anyreg ( FuncState fs,
expdesc e 
)
static

Definition at line 867 of file lcode.cpp.

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

Referenced by codenot(), and jumponcond().

◆ discharge2reg()

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

◆ exp2reg()

static void exp2reg ( FuncState fs,
expdesc e,
int  reg 
)
static

◆ finaltarget()

static int finaltarget ( Instruction code,
int  i 
)
static

Definition at line 1773 of file lcode.cpp.

References GET_OPCODE, GETARG_sJ, i, and OP_JMP.

Referenced by luaK_finish().

◆ finishbinexpneg()

static int finishbinexpneg ( FuncState fs,
expdesc e1,
expdesc e2,
OpCode  op,
int  line,
TMS  event 
)
static

◆ finishbinexpval()

static void finishbinexpval ( FuncState fs,
expdesc e1,
expdesc e2,
OpCode  op,
int  v2,
int  flip,
int  line,
OpCode  mmop,
TMS  event 
)
static

◆ fitsBx()

static int fitsBx ( lua_Integer  i)
static

Definition at line 654 of file lcode.cpp.

References MAXARG_Bx, and OFFSET_sBx.

Referenced by luaK_float(), and luaK_int().

◆ fitsC()

static int fitsC ( lua_Integer  i)
static

Definition at line 646 of file lcode.cpp.

References cast_uint, l_castS2U, MAXARG_C, and OFFSET_sC.

Referenced by finishbinexpneg(), isSCint(), and isSCnumber().

◆ fixjump()

static void fixjump ( FuncState fs,
int  pc,
int  dest 
)
static

◆ freeexp()

static void freeexp ( FuncState fs,
expdesc e 
)
static

◆ freeexps()

static void freeexps ( FuncState fs,
expdesc e1,
expdesc e2 
)
static

Definition at line 535 of file lcode.cpp.

References freeregs(), expdesc::info, expdesc::k, expdesc::u, and VNONRELOC.

Referenced by codeeq(), codeorder(), and finishbinexpval().

◆ freereg()

static void freereg ( FuncState fs,
int  reg 
)
static

Definition at line 499 of file lcode.cpp.

References FuncState::freereg, lua_assert, and luaY_nvarstack().

Referenced by freeexp(), freeregs(), and luaK_dischargevars().

◆ freeregs()

static void freeregs ( FuncState fs,
int  r1,
int  r2 
)
static

Definition at line 510 of file lcode.cpp.

References freereg().

Referenced by freeexps(), and luaK_dischargevars().

◆ getjump()

static int getjump ( FuncState fs,
int  pc 
)
static

Definition at line 153 of file lcode.cpp.

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

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

◆ getjumpcontrol()

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

Definition at line 242 of file lcode.cpp.

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

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

◆ isCint()

static int isCint ( expdesc e)
static

Definition at line 1224 of file lcode.cpp.

References expdesc::ival, l_castS2U, luaK_isKint(), MAXARG_C, and expdesc::u.

Referenced by luaK_indexed().

◆ isKstr()

static int isKstr ( FuncState fs,
expdesc e 
)
static

Definition at line 1207 of file lcode.cpp.

References FuncState::f, hasjumps, expdesc::info, expdesc::k, Proto::k, MAXARG_B, ttisshrstring, expdesc::u, and VK.

Referenced by luaK_indexed().

◆ isSCint()

static int isSCint ( expdesc e)
static

Definition at line 1233 of file lcode.cpp.

References fitsC(), expdesc::ival, luaK_isKint(), and expdesc::u.

Referenced by codecommutative(), and luaK_posfix().

◆ isSCnumber()

static int isSCnumber ( expdesc e,
int *  pi,
int *  isfloat 
)
static

◆ jumponcond()

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

◆ luaK_checkstack()

void luaK_checkstack ( FuncState fs,
int  n 
)

◆ luaK_code()

int luaK_code ( FuncState fs,
Instruction  i 
)

◆ luaK_codeABCk()

int luaK_codeABCk ( FuncState fs,
OpCode  o,
int  a,
int  b,
int  c,
int  k 
)

Definition at line 405 of file lcode.cpp.

References CREATE_ABCk, getOpMode, iABC, lua_assert, luaK_code(), MAXARG_A, MAXARG_B, and MAXARG_C.

Referenced by codeABRK(), condjump(), finishbinexpval(), and luaK_setlist().

◆ luaK_codeABx()

int luaK_codeABx ( FuncState fs,
OpCode  o,
int  a,
unsigned int  bc 
)

Definition at line 416 of file lcode.cpp.

References CREATE_ABx, getOpMode, iABx, lua_assert, luaK_code(), MAXARG_A, and MAXARG_Bx.

Referenced by codeclosure(), forbody(), and luaK_codek().

◆ luaK_codeAsBx()

int luaK_codeAsBx ( FuncState fs,
OpCode  o,
int  a,
int  bc 
)

Definition at line 426 of file lcode.cpp.

References b, CREATE_ABx, getOpMode, iAsBx, lua_assert, luaK_code(), MAXARG_A, MAXARG_Bx, and OFFSET_sBx.

Referenced by luaK_float(), and luaK_int().

◆ luaK_codek()

static int luaK_codek ( FuncState fs,
int  reg,
int  k 
)
static

Definition at line 459 of file lcode.cpp.

References codeextraarg(), luaK_codeABx(), MAXARG_Bx, OP_LOADK, OP_LOADKX, and p.

Referenced by discharge2reg(), luaK_float(), and luaK_int().

◆ luaK_concat()

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

Definition at line 180 of file lcode.cpp.

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

Referenced by exp2reg(), luaK_goiffalse(), luaK_goiftrue(), luaK_posfix(), and test_then_block().

◆ luaK_dischargevars()

void luaK_dischargevars ( FuncState fs,
expdesc e 
)

◆ luaK_exp2anyreg()

int luaK_exp2anyreg ( FuncState fs,
expdesc e 
)

◆ luaK_exp2anyregup()

void luaK_exp2anyregup ( FuncState fs,
expdesc e 
)

Definition at line 963 of file lcode.cpp.

References hasjumps, expdesc::k, luaK_exp2anyreg(), and VUPVAL.

Referenced by fieldsel(), and suffixedexp().

◆ luaK_exp2const()

int luaK_exp2const ( FuncState fs,
const expdesc e,
TValue v 
)

◆ luaK_exp2K()

static int luaK_exp2K ( FuncState fs,
expdesc e 
)
static

◆ luaK_exp2nextreg()

void luaK_exp2nextreg ( FuncState fs,
expdesc e 
)

◆ luaK_exp2RK()

int luaK_exp2RK ( FuncState fs,
expdesc e 
)

Definition at line 1015 of file lcode.cpp.

References luaK_exp2anyreg(), and luaK_exp2K().

Referenced by codeABRK(), codebitwise(), codeeq(), and luaK_infix().

◆ luaK_exp2val()

void luaK_exp2val ( FuncState fs,
expdesc e 
)

Definition at line 973 of file lcode.cpp.

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

Referenced by yindex().

◆ luaK_finish()

void luaK_finish ( FuncState fs)

◆ luaK_fixline()

void luaK_fixline ( FuncState fs,
int  line 
)

◆ luaK_float()

static void luaK_float ( FuncState fs,
int  reg,
lua_Number  f 
)
static

Definition at line 667 of file lcode.cpp.

References cast_int, F2Ieq, fitsBx(), luaK_codeAsBx(), luaK_codek(), luaK_numberK(), luaV_flttointeger(), and OP_LOADF.

Referenced by discharge2reg().

◆ luaK_getlabel()

int luaK_getlabel ( FuncState fs)

◆ luaK_goiffalse()

void luaK_goiffalse ( FuncState fs,
expdesc e 
)

◆ luaK_goiftrue()

void luaK_goiftrue ( FuncState fs,
expdesc e 
)

◆ luaK_indexed()

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

◆ luaK_infix()

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

◆ luaK_int()

void luaK_int ( FuncState fs,
int  reg,
lua_Integer  i 
)

Definition at line 659 of file lcode.cpp.

References cast_int, fitsBx(), luaK_codeAsBx(), luaK_codek(), luaK_intK(), and OP_LOADI.

Referenced by discharge2reg(), and fornum().

◆ luaK_intK()

static int luaK_intK ( FuncState fs,
lua_Integer  n 
)
static

Definition at line 592 of file lcode.cpp.

References addk(), cast_sizet, cast_voidp, setivalue, and setpvalue.

Referenced by luaK_exp2K(), and luaK_int().

◆ luaK_isKint()

int luaK_isKint ( expdesc e)

Definition at line 1215 of file lcode.cpp.

References hasjumps, expdesc::k, and VKINT.

Referenced by finishbinexpneg(), isCint(), and isSCint().

◆ luaK_jump()

int luaK_jump ( FuncState fs)

Definition at line 198 of file lcode.cpp.

References codesJ(), NO_JUMP, and OP_JMP.

Referenced by breakstat(), condjump(), exp2reg(), gotostat(), repeatstat(), and test_then_block().

◆ luaK_nil()

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

◆ luaK_numberK()

static int luaK_numberK ( FuncState fs,
lua_Number  r 
)
static

Definition at line 602 of file lcode.cpp.

References addk(), and setfltvalue.

Referenced by luaK_exp2K(), and luaK_float().

◆ luaK_patchlist()

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

Definition at line 305 of file lcode.cpp.

References lua_assert, NO_REG, and patchlistaux().

Referenced by gotostat(), luaK_patchtohere(), repeatstat(), and solvegoto().

◆ luaK_patchtohere()

void luaK_patchtohere ( FuncState fs,
int  list 
)

◆ luaK_posfix()

void luaK_posfix ( FuncState fs,
BinOpr  opr,
expdesc e1,
expdesc e2,
int  line 
)

◆ luaK_prefix()

void luaK_prefix ( FuncState fs,
UnOpr  op,
expdesc e,
int  line 
)

◆ luaK_reserveregs()

void luaK_reserveregs ( FuncState fs,
int  n 
)

◆ luaK_ret()

void luaK_ret ( FuncState fs,
int  first,
int  nret 
)

Definition at line 206 of file lcode.cpp.

References luaK_codeABC, OP_RETURN, OP_RETURN0, and OP_RETURN1.

Referenced by close_func(), and retstat().

◆ luaK_self()

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

◆ luaK_semerror()

l_noret luaK_semerror ( LexState ls,
const char *  msg 
)

◆ luaK_setlist()

void luaK_setlist ( FuncState fs,
int  base,
int  nelems,
int  tostore 
)

◆ luaK_setoneret()

void luaK_setoneret ( FuncState fs,
expdesc e 
)

◆ luaK_setreturns()

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

◆ luaK_settablesize()

void luaK_settablesize ( FuncState fs,
int  pc,
int  ra,
int  asize,
int  hsize 
)

Definition at line 1736 of file lcode.cpp.

References Proto::code, CREATE_ABCk, CREATE_Ax, FuncState::f, luaO_ceillog2(), MAXARG_C, OP_EXTRAARG, and OP_NEWTABLE.

Referenced by constructor().

◆ luaK_storevar()

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

◆ need_value()

static int need_value ( FuncState fs,
int  list 
)
static

Definition at line 885 of file lcode.cpp.

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

Referenced by exp2reg().

◆ negatecondition()

static void negatecondition ( FuncState fs,
expdesc e 
)
static

◆ nilK()

static int nilK ( FuncState fs)
static

Definition at line 632 of file lcode.cpp.

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

Referenced by luaK_exp2K().

◆ patchlistaux()

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

Definition at line 287 of file lcode.cpp.

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

Referenced by exp2reg(), and luaK_patchlist().

◆ patchtestreg()

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

Definition at line 258 of file lcode.cpp.

References CREATE_ABCk, GET_OPCODE, GETARG_B, GETARG_k, getjumpcontrol(), i, NO_REG, OP_TEST, OP_TESTSET, and SETARG_A.

Referenced by patchlistaux(), and removevalues().

◆ previousinstruction()

static Instruction* previousinstruction ( FuncState fs)
static

Definition at line 115 of file lcode.cpp.

References cast, Proto::code, FuncState::f, FuncState::lasttarget, and FuncState::pc.

Referenced by codeconcat(), and luaK_nil().

◆ removelastinstruction()

static void removelastinstruction ( FuncState fs)
static

Definition at line 380 of file lcode.cpp.

References FuncState::pc, and removelastlineinfo().

Referenced by jumponcond().

◆ removelastlineinfo()

static void removelastlineinfo ( FuncState fs)
static

◆ removevalues()

static void removevalues ( FuncState fs,
int  list 
)
static

Definition at line 276 of file lcode.cpp.

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

Referenced by codenot().

◆ savelineinfo()

static void savelineinfo ( FuncState fs,
Proto f,
int  line 
)
static

◆ str2K()

static void str2K ( FuncState fs,
expdesc e 
)
static

Definition at line 724 of file lcode.cpp.

References expdesc::info, expdesc::k, lua_assert, stringK(), expdesc::strval, expdesc::u, VK, and VKSTR.

Referenced by discharge2reg(), and luaK_indexed().

◆ stringK()

static int stringK ( FuncState fs,
TString s 
)
static

Definition at line 579 of file lcode.cpp.

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

Referenced by luaK_exp2K(), and str2K().

◆ swapexps()

static void swapexps ( expdesc e1,
expdesc e2 
)
static

Definition at line 1421 of file lcode.cpp.

Referenced by codearith(), codebitwise(), codecommutative(), codeeq(), and luaK_posfix().

◆ tonumeral()

static int tonumeral ( const expdesc e,
TValue v 
)
static

◆ validop()

static int validop ( int  op,
TValue v1,
TValue v2 
)
static