8f6dd1ad3a
The dart2js binary serialization infrastructure only supports 30 bit integers with the "writeInt" method. The indexing infrastructure uses 1 of the bits to store locality information leaving 29 bits to encode the address space. The recent dump info changes expanded the address space of some large programs beyond this 2^29 and is causing some serialization issues when trying to generate dump info. The solution here is to check when an address is above 2^29 and instead encode the offset as a uint32. This will use 5 bytes for these large values (1 for the large offset indicator and 4 for the offset itself). By doing this we expand the address space to 2^32 which is more than enough to support larger programs. An alternative would be to use some bits from the indicator and encode the rest in a separate 30-bit int. This would allow us to represent an address space closer to 2^60. But we would need to use an extra bit to differentiate the indicator and an actual offset. Which would reduce the base address space to 2^28 causing us to hit the more expensive 5-byte case earlier and increasing total write size. No known program is anywhere near the 2^32 address space size so the larger address space is not necessary. Change-Id: Icbed2961099842ebf286b36314e8d6fab7389db4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363541 Reviewed-by: Mayank Patke <fishythefish@google.com> Commit-Queue: Nate Biggs <natebiggs@google.com>