Skip to content

Commit

Permalink
Back out "update InterDex* passes to editable cfg"
Browse files Browse the repository at this point in the history
Summary:
Original commit changeset: 7d76cbf50cab

Original Phabricator Diff: D49424125

Reviewed By: ssj933

Differential Revision: D50243247

fbshipit-source-id: 04c81d165d3c38d5ee620dda7c450d017d2c228a
  • Loading branch information
beicy authored and facebook-github-bot committed Oct 13, 2023
1 parent f71c967 commit 3ffe804
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 17 deletions.
17 changes: 1 addition & 16 deletions opt/interdex/InterDex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ std::unordered_set<DexClass*> find_unrefenced_coldstart_classes(
},
[&](DexMethod* meth, const IRCode& code) {
auto base_cls = meth->get_class();
always_assert(meth->get_code()->editable_cfg_built());
for (auto& mie : cfg::InstructionIterable(meth->get_code()->cfg())) {
for (auto& mie : InstructionIterable(meth->get_code())) {
auto inst = mie.insn;
DexType* called_cls = nullptr;
if (inst->has_method()) {
Expand Down Expand Up @@ -1185,12 +1184,6 @@ DexClass* InterDex::get_canary_cls(EmittingState& emitting_state,
std::lock_guard<std::mutex> lock_guard(canary_mutex);
canary_cls = create_canary(dexnum);
set_clinit_methods_if_needed(canary_cls);
for (auto* m : canary_cls->get_all_methods()) {
if (m->get_code() == nullptr) {
continue;
}
m->get_code()->build_cfg();
}
}
MethodRefs clazz_mrefs;
FieldRefs clazz_frefs;
Expand Down Expand Up @@ -1286,14 +1279,6 @@ void InterDex::post_process_dex(EmittingState& emitting_state,
TRACE(IDEX, 4, "IDEX: Emitting %s-plugin-generated class :: %s",
plugin->name().c_str(), SHOW(cls));
classes.push_back(cls);
// For the plugin cls, make sure all methods are editable cfg built.
for (auto* m : cls->get_all_methods()) {
if (m->get_code() == nullptr) {
continue;
}
m->get_code()->build_cfg();
}

// If this is the primary dex, or if there are any betamap-ordered
// classes in this dex, then we treat the additional classes as
// perf-sensitive, to be conservative.
Expand Down
1 change: 0 additions & 1 deletion opt/interdex/InterDexPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "PassManager.h"
#include "Show.h"
#include "StlUtil.h"
#include "Walkers.h"
#include "WorkQueue.h"

namespace {
Expand Down
2 changes: 2 additions & 0 deletions opt/interdex/InterDexPass.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class InterDexPass : public Pass {
++m_eval;
}

bool is_cfg_legacy() override { return true; }

void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override;

bool minimize_cross_dex_refs() const { return m_minimize_cross_dex_refs; }
Expand Down
2 changes: 2 additions & 0 deletions opt/interdex/InterDexReshufflePass.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class InterDexReshufflePass : public Pass {
};
}

bool is_cfg_legacy() override { return true; }

void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override;

void bind_config() override {
Expand Down
2 changes: 2 additions & 0 deletions opt/interdex/SortRemainingClassesPass.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class SortRemainingClassesPass : public Pass {
"Whether to sort classes in primary dex.");
}

bool is_cfg_legacy() override { return true; }

void run_pass(DexStoresVector&, ConfigFiles&, PassManager&) override;

private:
Expand Down

0 comments on commit 3ffe804

Please sign in to comment.