|
|
@ -1,5 +1,5 @@ |
|
|
|
/*
|
|
|
|
** $Id: lcode.c,v 2.56 2011/05/31 18:27:56 roberto Exp roberto $ |
|
|
|
** $Id: lcode.c,v 2.57 2011/07/15 12:50:29 roberto Exp roberto $ |
|
|
|
** Code generator for Lua |
|
|
|
** See Copyright Notice in lua.h |
|
|
|
*/ |
|
|
@ -213,11 +213,11 @@ static int luaK_code (FuncState *fs, Instruction i) { |
|
|
|
Proto *f = fs->f; |
|
|
|
dischargejpc(fs); /* `pc' will change */ |
|
|
|
/* put new instruction in code array */ |
|
|
|
luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, |
|
|
|
luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction, |
|
|
|
MAX_INT, "opcodes"); |
|
|
|
f->code[fs->pc] = i; |
|
|
|
/* save corresponding line information */ |
|
|
|
luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int, |
|
|
|
luaM_growvector(fs->ls->L, f->lineinfo, fs->pc, f->sizelineinfo, int, |
|
|
|
MAX_INT, "opcodes"); |
|
|
|
f->lineinfo[fs->pc] = fs->ls->lastline; |
|
|
|
return fs->pc++; |
|
|
@ -289,7 +289,7 @@ static void freeexp (FuncState *fs, expdesc *e) { |
|
|
|
|
|
|
|
|
|
|
|
static int addk (FuncState *fs, TValue *key, TValue *v) { |
|
|
|
lua_State *L = fs->L; |
|
|
|
lua_State *L = fs->ls->L; |
|
|
|
TValue *idx = luaH_set(L, fs->h, key); |
|
|
|
Proto *f = fs->f; |
|
|
|
int k, oldsize; |
|
|
@ -316,14 +316,14 @@ static int addk (FuncState *fs, TValue *key, TValue *v) { |
|
|
|
|
|
|
|
int luaK_stringK (FuncState *fs, TString *s) { |
|
|
|
TValue o; |
|
|
|
setsvalue(fs->L, &o, s); |
|
|
|
setsvalue(fs->ls->L, &o, s); |
|
|
|
return addk(fs, &o, &o); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int luaK_numberK (FuncState *fs, lua_Number r) { |
|
|
|
int n; |
|
|
|
lua_State *L = fs->L; |
|
|
|
lua_State *L = fs->ls->L; |
|
|
|
TValue o; |
|
|
|
setnvalue(&o, r); |
|
|
|
if (r == 0 || luai_numisnan(NULL, r)) { /* handle -0 and NaN */ |
|
|
@ -350,7 +350,7 @@ static int nilK (FuncState *fs) { |
|
|
|
TValue k, v; |
|
|
|
setnilvalue(&v); |
|
|
|
/* cannot use nil as key; instead use table itself to represent nil */ |
|
|
|
sethvalue(fs->L, &k, fs->h); |
|
|
|
sethvalue(fs->ls->L, &k, fs->h); |
|
|
|
return addk(fs, &k, &v); |
|
|
|
} |
|
|
|
|
|
|
|