Remove unused UnitEmitter::m_feMap
The value of m_feMap is never used. Keys are used to assert when there is an attempt to define a function with already existing name. It does this job poorly because it is not an authoritative source of existing function names. When the top-level function is defined, setCached() is called, which already checks for duplicates, so let's rely on it.
Esse commit está contido em:
@@ -2586,7 +2586,7 @@ bool EmitterVisitor::visitImpl(ConstructPtr node) {
|
||||
postponeMeth(m, nullptr, true);
|
||||
} else {
|
||||
assert(!node->getClassScope()); // Handled directly by emitClass().
|
||||
FuncEmitter* fe = m_ue.newFuncEmitter(nName, false);
|
||||
FuncEmitter* fe = m_ue.newFuncEmitter(nName);
|
||||
e.DefFunc(fe->id());
|
||||
postponeMeth(m, fe, false);
|
||||
}
|
||||
@@ -7023,7 +7023,7 @@ static Unit* emitHHBCNativeFuncUnit(const HhbcExtFuncInfo* builtinFuncs,
|
||||
is not callable.
|
||||
*/
|
||||
StringData* name = StringData::GetStaticString("86null");
|
||||
FuncEmitter* fe = ue->newFuncEmitter(name, /*top*/ true);
|
||||
FuncEmitter* fe = ue->newFuncEmitter(name);
|
||||
fe->init(0, 0, ue->bcPos(), AttrUnique | AttrPersistent,
|
||||
true, empty_string.get());
|
||||
ue->emitOp(OpNull);
|
||||
@@ -7045,7 +7045,7 @@ static Unit* emitHHBCNativeFuncUnit(const HhbcExtFuncInfo* builtinFuncs,
|
||||
// version to delegate if necessary
|
||||
name = StringData::GetStaticString("__builtin_" + name->toCPPString());
|
||||
}
|
||||
FuncEmitter* fe = ue->newFuncEmitter(name, /*top*/ true);
|
||||
FuncEmitter* fe = ue->newFuncEmitter(name);
|
||||
Offset base = ue->bcPos();
|
||||
fe->setBuiltinFunc(mi, bif, nif, base);
|
||||
ue->emitOp(OpNativeImpl);
|
||||
|
||||
@@ -1438,7 +1438,7 @@ void parse_function(AsmState& as) {
|
||||
as.error(".function must have a name");
|
||||
}
|
||||
|
||||
as.fe = as.ue->newFuncEmitter(StringData::GetStaticString(name), true);
|
||||
as.fe = as.ue->newFuncEmitter(StringData::GetStaticString(name));
|
||||
as.fe->init(as.in.getLineNumber(), as.in.getLineNumber() + 1 /* XXX */,
|
||||
as.ue->bcPos(), attrs, true, 0);
|
||||
|
||||
|
||||
@@ -1141,7 +1141,7 @@ void FuncRepoProxy::GetFuncsStmt
|
||||
|
||||
FuncEmitter* fe;
|
||||
if (preClassId < 0) {
|
||||
fe = ue.newFuncEmitter(name, top);
|
||||
fe = ue.newFuncEmitter(name);
|
||||
} else {
|
||||
PreClassEmitter* pce = ue.pce(preClassId);
|
||||
fe = ue.newMethodEmitter(name, pce);
|
||||
|
||||
@@ -2301,21 +2301,15 @@ FuncEmitter* UnitEmitter::getMain() {
|
||||
void UnitEmitter::initMain(int line1, int line2) {
|
||||
assert(m_fes.size() == 0);
|
||||
StringData* name = StringData::GetStaticString("");
|
||||
FuncEmitter* pseudomain = newFuncEmitter(name, false);
|
||||
FuncEmitter* pseudomain = newFuncEmitter(name);
|
||||
Attr attrs = AttrMayUseVV;
|
||||
pseudomain->init(line1, line2, 0, attrs, false, name);
|
||||
}
|
||||
|
||||
FuncEmitter* UnitEmitter::newFuncEmitter(const StringData* n, bool top) {
|
||||
FuncEmitter* UnitEmitter::newFuncEmitter(const StringData* n) {
|
||||
assert(m_fes.size() > 0 || !strcmp(n->data(), "")); // Pseudomain comes first.
|
||||
FuncEmitter* fe = new FuncEmitter(*this, m_nextFuncSn++, m_fes.size(), n);
|
||||
m_fes.push_back(fe);
|
||||
if (top) {
|
||||
if (m_feMap.find(n) != m_feMap.end()) {
|
||||
raise_error("Function already defined: %s", n->data());
|
||||
}
|
||||
m_feMap[n] = fe;
|
||||
}
|
||||
return fe;
|
||||
}
|
||||
|
||||
|
||||
@@ -718,7 +718,7 @@ class UnitEmitter {
|
||||
Id mergeArray(ArrayData* a, const StringData* key=nullptr);
|
||||
FuncEmitter* getMain();
|
||||
void initMain(int line1, int line2);
|
||||
FuncEmitter* newFuncEmitter(const StringData* n, bool top);
|
||||
FuncEmitter* newFuncEmitter(const StringData* n);
|
||||
void appendTopEmitter(FuncEmitter* func);
|
||||
FuncEmitter* newMethodEmitter(const StringData* n, PreClassEmitter* pce);
|
||||
PreClassEmitter* newPreClassEmitter(const StringData* n,
|
||||
@@ -829,9 +829,6 @@ class UnitEmitter {
|
||||
bool m_mergeOnly;
|
||||
typedef std::vector<FuncEmitter*> FeVec;
|
||||
FeVec m_fes;
|
||||
typedef hphp_hash_map<const StringData*, FuncEmitter*, string_data_hash,
|
||||
string_data_isame> FuncEmitterMap;
|
||||
FuncEmitterMap m_feMap;
|
||||
typedef hphp_hash_map<const FuncEmitter*, const Func*,
|
||||
pointer_hash<FuncEmitter> > FMap;
|
||||
FMap m_fMap;
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário