Skip to content

Commit 6127561

Browse files
committed
update lua55
1 parent 39faf5b commit 6127561

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

3rd/lua55/luac.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,8 @@ static void PrintCode(const Proto* f)
347347
int bx=GETARG_Bx(i);
348348
int sb=GETARG_sB(i);
349349
int sc=GETARG_sC(i);
350+
int vb=GETARG_vB(i);
351+
int vc=GETARG_vC(i);
350352
int sbx=GETARG_sBx(i);
351353
int isk=GETARG_k(i);
352354
int line=luaG_getfuncline(f,pc);
@@ -428,8 +430,8 @@ static void PrintCode(const Proto* f)
428430
if (isk) { printf(" "); PrintConstant(f,c); }
429431
break;
430432
case OP_NEWTABLE:
431-
printf("%d %d %d",a,b,c);
432-
printf(COMMENT "%d",c+EXTRAARGC);
433+
printf("%d %d %d%s",a,vb,vc,ISK);
434+
printf(COMMENT "%d",vc+EXTRAARGC);
433435
break;
434436
case OP_SELF:
435437
printf("%d %d %d%s",a,b,c,ISK);
@@ -478,10 +480,10 @@ static void PrintCode(const Proto* f)
478480
printf("%d %d %d",a,b,c);
479481
printf(COMMENT); PrintConstant(f,c);
480482
break;
481-
case OP_SHRI:
483+
case OP_SHLI:
482484
printf("%d %d %d",a,b,sc);
483485
break;
484-
case OP_SHLI:
486+
case OP_SHRI:
485487
printf("%d %d %d",a,b,sc);
486488
break;
487489
case OP_ADD:
@@ -633,18 +635,26 @@ static void PrintCode(const Proto* f)
633635
printf(COMMENT "to %d",pc-bx+2);
634636
break;
635637
case OP_SETLIST:
636-
printf("%d %d %d",a,b,c);
638+
printf("%d %d %d%s",a,vb,vc,ISK);
637639
if (isk) printf(COMMENT "%d",c+EXTRAARGC);
638640
break;
639641
case OP_CLOSURE:
640642
printf("%d %d",a,bx);
641643
printf(COMMENT "%p",VOID(f->p[bx]));
642644
break;
643645
case OP_VARARG:
644-
printf("%d %d",a,c);
646+
printf("%d %d %d%s",a,b,c,ISK);
645647
printf(COMMENT);
646648
if (c==0) printf("all out"); else printf("%d out",c-1);
647649
break;
650+
case OP_GETVARG:
651+
printf("%d %d %d",a,b,c);
652+
break;
653+
case OP_ERRNNIL:
654+
printf("%d %d",a,bx);
655+
printf(COMMENT);
656+
if (bx==0) printf("?"); else PrintConstant(f,bx-1);
657+
break;
648658
case OP_VARARGPREP:
649659
printf("%d",a);
650660
break;
@@ -662,7 +672,6 @@ static void PrintCode(const Proto* f)
662672
}
663673
}
664674

665-
666675
#define SS(x) ((x==1)?"":"s")
667676
#define S(x) (int)(x),SS(x)
668677

@@ -680,7 +689,7 @@ static void PrintHeader(const Proto* f)
680689
f->linedefined,f->lastlinedefined,
681690
S(f->sizecode),VOID(f));
682691
printf("%d%s param%s, %d slot%s, %d upvalue%s, ",
683-
(int)(f->numparams),(f->flag & PF_ISVARARG)?"+":"",SS(f->numparams),
692+
(int)(f->numparams),isvararg(f)?"+":"",SS(f->numparams),
684693
S(f->maxstacksize),S(f->sizeupvalues));
685694
printf("%d local%s, %d constant%s, %d function%s\n",
686695
S(f->sizelocvars),S(f->sizek),S(f->sizep));

0 commit comments

Comments
 (0)