summaryrefslogtreecommitdiff
path: root/dis.c
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-06-29 13:12:34 +0100
committerubq323 <ubq323@ubq323.website>2024-06-29 13:12:34 +0100
commit83382cb1b46eb17f94f16fbbf05b5e471284d797 (patch)
tree73e8124725984a8c883c158ae50e61693924df9f /dis.c
parentb51136defc2898c868e4a1b60025d5bb57347662 (diff)
add proper tail calls
Diffstat (limited to 'dis.c')
-rw-r--r--dis.c6
1 files changed, 5 insertions, 1 deletions
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);
}