diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -194,6 +194,19 @@ process_file(Str path) { | |||
194 | Instruction halt = (Instruction){.op = OP_HALT, .dst = res_reg}; | 194 | Instruction halt = (Instruction){.op = OP_HALT, .dst = res_reg}; |
195 | array_push(chunk.code, halt, &bytecode_arena); | 195 | array_push(chunk.code, halt, &bytecode_arena); |
196 | 196 | ||
197 | if (chunk.const_idx >= 256) { | ||
198 | eprintln("too many constants on chunk %s", chunk.id); | ||
199 | exit(EXIT_FAILURE); | ||
200 | } | ||
201 | if (chunk.str_idx >= 256) { | ||
202 | eprintln("too many strings on chunk %s", chunk.id); | ||
203 | exit(EXIT_FAILURE); | ||
204 | } | ||
205 | if (chunk.reg_idx >= 256) { | ||
206 | eprintln("too many registers used on chunk %s", chunk.id); | ||
207 | exit(EXIT_FAILURE); | ||
208 | } | ||
209 | |||
197 | disassemble_chunk(chunk); | 210 | disassemble_chunk(chunk); |
198 | 211 | ||
199 | // Run bytecode on VM. | 212 | // Run bytecode on VM. |