Closed
Description
We have reason to believe that compiled Dart code (in particular AOT compiled code) could be much smaller if we could restrict ints to no more than 64 bits. We assume that we can keep the big int support around, but just get rid of the automatic promotion to big ints on overflow (and the corresponding demotion going back to smaller ints again).
Here are the steps we will take to evaluate this.
- Let the VM throw on 64-bit overflows behind a flag (--limit-ints-to-64-bits)
- Turn on the flag for Flutter and figure out what tweaks we need to make it 64-bit clean
- Try the flag on dart2js, pub, DDC, etc.
- Expose big int class so users can opt into using bit ints
If that appears to be doable, we will:
- Turn on throwing on 64-bit overflows for all users of the VM
Finally, we need to decide if the overflow behavior should be wrapping around or remain throwing. If we decide to wrap around it will have an impact on our range analysis code.