expr
expr copied to clipboard
Support long jumps inside an expression
We are generating really long expressions (>1MB) and using conditionals there that can cause more than 64KB jumps. Today, the args of the opcodes are 2 bytes and long jumps are truncated to this size. When running the expression, the VM jumps (actual_offset % 64Kb) and runs invalid opcodes.
Wow! Such a big expression. Amazing) So, yes. this is a limitation of the current VM.
I see to possible solutions:
- Use bigger opcodes (this will require proper benchmarking to make sure be op size performance as the same level).
- Or panic on trying to generate too big jump.
Fixed! I refactored vm. Now it uses int for args. So, jumps can be really long. Also it got 50% faster).