# lcode.c File Reference

`#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 "ltable.h"`

## 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 Instruction * | getjumpcontrol (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 |  | ) | ((e)->t != (e)->f)

#define lcode_c

#define LUA_CORE

## Function Documentation

static int addk | ( | FuncState * | fs,
|  | TValue * | k,
|  | TValue * | v |
| ) |  |  | `[static]`

static int boolK | ( | FuncState * | fs,
|  | int | b |
| ) |  |  | `[static]`

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

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]`

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

static int condjump | ( | FuncState * | fs,
|  | OpCode | op,
|  | int | A,
|  | int | B,
|  | int | C |
| ) |  |  | `[static]`

static int constfolding | ( | OpCode | op,
|  | expdesc * | e1,
|  | expdesc * | e2 |
| ) |  |  | `[static]`

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

static void discharge2reg | ( | FuncState * | fs,
|  | expdesc * | e,
|  | int | reg |
| ) |  |  | `[static]`

static void dischargejpc | ( | FuncState * | fs | ) | `[static]`

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]`

static int getjump | ( | FuncState * | fs,
|  | int | pc |
| ) |  |  | `[static]`

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

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

static int isnumeral | ( | expdesc * | e | ) | `[static]`

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

void luaK_fixline | ( | FuncState * | fs,
|  | int | line |
| ) |  |  |

int luaK_getlabel | ( | FuncState * | fs | ) |

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

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

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

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

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

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

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

int luaK_stringK | ( | FuncState * | fs,
|  | TString * | s |
| ) |  |  |

static int need_value | ( | FuncState * | fs,
|  | int | list |
| ) |  |  | `[static]`

static int nilK | ( | FuncState * | fs | ) | `[static]`

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

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

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