aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lopcodes.h30
-rw-r--r--lua.stx114
-rw-r--r--lvm.c85
3 files changed, 145 insertions, 84 deletions
diff --git a/lopcodes.h b/lopcodes.h
index 7ba79e25..e1b95122 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lopcodes.h,v 1.3 1997/09/19 21:17:52 roberto Exp roberto $ 2** $Id: lopcodes.h,v 1.4 1997/09/22 20:53:20 roberto Exp roberto $
3** Opcodes for Lua virtual machine 3** Opcodes for Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -29,10 +29,21 @@ PUSH2,/* - 2.0 */
29PUSHBYTE,/* b - (float)b */ 29PUSHBYTE,/* b - (float)b */
30PUSHWORD,/* w - (float)w */ 30PUSHWORD,/* w - (float)w */
31 31
32PUSHCONSTANT0,/* - CNST[0] */
33PUSHCONSTANT1,/* - CNST[1] */
34PUSHCONSTANT2,/* - CNST[2] */
35PUSHCONSTANT3,/* - CNST[3] */
36PUSHCONSTANT4,/* - CNST[4] */
37PUSHCONSTANT5,/* - CNST[5] */
38PUSHCONSTANT6,/* - CNST[6] */
39PUSHCONSTANT7,/* - CNST[7] */
40PUSHCONSTANT8,/* - CNST[8] */
41PUSHCONSTANT9,/* - CNST[9] */
32PUSHCONSTANTB,/*b - CNST[b] */ 42PUSHCONSTANTB,/*b - CNST[b] */
33PUSHCONSTANT,/* w - CNST[w] */ 43PUSHCONSTANT,/* w - CNST[w] */
34 44
35PUSHUPVALUE0, 45PUSHUPVALUE0,
46PUSHUPVALUE1,
36PUSHUPVALUE,/* b - Closure[b] */ 47PUSHUPVALUE,/* b - Closure[b] */
37 48
38PUSHLOCAL0,/* - LOC[0] */ 49PUSHLOCAL0,/* - LOC[0] */
@@ -47,6 +58,16 @@ PUSHLOCAL8,/* - LOC[8] */
47PUSHLOCAL9,/* - LOC[9] */ 58PUSHLOCAL9,/* - LOC[9] */
48PUSHLOCAL,/* b - LOC[b] */ 59PUSHLOCAL,/* b - LOC[b] */
49 60
61GETGLOBAL0,/* - VAR[CNST[0]] */
62GETGLOBAL1,/* - VAR[CNST[1]] */
63GETGLOBAL2,/* - VAR[CNST[2]] */
64GETGLOBAL3,/* - VAR[CNST[3]] */
65GETGLOBAL4,/* - VAR[CNST[4]] */
66GETGLOBAL5,/* - VAR[CNST[5]] */
67GETGLOBAL6,/* - VAR[CNST[6]] */
68GETGLOBAL7,/* - VAR[CNST[7]] */
69GETGLOBAL8,/* - VAR[CNST[8]] */
70GETGLOBAL9,/* - VAR[CNST[9]] */
50GETGLOBALB,/* b - VAR[CNST[b]] */ 71GETGLOBALB,/* b - VAR[CNST[b]] */
51GETGLOBAL,/* w - VAR[CNST[w]] */ 72GETGLOBAL,/* w - VAR[CNST[w]] */
52 73
@@ -94,11 +115,14 @@ CONCOP,/* y x x..y */
94MINUSOP,/* x -x */ 115MINUSOP,/* x -x */
95NOTOP,/* x (x==nil)? 1 : nil */ 116NOTOP,/* x (x==nil)? 1 : nil */
96 117
97ONTJMP,/* w x (x!=nil)? x : - (x!=nil)? PC+=w */ 118/* NOTICE: all jumps are relative to the position following the opcode */
98ONFJMP,/* w x (x==nil)? x : - (x==nil)? PC+=w */ 119ONTJMP,/* b x (x!=nil)? x : - (x!=nil)? PC+=b */
120ONFJMP,/* b x (x==nil)? x : - (x==nil)? PC+=b */
99JMP,/* w - - PC+=w */ 121JMP,/* w - - PC+=w */
122UPJMPB,/* b - - PC-=b */
100UPJMP,/* w - - PC-=w */ 123UPJMP,/* w - - PC-=w */
101IFFJMP,/* w x - (x==nil)? PC+=w */ 124IFFJMP,/* w x - (x==nil)? PC+=w */
125IFFUPJMPB,/* b x - (x==nil)? PC-=b */
102IFFUPJMP,/* w x - (x==nil)? PC-=w */ 126IFFUPJMP,/* w x - (x==nil)? PC-=w */
103 127
104CLOSUREB,/* b v_1...v_n c(CNST[b]) */ 128CLOSUREB,/* b v_1...v_n c(CNST[b]) */
diff --git a/lua.stx b/lua.stx
index c7d90e20..dfb80ce3 100644
--- a/lua.stx
+++ b/lua.stx
@@ -1,6 +1,6 @@
1%{ 1%{
2/* 2/*
3** $Id: lua.stx,v 1.3 1997/09/19 21:17:52 roberto Exp roberto $ 3** $Id: lua.stx,v 1.4 1997/09/22 20:53:20 roberto Exp roberto $
4** Syntax analizer and code generator 4** Syntax analizer and code generator
5** See Copyright Notice in lua.h 5** See Copyright Notice in lua.h
6*/ 6*/
@@ -96,15 +96,24 @@ static void code_byte (Byte c)
96 96
97static void code_word_at (int pc, int n) 97static void code_word_at (int pc, int n)
98{ 98{
99 Word w = n; 99 if (n > MAX_WORD)
100 if (w != n) 100 luaY_error("construction too big; unable to compile");
101 luaY_error("block too big");
102 currState->f->code[pc] = n&0xFF; 101 currState->f->code[pc] = n&0xFF;
103 currState->f->code[pc+1] = n>>8; 102 currState->f->code[pc+1] = n>>8;
104} 103}
105 104
105
106static void fix_jump (int pc, OpCode op, int n)
107{
108 currState->f->code[pc] = op;
109 code_word_at(pc+1, n);
110}
111
112
106static void code_word (int n) 113static void code_word (int n)
107{ 114{
115 if (n > MAX_WORD)
116 luaY_error("construction too big; unable to compile");
108 code_byte(n&0xFF); 117 code_byte(n&0xFF);
109 code_byte(n>>8); 118 code_byte(n>>8);
110} 119}
@@ -128,16 +137,25 @@ static void code_opcode (OpCode op, int delta)
128} 137}
129 138
130 139
131static void code_opborw(OpCode opbyte, int arg, int delta) 140static void code_opb (OpCode opbyte, int arg, int delta)
132{ 141{
133 if (arg <= 255) { 142 code_opcode(opbyte, delta);
134 code_opcode(opbyte, delta); 143 code_byte(arg);
135 code_byte(arg); 144}
136 } 145
137 else { 146static void code_opw (OpCode opbyte, int arg, int delta)
138 code_opcode(opbyte+1, delta); 147{
139 code_word(arg); 148 code_opcode(opbyte, delta);
140 } 149 code_word(arg);
150}
151
152
153static void code_opborw (OpCode opbyte, int arg, int delta)
154{
155 if (arg <= 255)
156 code_opb(opbyte, arg, delta);
157 else
158 code_opw(opbyte+1, arg, delta);
141} 159}
142 160
143 161
@@ -167,7 +185,7 @@ static void code_pop (OpCode op)
167 185
168static void code_constant (int c) 186static void code_constant (int c)
169{ 187{
170 code_opborw(PUSHCONSTANTB, c, 1); 188 code_oparg(PUSHCONSTANT0, PUSHCONSTANTB, c, 1);
171} 189}
172 190
173 191
@@ -235,9 +253,8 @@ static void code_number (real f)
235 253
236static void flush_record (int n) 254static void flush_record (int n)
237{ 255{
238 if (n == 0) return; 256 if (n > 0)
239 code_opcode(SETMAP, -2*n); 257 code_opb(SETMAP, n, -2*n);
240 code_byte(n);
241} 258}
242 259
243static void flush_list (int m, int n) 260static void flush_list (int m, int n)
@@ -245,10 +262,8 @@ static void flush_list (int m, int n)
245 if (n == 0) return; 262 if (n == 0) return;
246 if (m == 0) 263 if (m == 0)
247 code_opcode(SETLIST0, -n); 264 code_opcode(SETLIST0, -n);
248 else if (m < 255) { 265 else if (m < 255)
249 code_opcode(SETLIST, -n); 266 code_opb(SETLIST, m, -n);
250 code_byte(m);
251 }
252 else 267 else
253 luaY_error("list constructor too long"); 268 luaY_error("list constructor too long");
254 code_byte(n); 269 code_byte(n);
@@ -352,8 +367,7 @@ void luaY_codedebugline (int line)
352{ 367{
353 static int lastline = 0; 368 static int lastline = 0;
354 if (lua_debug && line != lastline) { 369 if (lua_debug && line != lastline) {
355 code_neutralop(SETLINE); 370 code_opw(SETLINE, line, 0);
356 code_word(line);
357 lastline = line; 371 lastline = line;
358 } 372 }
359} 373}
@@ -399,13 +413,10 @@ static void adjust_mult_assign (int vars, long exps)
399 413
400static void code_args (int dots) 414static void code_args (int dots)
401{ 415{
402 if (!dots) { 416 if (!dots)
403 code_opcode(ARGS, currState->nlocalvar); 417 code_opb(ARGS, currState->nlocalvar, currState->nlocalvar);
404 code_byte(currState->nlocalvar);
405 }
406 else { 418 else {
407 code_opcode(VARARGS, currState->nlocalvar+1); 419 code_opb(VARARGS, currState->nlocalvar, currState->nlocalvar+1);
408 code_byte(currState->nlocalvar);
409 add_localvar(luaS_new("arg")); 420 add_localvar(luaS_new("arg"));
410 } 421 }
411} 422}
@@ -414,7 +425,7 @@ static void code_args (int dots)
414static void lua_pushvar (vardesc number) 425static void lua_pushvar (vardesc number)
415{ 426{
416 if (number > 0) /* global var */ 427 if (number > 0) /* global var */
417 code_opborw(GETGLOBALB, number-1, 1); 428 code_oparg(GETGLOBAL0, GETGLOBALB, number-1, 1);
418 else if (number < 0) /* local var */ 429 else if (number < 0) /* local var */
419 code_oparg(PUSHLOCAL0, PUSHLOCAL, (-number)-1, 1); 430 code_oparg(PUSHLOCAL0, PUSHLOCAL, (-number)-1, 1);
420 else 431 else
@@ -456,19 +467,19 @@ static void codeIf (int thenAdd, int elseAdd)
456 currState->pc -= sizeof(Word)+1; 467 currState->pc -= sizeof(Word)+1;
457 elseinit = currState->pc; 468 elseinit = currState->pc;
458 } 469 }
459 else { 470 else
460 currState->f->code[elseAdd] = JMP; 471 fix_jump(elseAdd, JMP, currState->pc-(elseAdd+1));
461 code_word_at(elseAdd+1, currState->pc-elseinit); 472 fix_jump(thenAdd, IFFJMP, elseinit-(thenAdd+1));
462 }
463 currState->f->code[thenAdd] = IFFJMP;
464 code_word_at(thenAdd+1, elseinit-(thenAdd+sizeof(Word)+1));
465} 473}
466 474
467 475
468static void code_shortcircuit (int pc, Byte jmp) 476static void code_shortcircuit (OpCode op, int pos)
469{ 477{
470 currState->f->code[pc] = jmp; 478 int dist = currState->pc - (pos+1);
471 code_word_at(pc+1, currState->pc - (pc + sizeof(Word)+1)); 479 if (dist > 255)
480 luaY_error("and/or expression too long");
481 currState->f->code[pos] = op;
482 currState->f->code[pos+1] = dist;
472} 483}
473 484
474 485
@@ -582,7 +593,7 @@ TProtoFunc *luaY_parser (ZIO *z, char *chunkname)
582%token <vReal> NUMBER 593%token <vReal> NUMBER
583%token <pTStr> NAME STRING 594%token <pTStr> NAME STRING
584 595
585%type <vInt> PrepJump, PrepJumpPop 596%type <vInt> PrepJump, PrepJumpPop, PrepJumpSC
586%type <vLong> exprlist, exprlist1 /* if > 0, points to function return 597%type <vLong> exprlist, exprlist1 /* if > 0, points to function return
587 counter (which has list length); if <= 0, -list lenght */ 598 counter (which has list length); if <= 0, -list lenght */
588%type <vLong> functioncall, expr /* if != 0, points to function return 599%type <vLong> functioncall, expr /* if != 0, points to function return
@@ -620,18 +631,15 @@ sc : /* empty */ | ';' ;
620stat : IF expr1 THEN PrepJumpPop block PrepJump elsepart END 631stat : IF expr1 THEN PrepJumpPop block PrepJump elsepart END
621 { codeIf($4, $6); } 632 { codeIf($4, $6); }
622 633
623 | WHILE {$<vInt>$=currState->pc;} expr1 DO PrepJumpPop block PrepJump END 634 | WHILE {$<vInt>$=currState->pc;} expr1 DO PrepJumpPop block END
624 { 635 {
625 currState->f->code[$5] = IFFJMP; 636 code_opborw(UPJMPB, currState->pc+1 - ($<vInt>2), 0);
626 code_word_at($5+1, currState->pc - ($5+sizeof(Word)+1)); 637 fix_jump($5, IFFJMP, currState->pc - ($5+1));
627 currState->f->code[$7] = UPJMP;
628 code_word_at($7+1, currState->pc - ($<vInt>2));
629 } 638 }
630 639
631 | REPEAT {$<vInt>$=currState->pc;} block UNTIL expr1 PrepJumpPop 640 | REPEAT {$<vInt>$=currState->pc;} block UNTIL expr1
632 { 641 {
633 currState->f->code[$6] = IFFUPJMP; 642 code_opborw(IFFUPJMPB, currState->pc+1 - ($<vInt>2), -1);
634 code_word_at($6+1, currState->pc - ($<vInt>2));
635 } 643 }
636 644
637 | varlist1 '=' exprlist1 645 | varlist1 '=' exprlist1
@@ -699,6 +707,10 @@ PrepJump : /* empty */
699 } 707 }
700 ; 708 ;
701 709
710PrepJumpSC : /* empty */
711 { $$ = currState->pc; code_opcode(0, -1); code_byte(0); }
712 ;
713
702PrepJumpPop : PrepJump { $$ = $1; deltastack(-1); /* pop condition */ } 714PrepJumpPop : PrepJump { $$ = $1; deltastack(-1); /* pop condition */ }
703 ; 715 ;
704 716
@@ -726,13 +738,13 @@ expr : '(' expr ')' { $$ = $2; }
726 | STRING { code_string($1); $$ = 0; } 738 | STRING { code_string($1); $$ = 0; }
727 | NIL {code_opcode(PUSHNIL, 1); $$ = 0; } 739 | NIL {code_opcode(PUSHNIL, 1); $$ = 0; }
728 | functioncall { $$ = $1; } 740 | functioncall { $$ = $1; }
729 | expr1 AND PrepJumpPop expr1 { code_shortcircuit($3, ONFJMP); $$ = 0; }
730 | expr1 OR PrepJumpPop expr1 { code_shortcircuit($3, ONTJMP); $$ = 0; }
731 | FUNCTION { init_func(); } body { func_onstack($3); $$ = 0; } 741 | FUNCTION { init_func(); } body { func_onstack($3); $$ = 0; }
742 | expr1 AND PrepJumpSC expr1 { code_shortcircuit(ONFJMP, $3); $$ = 0; }
743 | expr1 OR PrepJumpSC expr1 { code_shortcircuit(ONTJMP, $3); $$ = 0; }
732 ; 744 ;
733 745
734table : 746table :
735 { code_opcode(CREATEARRAY, 1); $<vInt>$ = currState->pc; code_word(0); } 747 { $<vInt>$ = currState->pc+1; code_opw(CREATEARRAY, 0, 1); }
736 '{' fieldlist '}' 748 '{' fieldlist '}'
737 { code_word_at($<vInt>1, $3); } 749 { code_word_at($<vInt>1, $3); }
738 ; 750 ;
diff --git a/lvm.c b/lvm.c
index 90237f14..5b7971c6 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.3 1997/09/19 21:17:52 roberto Exp roberto $ 2** $Id: lvm.c,v 1.4 1997/09/22 20:53:20 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -22,9 +22,9 @@
22#include "lvm.h" 22#include "lvm.h"
23 23
24 24
25#define get_prevword(pc) (*(pc-2)+(*(pc-1)<<8)) 25#define skip_word(pc) (pc+=2)
26#define get_word(pc) (pc+=2, get_prevword(pc)) 26#define get_word(pc) (*(pc)+(*((pc)+1)<<8))
27#define skip_word(pc) {pc+=2;} 27#define next_word(pc) (pc+=2, get_word(pc-2))
28 28
29 29
30/* Extra stack to run a function: LUA_T_LINE(1), TM calls(2), ... */ 30/* Extra stack to run a function: LUA_T_LINE(1), TM calls(2), ... */
@@ -300,7 +300,7 @@ StkId luaV_execute (Closure *cl, StkId base)
300 aux = *pc++; goto pushnumber; 300 aux = *pc++; goto pushnumber;
301 301
302 case PUSHWORD: 302 case PUSHWORD:
303 aux = get_word(pc); goto pushnumber; 303 aux = next_word(pc); goto pushnumber;
304 304
305 case PUSH0: case PUSH1: case PUSH2: 305 case PUSH0: case PUSH1: case PUSH2:
306 aux -= PUSH0; 306 aux -= PUSH0;
@@ -323,10 +323,16 @@ StkId luaV_execute (Closure *cl, StkId base)
323 break; 323 break;
324 324
325 case GETGLOBAL: 325 case GETGLOBAL:
326 aux = get_word(pc); goto getglobal; 326 aux = next_word(pc); goto getglobal;
327 327
328 case GETGLOBALB: 328 case GETGLOBALB:
329 aux = *pc++; 329 aux = *pc++; goto getglobal;
330
331 case GETGLOBAL0: case GETGLOBAL1: case GETGLOBAL2:
332 case GETGLOBAL3: case GETGLOBAL4: case GETGLOBAL5:
333 case GETGLOBAL6: case GETGLOBAL7: case GETGLOBAL8:
334 case GETGLOBAL9:
335 aux -= GETGLOBAL0;
330 getglobal: 336 getglobal:
331 luaV_getglobal(luaG_findsymbol(tsvalue(&consts[aux]))); 337 luaV_getglobal(luaG_findsymbol(tsvalue(&consts[aux])));
332 break; 338 break;
@@ -336,7 +342,7 @@ StkId luaV_execute (Closure *cl, StkId base)
336 break; 342 break;
337 343
338 case PUSHSELF: 344 case PUSHSELF:
339 aux = get_word(pc); goto pushself; 345 aux = next_word(pc); goto pushself;
340 346
341 case PUSHSELFB: 347 case PUSHSELFB:
342 aux = *pc++; 348 aux = *pc++;
@@ -349,10 +355,16 @@ StkId luaV_execute (Closure *cl, StkId base)
349 } 355 }
350 356
351 case PUSHCONSTANT: 357 case PUSHCONSTANT:
352 aux = get_word(pc); goto pushconstant; 358 aux = next_word(pc); goto pushconstant;
353 359
354 case PUSHCONSTANTB: 360 case PUSHCONSTANTB:
355 aux = *pc++; 361 aux = *pc++; goto pushconstant;
362
363 case PUSHCONSTANT0: case PUSHCONSTANT1: case PUSHCONSTANT2:
364 case PUSHCONSTANT3: case PUSHCONSTANT4: case PUSHCONSTANT5:
365 case PUSHCONSTANT6: case PUSHCONSTANT7: case PUSHCONSTANT8:
366 case PUSHCONSTANT9:
367 aux -= PUSHCONSTANT0;
356 pushconstant: 368 pushconstant:
357 *luaD_stack.top++ = consts[aux]; 369 *luaD_stack.top++ = consts[aux];
358 break; 370 break;
@@ -360,8 +372,8 @@ StkId luaV_execute (Closure *cl, StkId base)
360 case PUSHUPVALUE: 372 case PUSHUPVALUE:
361 aux = *pc++; goto pushupvalue; 373 aux = *pc++; goto pushupvalue;
362 374
363 case PUSHUPVALUE0: 375 case PUSHUPVALUE0: case PUSHUPVALUE1:
364 aux = 0; 376 aux -= PUSHUPVALUE0;
365 pushupvalue: 377 pushupvalue:
366 *luaD_stack.top++ = cl->consts[aux+1]; 378 *luaD_stack.top++ = cl->consts[aux+1];
367 break; 379 break;
@@ -379,7 +391,7 @@ StkId luaV_execute (Closure *cl, StkId base)
379 break; 391 break;
380 392
381 case SETGLOBAL: 393 case SETGLOBAL:
382 aux = get_word(pc); goto setglobal; 394 aux = next_word(pc); goto setglobal;
383 395
384 case SETGLOBALB: 396 case SETGLOBALB:
385 aux = *pc++; 397 aux = *pc++;
@@ -442,7 +454,7 @@ StkId luaV_execute (Closure *cl, StkId base)
442 454
443 case CREATEARRAY: 455 case CREATEARRAY:
444 luaC_checkGC(); 456 luaC_checkGC();
445 avalue(luaD_stack.top) = luaH_new(get_word(pc)); 457 avalue(luaD_stack.top) = luaH_new(next_word(pc));
446 ttype(luaD_stack.top) = LUA_T_ARRAY; 458 ttype(luaD_stack.top) = LUA_T_ARRAY;
447 luaD_stack.top++; 459 luaD_stack.top++;
448 break; 460 break;
@@ -554,45 +566,58 @@ StkId luaV_execute (Closure *cl, StkId base)
554 break; 566 break;
555 567
556 case ONTJMP: 568 case ONTJMP:
557 skip_word(pc);
558 if (ttype(luaD_stack.top-1) != LUA_T_NIL) 569 if (ttype(luaD_stack.top-1) != LUA_T_NIL)
559 pc += get_prevword(pc); 570 pc += *pc;
560 else 571 else {
572 pc++;
561 luaD_stack.top--; 573 luaD_stack.top--;
574 }
562 break; 575 break;
563 576
564 case ONFJMP: 577 case ONFJMP:
565 skip_word(pc);
566 if (ttype(luaD_stack.top-1) == LUA_T_NIL) 578 if (ttype(luaD_stack.top-1) == LUA_T_NIL)
567 pc += get_prevword(pc); 579 pc += *pc;
568 else 580 else {
581 pc++;
569 luaD_stack.top--; 582 luaD_stack.top--;
583 }
570 break; 584 break;
571 585
572 case JMP: 586 case JMP:
573 skip_word(pc); 587 pc += get_word(pc);
574 pc += get_prevword(pc); 588 break;
589
590 case UPJMPB:
591 pc -= *pc;
575 break; 592 break;
576 593
577 case UPJMP: 594 case UPJMP:
578 skip_word(pc); 595 pc -= get_word(pc);
579 pc -= get_prevword(pc);
580 break; 596 break;
581 597
582 case IFFJMP: 598 case IFFJMP:
583 skip_word(pc);
584 if (ttype(--luaD_stack.top) == LUA_T_NIL) 599 if (ttype(--luaD_stack.top) == LUA_T_NIL)
585 pc += get_prevword(pc); 600 pc += get_word(pc);
601 else
602 skip_word(pc);
603 break;
604
605 case IFFUPJMPB:
606 if (ttype(--luaD_stack.top) == LUA_T_NIL)
607 pc -= *pc;
608 else
609 pc++;
586 break; 610 break;
587 611
588 case IFFUPJMP: 612 case IFFUPJMP:
589 skip_word(pc);
590 if (ttype(--luaD_stack.top) == LUA_T_NIL) 613 if (ttype(--luaD_stack.top) == LUA_T_NIL)
591 pc -= get_prevword(pc); 614 pc -= get_word(pc);
615 else
616 skip_word(pc);
592 break; 617 break;
593 618
594 case CLOSURE: 619 case CLOSURE:
595 aux = get_word(pc); goto closure; 620 aux = next_word(pc); goto closure;
596 621
597 case CLOSUREB: 622 case CLOSUREB:
598 aux = *pc++; 623 aux = *pc++;
@@ -617,7 +642,7 @@ StkId luaV_execute (Closure *cl, StkId base)
617 return (base + ((aux==RETCODE) ? *pc : 0)); 642 return (base + ((aux==RETCODE) ? *pc : 0));
618 643
619 case SETLINE: { 644 case SETLINE: {
620 int line = get_word(pc); 645 int line = next_word(pc);
621 if ((luaD_stack.stack+base-1)->ttype != LUA_T_LINE) { 646 if ((luaD_stack.stack+base-1)->ttype != LUA_T_LINE) {
622 /* open space for LINE value */ 647 /* open space for LINE value */
623 luaD_openstack((luaD_stack.top-luaD_stack.stack)-base); 648 luaD_openstack((luaD_stack.top-luaD_stack.stack)-base);