HphpArray Vector specializations

Introduces a new m_kind for vector-shaped HphpArray instances.
A vector has integer indexes in the range [0..size), and no
tombstones.  Internally it does not store the integer keys or
hashtable, although this version still allocates space for it.
Esse commit está contido em:
Edwin Smith
2013-07-03 16:59:24 -07:00
commit de Sara Golemon
commit 608df352de
15 arquivos alterados com 1255 adições e 520 exclusões
+8 -2
Ver Arquivo
@@ -23,6 +23,9 @@
#include "hphp/runtime/base/execution_context.h"
#include "hphp/runtime/vm/jit/translator-inline.h"
// inline methods of HphpArray
#include "hphp/runtime/base/hphp_array-defs.h"
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
@@ -61,6 +64,10 @@ template <typename AccessorT>
HphpArray::SortFlavor
HphpArray::preSort(const AccessorT& acc, bool checkTypes) {
assert(m_size > 0);
if (isVector()) {
// todo t2607563: this is pessimistic.
vectorToGeneric();
}
if (!checkTypes && m_size == m_used) {
// No need to loop over the elements, we're done
return GenericSort;
@@ -117,8 +124,7 @@ done:
void HphpArray::postSort(bool resetKeys) {
assert(m_size > 0);
size_t tableSize = computeTableSize(m_tableMask);
initHash(m_hash, tableSize);
m_hLoad = 0;
initHash(tableSize);
if (resetKeys) {
for (uint32_t pos = 0; pos < m_used; ++pos) {
Elm* e = &m_data[pos];