forked from facebook/hhvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use encoding scheme with m_packedCap to support larger PackedArrays
Summary: Though m_packedCap is declared as uint32_t, PackedArrays must ensure that the upper byte of m_packedCap is 0 because it overlaps with m_kind field. To make this work, PackedArray was only supporting capacities up to 2^24-1 and for larger capacities it would escalate to MixedArray. The Vector collection implementation is being changed to use an array as the Vector's buffer, and it would be nice if Vector could assume it's always dealing with a PackedArray. However, imposing a maximum capacity of 2^24-1 on Vectors feels unreasonably low. This diff introduces an encoding scheme for PackedArray's capacity field. This encoding scheme provides a mapping from 3-byte "capacity codes" to 4-byte capacities. The encoding scheme allows us to avoid doing any extra work in the common case when growing a PackedArray, and it only introduces one additional (predictable) branch in the common case when allocating, copying, or freeing a PackedArray. Reviewed By: @jdelong Differential Revision: D1337469
- Loading branch information
1 parent
475d253
commit f5445e1
Showing
11 changed files
with
325 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.