aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-01-19 11:20:30 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-01-19 11:20:30 -0200
commit4ac58853dc820127a11a14ed8bde1fae9458369e (patch)
treee8179692c97e935ba921c8ebd17abf9c8510d89e /lcode.c
parentf2c451d7455aad3496f32dfa2bfca7f7e8b5376d (diff)
downloadlua-4ac58853dc820127a11a14ed8bde1fae9458369e.tar.gz
lua-4ac58853dc820127a11a14ed8bde1fae9458369e.tar.bz2
lua-4ac58853dc820127a11a14ed8bde1fae9458369e.zip
thead-specific state separated from "global" state
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lcode.c b/lcode.c
index cc06ec47..61b1f2ce 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 1.55 2000/12/28 12:55:41 roberto Exp roberto $ 2** $Id: lcode.c,v 1.56 2001/01/15 16:13:24 roberto Exp roberto $
3** Code generator for Lua 3** Code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -189,7 +189,7 @@ void luaK_storevar (LexState *ls, const expdesc *var) {
189 luaK_code2(fs, OP_SETTABLE, 3, 3); 189 luaK_code2(fs, OP_SETTABLE, 3, 3);
190 break; 190 break;
191 default: 191 default:
192 LUA_INTERNALERROR("invalid var kind to store"); 192 lua_assert(0); /* invalid var kind to store */
193 } 193 }
194} 194}
195 195
@@ -205,7 +205,7 @@ static OpCode invertjump (OpCode op) {
205 case OP_JMPT: case OP_JMPONT: return OP_JMPF; 205 case OP_JMPT: case OP_JMPONT: return OP_JMPF;
206 case OP_JMPF: case OP_JMPONF: return OP_JMPT; 206 case OP_JMPF: case OP_JMPONF: return OP_JMPT;
207 default: 207 default:
208 LUA_INTERNALERROR("invalid jump instruction"); 208 lua_assert(0); /* invalid jump instruction */
209 return OP_JMP; /* to avoid warnings */ 209 return OP_JMP; /* to avoid warnings */
210 } 210 }
211} 211}
@@ -280,7 +280,7 @@ static void luaK_testgo (FuncState *fs, expdesc *v, int invert, OpCode jump) {
280 discharge1(fs, v); 280 discharge1(fs, v);
281 prevpos = fs->pc-1; 281 prevpos = fs->pc-1;
282 previous = &fs->f->code[prevpos]; 282 previous = &fs->f->code[prevpos];
283 LUA_ASSERT(*previous==previous_instruction(fs), "no jump allowed here"); 283 lua_assert(*previous==previous_instruction(fs)); /* no jump allowed here */
284 if (!ISJUMP(GET_OPCODE(*previous))) 284 if (!ISJUMP(GET_OPCODE(*previous)))
285 prevpos = luaK_code1(fs, jump, NO_JUMP); 285 prevpos = luaK_code1(fs, jump, NO_JUMP);
286 else { /* last instruction is already a jump */ 286 else { /* last instruction is already a jump */
@@ -398,14 +398,14 @@ void luaK_posfix (LexState *ls, BinOpr op, expdesc *v1, expdesc *v2) {
398 FuncState *fs = ls->fs; 398 FuncState *fs = ls->fs;
399 switch (op) { 399 switch (op) {
400 case OPR_AND: { 400 case OPR_AND: {
401 LUA_ASSERT(v1->u.l.t == NO_JUMP, "list must be closed"); 401 lua_assert(v1->u.l.t == NO_JUMP); /* list must be closed */
402 discharge1(fs, v2); 402 discharge1(fs, v2);
403 v1->u.l.t = v2->u.l.t; 403 v1->u.l.t = v2->u.l.t;
404 luaK_concat(fs, &v1->u.l.f, v2->u.l.f); 404 luaK_concat(fs, &v1->u.l.f, v2->u.l.f);
405 break; 405 break;
406 } 406 }
407 case OPR_OR: { 407 case OPR_OR: {
408 LUA_ASSERT(v1->u.l.f == NO_JUMP, "list must be closed"); 408 lua_assert(v1->u.l.f == NO_JUMP); /* list must be closed */
409 discharge1(fs, v2); 409 discharge1(fs, v2);
410 v1->u.l.f = v2->u.l.f; 410 v1->u.l.f = v2->u.l.f;
411 luaK_concat(fs, &v1->u.l.t, v2->u.l.t); 411 luaK_concat(fs, &v1->u.l.t, v2->u.l.t);
@@ -622,11 +622,11 @@ int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) {
622 case OP_GETINDEXED: 622 case OP_GETINDEXED:
623 case OP_TAILCALL: 623 case OP_TAILCALL:
624 case OP_ADDI: { 624 case OP_ADDI: {
625 LUA_INTERNALERROR("instruction used only for optimizations"); 625 lua_assert(0); /* instruction used only for optimizations */
626 break; 626 break;
627 } 627 }
628 default: { 628 default: {
629 LUA_ASSERT(delta != VD, "invalid delta"); 629 lua_assert(delta != VD);
630 break; 630 break;
631 } 631 }
632 } 632 }