diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-03-22 13:54:31 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-03-22 13:54:31 -0300 |
| commit | 00af2faae71e6388ee61ef18b2c5902a42e9bc27 (patch) | |
| tree | 9aa58a3fb85e9ba665578bbb6c669ef3149ef56e /ldebug.c | |
| parent | e9ef7ed2d3015ff6083ae51995b153b88837b64d (diff) | |
| download | lua-00af2faae71e6388ee61ef18b2c5902a42e9bc27.tar.gz lua-00af2faae71e6388ee61ef18b2c5902a42e9bc27.tar.bz2 lua-00af2faae71e6388ee61ef18b2c5902a42e9bc27.zip | |
first implementation of proper tail call
Diffstat (limited to 'ldebug.c')
| -rw-r--r-- | ldebug.c | 4 |
1 files changed, 3 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.102 2002/03/11 12:45:00 roberto Exp roberto $ | 2 | ** $Id: ldebug.c,v 1.103 2002/03/19 12:45:25 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 | */ |
| @@ -296,6 +296,7 @@ static int checkopenop (const Proto *pt, int pc) { | |||
| 296 | Instruction i = pt->code[pc+1]; | 296 | Instruction i = pt->code[pc+1]; |
| 297 | switch (GET_OPCODE(i)) { | 297 | switch (GET_OPCODE(i)) { |
| 298 | case OP_CALL: | 298 | case OP_CALL: |
| 299 | case OP_TAILCALL: | ||
| 299 | case OP_RETURN: { | 300 | case OP_RETURN: { |
| 300 | check(GETARG_B(i) == 0); | 301 | check(GETARG_B(i) == 0); |
| 301 | return 1; | 302 | return 1; |
| @@ -405,6 +406,7 @@ static Instruction luaG_symbexec (const Proto *pt, int lastpc, int reg) { | |||
| 405 | if (reg >= a) last = pc; /* affect all registers above base */ | 406 | if (reg >= a) last = pc; /* affect all registers above base */ |
| 406 | break; | 407 | break; |
| 407 | } | 408 | } |
| 409 | case OP_TAILCALL: | ||
| 408 | case OP_RETURN: { | 410 | case OP_RETURN: { |
| 409 | b--; /* b = num. returns */ | 411 | b--; /* b = num. returns */ |
| 410 | if (b > 0) checkreg(pt, a+b-1); | 412 | if (b > 0) checkreg(pt, a+b-1); |
