ClassScopes::ClassScopes(const Scope& scope) { m_hierarchy = build_type_hierarchy(scope); m_interface_map = build_interface_map(m_hierarchy); m_sig_map = build_signature_map(m_hierarchy); build_class_scopes(get_object_type()); build_interface_scopes(); }
void AccessMarkingPass::run_pass(DexStoresVector& stores, ConfigFiles& /* conf */, PassManager& pm) { auto scope = build_class_scope(stores); ClassHierarchy ch = build_type_hierarchy(scope); SignatureMap sm = build_signature_map(ch); if (m_finalize_classes) { auto n_classes_final = mark_classes_final(scope, ch); pm.incr_metric("finalized_classes", n_classes_final); TRACE(ACCESS, 1, "Finalized %lu classes\n", n_classes_final); } if (m_finalize_methods) { auto n_methods_final = mark_methods_final(scope, ch); pm.incr_metric("finalized_methods", n_methods_final); TRACE(ACCESS, 1, "Finalized %lu methods\n", n_methods_final); } if (m_finalize_fields) { auto n_fields_final = mark_fields_final(scope); pm.incr_metric("finalized_fields", n_fields_final); TRACE(ACCESS, 1, "Finalized %lu fields\n", n_fields_final); } auto candidates = devirtualize(sm); auto dmethods = direct_methods(scope); candidates.insert(candidates.end(), dmethods.begin(), dmethods.end()); if (m_privatize_methods) { auto privates = find_private_methods(scope, candidates); fix_call_sites_private(scope, privates); mark_methods_private(privates); pm.incr_metric("privatized_methods", privates.size()); TRACE(ACCESS, 1, "Privatized %lu methods\n", privates.size()); } }
SignatureMap build_signature_map(const ClassHierarchy& class_hierarchy) { SignatureMap signature_map; build_signature_map(class_hierarchy, get_object_type(), signature_map); return signature_map; }