diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-11 11:56:42 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-11 11:56:42 -0300 |
| commit | 0a1b1acdd36a3ed4e6f1cadf62eec8531a437cbf (patch) | |
| tree | f7c4e2b02380381e65fb19956ab7921bba33be97 /ldebug.c | |
| parent | 79acf5ea6083fe4aebeb24740d25ddf35654944a (diff) | |
| download | lua-0a1b1acdd36a3ed4e6f1cadf62eec8531a437cbf.tar.gz lua-0a1b1acdd36a3ed4e6f1cadf62eec8531a437cbf.tar.bz2 lua-0a1b1acdd36a3ed4e6f1cadf62eec8531a437cbf.zip | |
details about opcode parameters
Diffstat (limited to 'ldebug.c')
| -rw-r--r-- | ldebug.c | 96 |
1 files changed, 48 insertions, 48 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.80 2001/06/08 12:29:27 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.81 2001/06/08 19:00:57 roberto Exp roberto $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -349,6 +349,7 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { | |||
| 349 | int a = GETARG_A(i); | 349 | int a = GETARG_A(i); |
| 350 | int b = 0; | 350 | int b = 0; |
| 351 | int c = 0; | 351 | int c = 0; |
| 352 | checkreg(pt, a); | ||
| 352 | switch (getOpMode(op)) { | 353 | switch (getOpMode(op)) { |
| 353 | case iABC: { | 354 | case iABC: { |
| 354 | b = GETARG_B(i); | 355 | b = GETARG_B(i); |
| @@ -370,7 +371,6 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { | |||
| 370 | break; | 371 | break; |
| 371 | } | 372 | } |
| 372 | } | 373 | } |
| 373 | if (testOpMode(op, OpModeAreg)) checkreg(pt, a); | ||
| 374 | if (testOpMode(op, OpModesetA)) { | 374 | if (testOpMode(op, OpModesetA)) { |
| 375 | if (a == reg) last = pc; /* change register `a' */ | 375 | if (a == reg) last = pc; /* change register `a' */ |
| 376 | } | 376 | } |
| @@ -414,20 +414,20 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { | |||
| 414 | break; | 414 | break; |
| 415 | } | 415 | } |
| 416 | case OP_CALL: { | 416 | case OP_CALL: { |
| 417 | if (b == NO_REG) b = pt->maxstacksize; | 417 | if (b != NO_REG) { |
| 418 | checkreg(pt, a+b); | ||
| 419 | } | ||
| 418 | if (c == NO_REG) { | 420 | if (c == NO_REG) { |
| 419 | check(checkopenop(pt->code[pc+1])); | 421 | check(checkopenop(pt->code[pc+1])); |
| 420 | c = 1; | ||
| 421 | } | 422 | } |
| 422 | check(b > a); | 423 | else if (c != 0) |
| 423 | checkreg(pt, b-1); | 424 | checkreg(pt, a+c-1); |
| 424 | checkreg(pt, c-1); | ||
| 425 | if (reg >= a) last = pc; /* affect all registers above base */ | 425 | if (reg >= a) last = pc; /* affect all registers above base */ |
| 426 | break; | 426 | break; |
| 427 | } | 427 | } |
| 428 | case OP_RETURN: { | 428 | case OP_RETURN: { |
| 429 | if (b == NO_REG) b = pt->maxstacksize; | 429 | if (b != NO_REG && b != 0) |
| 430 | checkreg(pt, b-1); | 430 | checkreg(pt, a+b-1); |
| 431 | break; | 431 | break; |
| 432 | } | 432 | } |
| 433 | case OP_FORPREP: | 433 | case OP_FORPREP: |
| @@ -566,49 +566,49 @@ void luaG_ordererror (lua_State *L, const TObject *p1, const TObject *p2) { | |||
| 566 | 566 | ||
| 567 | 567 | ||
| 568 | #define opmode(t,a,b,c,sa,k,m) (((t)<<OpModeT) | \ | 568 | #define opmode(t,a,b,c,sa,k,m) (((t)<<OpModeT) | \ |
| 569 | ((a)<<OpModeAreg) | ((b)<<OpModeBreg) | ((c)<<OpModeCreg) | \ | 569 | ((b)<<OpModeBreg) | ((c)<<OpModeCreg) | \ |
| 570 | ((sa)<<OpModesetA) | ((k)<<OpModeK) | (m)) | 570 | ((sa)<<OpModesetA) | ((k)<<OpModeK) | (m)) |
| 571 | 571 | ||
| 572 | 572 | ||
| 573 | const lu_byte luaG_opmodes[] = { | 573 | const lu_byte luaG_opmodes[] = { |
| 574 | /* T A B C sA K mode opcode */ | 574 | /* T J B C sA K mode opcode */ |
| 575 | opmode(0,1,1,0, 1,0,iABC), /* OP_MOVE */ | 575 | opmode(0,0,1,0, 1,0,iABC), /* OP_MOVE */ |
| 576 | opmode(0,1,0,0, 1,1,iABc), /* OP_LOADK */ | 576 | opmode(0,0,0,0, 1,1,iABc), /* OP_LOADK */ |
| 577 | opmode(0,1,0,0, 1,0,iAsBc), /* OP_LOADINT */ | 577 | opmode(0,0,0,0, 1,0,iAsBc), /* OP_LOADINT */ |
| 578 | opmode(0,1,1,0, 1,0,iABC), /* OP_LOADNIL */ | 578 | opmode(0,0,1,0, 1,0,iABC), /* OP_LOADNIL */ |
| 579 | opmode(0,1,0,0, 1,0,iABc), /* OP_LOADUPVAL */ | 579 | opmode(0,0,0,0, 1,0,iABc), /* OP_LOADUPVAL */ |
| 580 | opmode(0,1,0,0, 1,1,iABc), /* OP_GETGLOBAL */ | 580 | opmode(0,0,0,0, 1,1,iABc), /* OP_GETGLOBAL */ |
| 581 | opmode(0,1,1,1, 1,0,iABC), /* OP_GETTABLE */ | 581 | opmode(0,0,1,1, 1,0,iABC), /* OP_GETTABLE */ |
| 582 | opmode(0,1,0,0, 0,1,iABc), /* OP_SETGLOBAL */ | 582 | opmode(0,0,0,0, 0,1,iABc), /* OP_SETGLOBAL */ |
| 583 | opmode(0,1,1,1, 0,0,iABC), /* OP_SETTABLE */ | 583 | opmode(0,0,1,1, 0,0,iABC), /* OP_SETTABLE */ |
| 584 | opmode(0,1,0,0, 1,0,iABc), /* OP_NEWTABLE */ | 584 | opmode(0,0,0,0, 1,0,iABc), /* OP_NEWTABLE */ |
| 585 | opmode(0,1,1,1, 1,0,iABC), /* OP_SELF */ | 585 | opmode(0,0,1,1, 1,0,iABC), /* OP_SELF */ |
| 586 | opmode(0,1,1,1, 1,0,iABC), /* OP_ADD */ | 586 | opmode(0,0,1,1, 1,0,iABC), /* OP_ADD */ |
| 587 | opmode(0,1,1,1, 1,0,iABC), /* OP_SUB */ | 587 | opmode(0,0,1,1, 1,0,iABC), /* OP_SUB */ |
| 588 | opmode(0,1,1,1, 1,0,iABC), /* OP_MUL */ | 588 | opmode(0,0,1,1, 1,0,iABC), /* OP_MUL */ |
| 589 | opmode(0,1,1,1, 1,0,iABC), /* OP_DIV */ | 589 | opmode(0,0,1,1, 1,0,iABC), /* OP_DIV */ |
| 590 | opmode(0,1,1,1, 1,0,iABC), /* OP_POW */ | 590 | opmode(0,0,1,1, 1,0,iABC), /* OP_POW */ |
| 591 | opmode(0,1,1,0, 1,0,iABC), /* OP_UNM */ | 591 | opmode(0,0,1,0, 1,0,iABC), /* OP_UNM */ |
| 592 | opmode(0,1,1,0, 1,0,iABC), /* OP_NOT */ | 592 | opmode(0,0,1,0, 1,0,iABC), /* OP_NOT */ |
| 593 | opmode(0,1,1,1, 1,0,iABC), /* OP_CONCAT */ | 593 | opmode(0,0,1,1, 1,0,iABC), /* OP_CONCAT */ |
| 594 | opmode(0,0,0,0, 0,0,iAsBc), /* OP_JMP */ | 594 | opmode(0,1,0,0, 0,0,iAsBc), /* OP_JMP */ |
| 595 | opmode(0,0,0,0, 0,0,iAsBc), /* OP_CJMP */ | 595 | opmode(0,1,0,0, 0,0,iAsBc), /* OP_CJMP */ |
| 596 | opmode(1,0,1,1, 0,0,iABC), /* OP_TESTEQ */ | 596 | opmode(1,0,0,1, 0,0,iABC), /* OP_TESTEQ */ |
| 597 | opmode(1,0,1,1, 0,0,iABC), /* OP_TESTNE */ | 597 | opmode(1,0,0,1, 0,0,iABC), /* OP_TESTNE */ |
| 598 | opmode(1,0,1,1, 0,0,iABC), /* OP_TESTLT */ | 598 | opmode(1,0,0,1, 0,0,iABC), /* OP_TESTLT */ |
| 599 | opmode(1,0,1,1, 0,0,iABC), /* OP_TESTLE */ | 599 | opmode(1,0,0,1, 0,0,iABC), /* OP_TESTLE */ |
| 600 | opmode(1,0,1,1, 0,0,iABC), /* OP_TESTGT */ | 600 | opmode(1,0,0,1, 0,0,iABC), /* OP_TESTGT */ |
| 601 | opmode(1,0,1,1, 0,0,iABC), /* OP_TESTGE */ | 601 | opmode(1,0,0,1, 0,0,iABC), /* OP_TESTGE */ |
| 602 | opmode(1,1,1,0, 1,0,iABC), /* OP_TESTT */ | 602 | opmode(1,0,1,0, 1,0,iABC), /* OP_TESTT */ |
| 603 | opmode(1,1,1,0, 1,0,iABC), /* OP_TESTF */ | 603 | opmode(1,0,1,0, 1,0,iABC), /* OP_TESTF */ |
| 604 | opmode(0,1,0,0, 1,0,iAsBc), /* OP_NILJMP */ | 604 | opmode(0,0,0,0, 1,0,iAsBc), /* OP_NILJMP */ |
| 605 | opmode(0,1,0,0, 0,0,iABC), /* OP_CALL */ | 605 | opmode(0,0,0,0, 0,0,iABC), /* OP_CALL */ |
| 606 | opmode(0,1,0,0, 0,0,iABC), /* OP_RETURN */ | 606 | opmode(0,0,0,0, 0,0,iABC), /* OP_RETURN */ |
| 607 | opmode(0,1,0,0, 0,0,iAsBc), /* OP_FORPREP */ | 607 | opmode(0,0,0,0, 0,0,iAsBc), /* OP_FORPREP */ |
| 608 | opmode(0,1,0,0, 0,0,iAsBc), /* OP_FORLOOP */ | 608 | opmode(0,0,0,0, 0,0,iAsBc), /* OP_FORLOOP */ |
| 609 | opmode(0,1,0,0, 0,0,iAsBc), /* OP_TFORPREP */ | 609 | opmode(0,1,0,0, 0,0,iAsBc), /* OP_TFORPREP */ |
| 610 | opmode(0,1,0,0, 0,0,iAsBc), /* OP_TFORLOOP */ | 610 | opmode(0,1,0,0, 0,0,iAsBc), /* OP_TFORLOOP */ |
| 611 | opmode(0,1,0,0, 0,0,iABc), /* OP_SETLIST */ | 611 | opmode(0,0,0,0, 0,0,iABc), /* OP_SETLIST */ |
| 612 | opmode(0,1,0,0, 0,0,iABc), /* OP_SETLIST0 */ | 612 | opmode(0,0,0,0, 0,0,iABc), /* OP_SETLIST0 */ |
| 613 | opmode(0,1,0,0, 0,0,iABc) /* OP_CLOSURE */ | 613 | opmode(0,0,0,0, 0,0,iABc) /* OP_CLOSURE */ |
| 614 | }; | 614 | }; |
