From 83382cb1b46eb17f94f16fbbf05b5e471284d797 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sat, 29 Jun 2024 13:12:34 +0100 Subject: add proper tail calls --- dis.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'dis.c') diff --git a/dis.c b/dis.c index 2939384..0ca77e7 100644 --- a/dis.c +++ b/dis.c @@ -60,6 +60,11 @@ static size_t disasm_instr_h(Chunk *ch, size_t ip, int depth) { printf("call #%hhu\n",nargs); break; } + case OP_TAILCALL: { + uint8_t nargs = ch->bc.d[ip++]; + printf("\033[31mtailcall\033[0m #%hhu\n",nargs); + break; + } case OP_ENDSCOPE: { uint8_t nlocals = ch->bc.d[ip++]; printf("endscope #%hhu\n",nlocals); @@ -107,7 +112,6 @@ static size_t disasm_instr_h(Chunk *ch, size_t ip, int depth) { default: printf("unknown opcode %d\n", instr); - exit(2); } -- cgit v1.2.3