Function lookup is slow - replacing with a faster test.
This commit is contained in:
parent
1a2b4a38e0
commit
dbcdc5b543
|
@ -34,14 +34,9 @@ PPCScanner::PPCScanner(PPCFrontend* frontend) : frontend_(frontend) {}
|
||||||
PPCScanner::~PPCScanner() {}
|
PPCScanner::~PPCScanner() {}
|
||||||
|
|
||||||
bool PPCScanner::IsRestGprLr(uint32_t address) {
|
bool PPCScanner::IsRestGprLr(uint32_t address) {
|
||||||
auto functions = frontend_->processor()->FindFunctionsWithAddress(address);
|
auto function = frontend_->processor()->QueryFunction(address);
|
||||||
for (auto& function : functions) {
|
return function &&
|
||||||
if (function->symbol_info()->behavior() ==
|
function->symbol_info()->behavior() == FunctionBehavior::kEpilogReturn;
|
||||||
FunctionBehavior::kEpilogReturn) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PPCScanner::Scan(FunctionInfo* symbol_info, DebugInfo* debug_info) {
|
bool PPCScanner::Scan(FunctionInfo* symbol_info, DebugInfo* debug_info) {
|
||||||
|
|
|
@ -181,6 +181,14 @@ FunctionInfo* Processor::DefineBuiltin(const std::string& name,
|
||||||
return fn_info;
|
return fn_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Function* Processor::QueryFunction(uint32_t address) {
|
||||||
|
auto entry = entry_table_.Get(address);
|
||||||
|
if (!entry) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
return entry->function;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<Function*> Processor::FindFunctionsWithAddress(uint32_t address) {
|
std::vector<Function*> Processor::FindFunctionsWithAddress(uint32_t address) {
|
||||||
return entry_table_.FindWithAddress(address);
|
return entry_table_.FindWithAddress(address);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,7 @@ class Processor {
|
||||||
FunctionInfo::BuiltinHandler handler, void* arg0,
|
FunctionInfo::BuiltinHandler handler, void* arg0,
|
||||||
void* arg1);
|
void* arg1);
|
||||||
|
|
||||||
|
Function* QueryFunction(uint32_t address);
|
||||||
std::vector<Function*> FindFunctionsWithAddress(uint32_t address);
|
std::vector<Function*> FindFunctionsWithAddress(uint32_t address);
|
||||||
|
|
||||||
bool LookupFunctionInfo(uint32_t address, FunctionInfo** out_symbol_info);
|
bool LookupFunctionInfo(uint32_t address, FunctionInfo** out_symbol_info);
|
||||||
|
|
Loading…
Reference in New Issue