De-virtualize ArrayData::release.

Of the four horsemen of the SmartAllocator, ArrayData was the only virtual
call. This meant an extra layer of indirection when coming from the TC
to allow the c++ compiler to emit its virtual call, and slightly larger
callsites when using non-generic paths.

While we're moving in this direction, consolidate ArrayData introspection
on its type enum. isSharedMap() was previously implemented with a vtable
slot, and we had no way of asking if an ArrayData was a NameValueTable.
Esse commit está contido em:
kma
2013-03-26 09:35:49 -07:00
commit de Sara Golemon
commit 5e603184f5
11 arquivos alterados com 52 adições e 31 exclusões
+17
Ver Arquivo
@@ -23,6 +23,7 @@
#include <runtime/base/variable_serializer.h>
#include <runtime/base/runtime_option.h>
#include <runtime/base/macros.h>
#include <runtime/base/shared/shared_map.h>
#include <util/exception.h>
#include <tbb/concurrent_hash_map.h>
@@ -102,6 +103,22 @@ ArrayData *ArrayData::nonSmartCopy() const {
throw FatalErrorException("nonSmartCopy not implemented.");
}
HOT_FUNC
void ArrayData::release() {
if (isHphpArray()) {
HphpArray* that = static_cast<HphpArray*>(this);
that->release();
return;
}
if (isSharedMap()) {
SharedMap* that = static_cast<SharedMap*>(this);
that->release();
return;
}
assert(m_kind == kNameValueTableWrapper);
// NameValueTableWrapper: nop.
}
///////////////////////////////////////////////////////////////////////////////
// reads