Make unit.cpp not take forever to compile

The AtomicHashMap constructor seems to be causing
Unit::GetNamedEntity to take forever to compile in the opt build, so I
moved the initialization out of that function and marked it #pragma
GCC optimize ("O0") to prevent whatever crazy optimization is freaking
gcc out.
Esse commit está contido em:
Bert Maher
2013-06-26 09:10:27 -07:00
commit de Sara Golemon
commit bb7dff89d9
+10 -5
Ver Arquivo
@@ -103,13 +103,18 @@ size_t Unit::GetNamedEntityTableSize() {
return s_namedDataMap ? s_namedDataMap->size() : 0;
}
NEVER_INLINE
static void initializeNamedDataMap() {
NamedEntityMap::Config config;
config.growthFactor = 1;
s_namedDataMap =
new NamedEntityMap(RuntimeOption::EvalInitialNamedEntityTableSize,
config);
}
NamedEntity* Unit::GetNamedEntity(const StringData* str) {
if (UNLIKELY(!s_namedDataMap)) {
NamedEntityMap::Config config;
config.growthFactor = 1;
s_namedDataMap =
new NamedEntityMap(RuntimeOption::EvalInitialNamedEntityTableSize,
config);
initializeNamedDataMap();
}
NamedEntityMap::iterator it = s_namedDataMap->find(str);
if (LIKELY(it != s_namedDataMap->end())) return &it->second;