aboutsummaryrefslogtreecommitdiff
path: root/lcode.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-24 17:07:46 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-04-24 17:07:46 -0300
commit9b38a696d5ccd6dd98685a74e8762a69e8722840 (patch)
tree3d9d09465dd7977ef0692091635913aab2fd90a9 /lcode.c
parent383e8b9e778d2bed9dc4347f441803e2c4f99d09 (diff)
downloadlua-9b38a696d5ccd6dd98685a74e8762a69e8722840.tar.gz
lua-9b38a696d5ccd6dd98685a74e8762a69e8722840.tar.bz2
lua-9b38a696d5ccd6dd98685a74e8762a69e8722840.zip
avoid names that differ only in capitalization
Diffstat (limited to 'lcode.c')
-rw-r--r--lcode.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/lcode.c b/lcode.c
index 2595b958..cdac7554 100644
--- a/lcode.c
+++ b/lcode.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcode.c,v 1.95 2002/04/09 18:49:30 roberto Exp roberto $ 2** $Id: lcode.c,v 1.96 2002/04/22 14:37:09 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*/
@@ -45,7 +45,7 @@ void luaK_nil (FuncState *fs, int from, int n) {
45 45
46 46
47int luaK_jump (FuncState *fs) { 47int luaK_jump (FuncState *fs) {
48 int j = luaK_codeAsBc(fs, OP_JMP, 0, NO_JUMP); 48 int j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP);
49 if (j == fs->lasttarget) { /* possible jumps to this jump? */ 49 if (j == fs->lasttarget) { /* possible jumps to this jump? */
50 luaK_concat(fs, &j, fs->jlt); /* keep them on hold */ 50 luaK_concat(fs, &j, fs->jlt); /* keep them on hold */
51 fs->jlt = NO_JUMP; 51 fs->jlt = NO_JUMP;
@@ -56,19 +56,19 @@ int luaK_jump (FuncState *fs) {
56 56
57static int luaK_condjump (FuncState *fs, OpCode op, int A, int B, int C) { 57static int luaK_condjump (FuncState *fs, OpCode op, int A, int B, int C) {
58 luaK_codeABC(fs, op, A, B, C); 58 luaK_codeABC(fs, op, A, B, C);
59 return luaK_codeAsBc(fs, OP_JMP, 0, NO_JUMP); 59 return luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP);
60} 60}
61 61
62 62
63static void luaK_fixjump (FuncState *fs, int pc, int dest) { 63static void luaK_fixjump (FuncState *fs, int pc, int dest) {
64 Instruction *jmp = &fs->f->code[pc]; 64 Instruction *jmp = &fs->f->code[pc];
65 if (dest == NO_JUMP) 65 if (dest == NO_JUMP)
66 SETARG_sBc(*jmp, NO_JUMP); /* point to itself to represent end of list */ 66 SETARG_sBx(*jmp, NO_JUMP); /* point to itself to represent end of list */
67 else { /* jump is relative to position following jump instruction */ 67 else { /* jump is relative to position following jump instruction */
68 int offset = dest-(pc+1); 68 int offset = dest-(pc+1);
69 if (abs(offset) > MAXARG_sBc) 69 if (abs(offset) > MAXARG_sBx)
70 luaK_error(fs->ls, "control structure too long"); 70 luaK_error(fs->ls, "control structure too long");
71 SETARG_sBc(*jmp, offset); 71 SETARG_sBx(*jmp, offset);
72 } 72 }
73} 73}
74 74
@@ -90,7 +90,7 @@ int luaK_getlabel (FuncState *fs) {
90 90
91 91
92static int luaK_getjump (FuncState *fs, int pc) { 92static int luaK_getjump (FuncState *fs, int pc) {
93 int offset = GETARG_sBc(fs->f->code[pc]); 93 int offset = GETARG_sBx(fs->f->code[pc]);
94 if (offset == NO_JUMP) /* point to itself represents end of list */ 94 if (offset == NO_JUMP) /* point to itself represents end of list */
95 return NO_JUMP; /* end of list */ 95 return NO_JUMP; /* end of list */
96 else 96 else
@@ -213,7 +213,7 @@ static int addk (FuncState *fs, TObject *k, TObject *v) {
213 TObject o; 213 TObject o;
214 Proto *f = fs->f; 214 Proto *f = fs->f;
215 luaM_growvector(fs->L, f->k, fs->nk, f->sizek, TObject, 215 luaM_growvector(fs->L, f->k, fs->nk, f->sizek, TObject,
216 MAXARG_Bc, "constant table overflow"); 216 MAXARG_Bx, "constant table overflow");
217 setobj(&f->k[fs->nk], v); 217 setobj(&f->k[fs->nk], v);
218 setnvalue(&o, fs->nk); 218 setnvalue(&o, fs->nk);
219 luaH_set(fs->L, fs->h, k, &o); 219 luaH_set(fs->L, fs->h, k, &o);
@@ -267,7 +267,7 @@ void luaK_dischargevars (FuncState *fs, expdesc *e) {
267 break; 267 break;
268 } 268 }
269 case VGLOBAL: { 269 case VGLOBAL: {
270 e->info = luaK_codeABc(fs, OP_GETGLOBAL, 0, e->info); 270 e->info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->info);
271 e->k = VRELOCABLE; 271 e->k = VRELOCABLE;
272 break; 272 break;
273 } 273 }
@@ -305,7 +305,7 @@ static void discharge2reg (FuncState *fs, expdesc *e, int reg) {
305 break; 305 break;
306 } 306 }
307 case VK: { 307 case VK: {
308 luaK_codeABc(fs, OP_LOADK, reg, e->info); 308 luaK_codeABx(fs, OP_LOADK, reg, e->info);
309 break; 309 break;
310 } 310 }
311 case VRELOCABLE: { 311 case VRELOCABLE: {
@@ -347,7 +347,7 @@ static void luaK_exp2reg (FuncState *fs, expdesc *e, int reg) {
347 /* expression needs values */ 347 /* expression needs values */
348 if (e->k != VJMP) { 348 if (e->k != VJMP) {
349 luaK_getlabel(fs); /* these instruction may be jump target */ 349 luaK_getlabel(fs); /* these instruction may be jump target */
350 luaK_codeAsBc(fs, OP_JMP, 0, 2); /* to jump over both pushes */ 350 luaK_codeAsBx(fs, OP_JMP, 0, 2); /* to jump over both pushes */
351 } 351 }
352 else { /* last expression is a conditional (test + jump) */ 352 else { /* last expression is a conditional (test + jump) */
353 fs->pc--; /* remove its jump */ 353 fs->pc--; /* remove its jump */
@@ -433,7 +433,7 @@ void luaK_storevar (FuncState *fs, expdesc *var, expdesc *exp) {
433 } 433 }
434 case VGLOBAL: { 434 case VGLOBAL: {
435 int e = luaK_exp2anyreg(fs, exp); 435 int e = luaK_exp2anyreg(fs, exp);
436 luaK_codeABc(fs, OP_SETGLOBAL, e, var->info); 436 luaK_codeABx(fs, OP_SETGLOBAL, e, var->info);
437 break; 437 break;
438 } 438 }
439 case VINDEXED: { 439 case VINDEXED: {
@@ -509,7 +509,7 @@ void luaK_goiftrue (FuncState *fs, expdesc *e) {
509 break; 509 break;
510 } 510 }
511 case VFALSE: { 511 case VFALSE: {
512 pc = luaK_codeAsBc(fs, OP_JMP, 0, NO_JUMP); /* always jump */ 512 pc = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); /* always jump */
513 break; 513 break;
514 } 514 }
515 case VJMP: { 515 case VJMP: {
@@ -537,7 +537,7 @@ static void luaK_goiffalse (FuncState *fs, expdesc *e) {
537 break; 537 break;
538 } 538 }
539 case VTRUE: { 539 case VTRUE: {
540 pc = luaK_codeAsBc(fs, OP_JMP, 0, NO_JUMP); /* always jump */ 540 pc = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); /* always jump */
541 break; 541 break;
542 } 542 }
543 case VJMP: { 543 case VJMP: {
@@ -739,8 +739,8 @@ int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) {
739} 739}
740 740
741 741
742int luaK_codeABc (FuncState *fs, OpCode o, int a, unsigned int bc) { 742int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) {
743 lua_assert(getOpMode(o) == iABc || getOpMode(o) == iAsBc); 743 lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx);
744 return luaK_code(fs, CREATE_ABc(o, a, bc)); 744 return luaK_code(fs, CREATE_ABx(o, a, bc));
745} 745}
746 746