diff --git a/Makefile.am b/Makefile.am index 03a33819e59..d2c425ca2bd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -191,7 +191,6 @@ libredex_la_SOURCES = \ libredex/PluginRegistry.cpp \ libredex/PointsToSemantics.cpp \ libredex/PointsToSemanticsUtils.cpp \ - libredex/PostLowering.cpp \ libredex/PrintSeeds.cpp \ libredex/ProguardConfiguration.cpp \ libredex/ProguardLexer.cpp \ diff --git a/libredex/DexOutput.h b/libredex/DexOutput.h index 2eb18033f88..889961c9532 100644 --- a/libredex/DexOutput.h +++ b/libredex/DexOutput.h @@ -19,7 +19,6 @@ #include "DexUtil.h" #include "GlobalConfig.h" #include "Pass.h" -#include "PostLowering.h" #include "ProguardMap.h" #include "Trace.h" diff --git a/libredex/PostLowering.cpp b/libredex/PostLowering.cpp deleted file mode 100644 index 22d809f35ef..00000000000 --- a/libredex/PostLowering.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "PostLowering.h" -#include "DexOutput.h" - -class NoopPostLowering : public PostLowering { - public: - void run(const DexStoresVector& stores) override {} - void finalize(AssetManager& mgr) override {} - - void load_dex_indexes(ConfigFiles&, - int32_t, - DexClasses*, - GatheredTypes&, - const std::string&, - size_t) override {} -}; - -std::unique_ptr PostLowering::create() { - return std::make_unique(); -} diff --git a/libredex/PostLowering.h b/libredex/PostLowering.h deleted file mode 100644 index d1f3be5e629..00000000000 --- a/libredex/PostLowering.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include -#include - -#include "AssetManager.h" -#include "ConfigFiles.h" -#include "DexClass.h" -#include "DexStore.h" -#include "IODIMetadata.h" - -class GatheredTypes; - -class PostLowering { - public: - static std::unique_ptr create(); - - virtual void run(const DexStoresVector& stores) = 0; - virtual void finalize(AssetManager& mgr) = 0; - - virtual void load_dex_indexes(ConfigFiles& conf, - int32_t min_sdk, - DexClasses* classes, - GatheredTypes& gtypes, - const std::string& store_name, - size_t dex_number) = 0; - - virtual ~PostLowering() = default; -}; diff --git a/libredex/RedexOptions.cpp b/libredex/RedexOptions.cpp index 5b8101126f2..c5e29015ea2 100644 --- a/libredex/RedexOptions.cpp +++ b/libredex/RedexOptions.cpp @@ -19,7 +19,6 @@ void RedexOptions::serialize(Json::Value& entry_data) const { options["instrument_pass_enabled"] = instrument_pass_enabled; options["min_sdk"] = min_sdk; options["debug_info_kind"] = debug_info_kind_to_string(debug_info_kind); - options["post_lowering"] = post_lowering; options["jni_summary_path"] = jni_summary_path; } @@ -32,7 +31,6 @@ void RedexOptions::deserialize(const Json::Value& entry_data) { min_sdk = options_data["min_sdk"].asInt(); debug_info_kind = parse_debug_info_kind(options_data["debug_info_kind"].asString()); - post_lowering = options_data["post_lowering"].asBool(); jni_summary_path = options_data["jni_summary_path"].asString(); } diff --git a/libredex/RedexOptions.h b/libredex/RedexOptions.h index adef674fc9f..a8e4a002535 100644 --- a/libredex/RedexOptions.h +++ b/libredex/RedexOptions.h @@ -49,7 +49,6 @@ class RedexOptions { bool is_art_build{false}; bool disable_dex_hasher{false}; bool instrument_pass_enabled{false}; - bool post_lowering{false}; int32_t min_sdk{0}; Architecture arch{Architecture::UNKNOWN}; DebugInfoKind debug_info_kind{DebugInfoKind::NoCustomSymbolication}; diff --git a/libredex/Trace.h b/libredex/Trace.h index 08ce6cb4dcd..299da57e675 100644 --- a/libredex/Trace.h +++ b/libredex/Trace.h @@ -115,7 +115,6 @@ class DexType; TM(PEEPHOLE) \ TM(PGR) \ TM(PM) \ - TM(POST_LOWERING) \ TM(PPP) \ TM(PTA) \ TM(PURITY) \ diff --git a/redex.py b/redex.py index 70fea92411d..b2e72e80ef1 100755 --- a/redex.py +++ b/redex.py @@ -290,9 +290,6 @@ def run_redex_binary( if state.args.is_art_build: args += ["--is-art-build"] - if state.args.post_lowering: - args += ["--post-lowering"] - if state.args.disable_dex_hasher: args += ["--disable-dex-hasher"] @@ -692,12 +689,6 @@ def arg_parser( action="store_true", help="States that this is an art only build", ) - parser.add_argument( - "--post-lowering", - action="store_true", - default=False, - help="Specifies whether post lowering processing should be done", - ) parser.add_argument( "--disable-dex-hasher", action="store_true", help="Disable DexHasher" ) diff --git a/tools/redex-all/main.cpp b/tools/redex-all/main.cpp index a34d3c58066..0787310e1ed 100644 --- a/tools/redex-all/main.cpp +++ b/tools/redex-all/main.cpp @@ -61,7 +61,6 @@ #include "NoOptimizationsMatcher.h" #include "OptData.h" #include "PassRegistry.h" -#include "PostLowering.h" #include "ProguardConfiguration.h" // New ProGuard configuration #include "ProguardMatcher.h" #include "ProguardParser.h" // New ProGuard Parser @@ -373,10 +372,6 @@ Arguments parse_args(int argc, char* argv[]) { po::bool_switch(&args.redex_options.disable_dex_hasher) ->default_value(false), "If specified, states that the current run disables dex hasher.\n"); - od.add_options()( - "post-lowering", - po::bool_switch(&args.redex_options.post_lowering)->default_value(false), - "If specified, post lowering steps are run.\n"); od.add_options()( "arch,A", po::value>(), @@ -1413,8 +1408,6 @@ void redex_backend(ConfigFiles& conf, }(); std::set signatures; - std::unique_ptr post_lowering = - redex_options.post_lowering ? PostLowering::create() : nullptr; const bool mem_stats_enabled = traceEnabled(STATS, 1) || conf.get_json_config().get("mem_stats", true); @@ -1437,9 +1430,6 @@ void redex_backend(ConfigFiles& conf, bool should_preserve_input_dexes = conf.get_json_config().get("preserve_input_dexes", false); if (should_preserve_input_dexes) { - always_assert_log( - !post_lowering, - "post lowering should be off when preserving input dex option is on"); TRACE(MAIN, 1, "Skipping writing output dexes as configured"); } else { redex_assert(!stores.empty()); @@ -1456,11 +1446,6 @@ void redex_backend(ConfigFiles& conf, DexClasses* classes = &store.get_dexen()[i]; auto gtypes = std::make_shared(classes); - if (post_lowering) { - post_lowering->load_dex_indexes(conf, min_sdk, classes, *gtypes, - store_name, i); - } - auto this_dex_stats = write_classes_to_dex( redex::get_dex_output_name(output_dir, store, i), classes, @@ -1496,10 +1481,6 @@ void redex_backend(ConfigFiles& conf, sanitizers::lsan_do_recoverable_leak_check(); std::vector needs_debug_line_mapping; - if (post_lowering) { - post_lowering->run(stores); - post_lowering->finalize(manager.asset_manager()); - } { Timer t("Writing opt decisions data");