diff options
Diffstat (limited to 'src/bytecode/chunk.h')
-rwxr-xr-x[-rw-r--r--] | src/bytecode/chunk.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bytecode/chunk.h b/src/bytecode/chunk.h index e3c7383..81fc4cc 100644..100755 --- a/src/bytecode/chunk.h +++ b/src/bytecode/chunk.h | |||
@@ -46,6 +46,11 @@ add_code(Chunk *chunk, u8 byte, size_t line, size_t col) { | |||
46 | 46 | ||
47 | size_t | 47 | size_t |
48 | add_constant(Chunk *chunk, Object obj) { | 48 | add_constant(Chunk *chunk, Object obj) { |
49 | // FIXME?: Since we are using a single byte to store constant indices, we | ||
50 | // can only have 256 stored constants. If we need more we may need to add | ||
51 | // another instruction OP_CONSTANT_16 to have at least two bytes for | ||
52 | // constants. Alternatively, we could make that the default. Either way, for | ||
53 | // now it's fine. | ||
49 | size_t pos = array_size(chunk->constants); | 54 | size_t pos = array_size(chunk->constants); |
50 | array_push(chunk->constants, obj); | 55 | array_push(chunk->constants, obj); |
51 | return pos; | 56 | return pos; |