diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-03-07 10:22:55 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-03-07 10:22:55 -0300 |
| commit | 5e870f86a255988ca85eda795adc31063ec1ac70 (patch) | |
| tree | 72c428d85c63cd8930217497652bfc387a57ba83 /lcode.c | |
| parent | f81b8adb3f2738d2895511082793af622e8581d8 (diff) | |
| download | lua-5e870f86a255988ca85eda795adc31063ec1ac70.tar.gz lua-5e870f86a255988ca85eda795adc31063ec1ac70.tar.bz2 lua-5e870f86a255988ca85eda795adc31063ec1ac70.zip | |
optimization for tailcall does not seem to pay itself
Diffstat (limited to 'lcode.c')
| -rw-r--r-- | lcode.c | 12 |
1 files changed, 1 insertions, 11 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lcode.c,v 1.63 2001/02/23 17:17:25 roberto Exp roberto $ | 2 | ** $Id: lcode.c,v 1.64 2001/02/23 20:28:19 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 | */ |
| @@ -482,14 +482,6 @@ int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) { | |||
| 482 | pop = 2*arg1; | 482 | pop = 2*arg1; |
| 483 | break; | 483 | break; |
| 484 | } | 484 | } |
| 485 | case OP_RETURN: { | ||
| 486 | if (GET_OPCODE(i) == OP_CALL && GETARG_B(i) == MULT_RET) { | ||
| 487 | SET_OPCODE(i, OP_TAILCALL); | ||
| 488 | SETARG_B(i, arg1); | ||
| 489 | optm = 1; | ||
| 490 | } | ||
| 491 | break; | ||
| 492 | } | ||
| 493 | case OP_PUSHNIL: { | 485 | case OP_PUSHNIL: { |
| 494 | if (arg1 == 0) return NO_JUMP; /* nothing to do */ | 486 | if (arg1 == 0) return NO_JUMP; /* nothing to do */ |
| 495 | push = arg1; | 487 | push = arg1; |
| @@ -632,7 +624,6 @@ int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) { | |||
| 632 | } | 624 | } |
| 633 | case OP_GETDOTTED: | 625 | case OP_GETDOTTED: |
| 634 | case OP_GETINDEXED: | 626 | case OP_GETINDEXED: |
| 635 | case OP_TAILCALL: | ||
| 636 | case OP_ADDI: { | 627 | case OP_ADDI: { |
| 637 | lua_assert(0); /* instruction used only for optimizations */ | 628 | lua_assert(0); /* instruction used only for optimizations */ |
| 638 | break; | 629 | break; |
| @@ -669,7 +660,6 @@ int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2) { | |||
| 669 | const OpProperties luaK_opproperties[] = { | 660 | const OpProperties luaK_opproperties[] = { |
| 670 | {iU, 0, 0}, /* OP_RETURN */ | 661 | {iU, 0, 0}, /* OP_RETURN */ |
| 671 | {iAB, 0, 0}, /* OP_CALL */ | 662 | {iAB, 0, 0}, /* OP_CALL */ |
| 672 | {iAB, 0, 0}, /* OP_TAILCALL */ | ||
| 673 | {iU, VD, 0}, /* OP_PUSHNIL */ | 663 | {iU, VD, 0}, /* OP_PUSHNIL */ |
| 674 | {iU, 0, VD}, /* OP_POP */ | 664 | {iU, 0, VD}, /* OP_POP */ |
| 675 | {iS, 1, 0}, /* OP_PUSHINT */ | 665 | {iS, 1, 0}, /* OP_PUSHINT */ |
