Clean up pass driver
Added pass manager to hold the state which used to be in global
variables.
Static variables caused issues with Runtime.exit since they are
destroyed by the global destructors while threads are still
executing.
Bug: 17950037
Change-Id: Ie0e4546dc9e48909c8df996a5c135be682d50044
diff --git a/compiler/dex/pass_driver_me_opts.h b/compiler/dex/pass_driver_me_opts.h
index 0a5b5ae..b930d02 100644
--- a/compiler/dex/pass_driver_me_opts.h
+++ b/compiler/dex/pass_driver_me_opts.h
@@ -25,19 +25,26 @@
struct CompilationUnit;
class Pass;
class PassDataHolder;
+class PassManager;
-class PassDriverMEOpts : public PassDriverME<PassDriverMEOpts> {
+class PassDriverMEOpts : public PassDriverME {
public:
- explicit PassDriverMEOpts(CompilationUnit* cu):PassDriverME<PassDriverMEOpts>(cu) {
+ explicit PassDriverMEOpts(const PassManager* const manager, CompilationUnit* cu)
+ : PassDriverME(manager, cu) {
}
~PassDriverMEOpts() {
}
/**
+ * @brief Write and allocate corresponding passes into the pass manager.
+ */
+ static void SetupPasses(PassManager* pass_manasger);
+
+ /**
* @brief Apply a patch: perform start/work/end functions.
*/
- virtual void ApplyPass(PassDataHolder* data, const Pass* pass);
+ virtual void ApplyPass(PassDataHolder* data, const Pass* pass) OVERRIDE;
};
} // namespace art