diff options
author | Jean Christophe Beyler <jean.christophe.beyler@intel.com> | 2014-04-29 13:42:08 -0700 |
---|---|---|
committer | Jean Christophe Beyler <jean.christophe.beyler@intel.com> | 2014-05-27 11:41:29 -0700 |
commit | 8bceccec7eddff8cd872aa20505b4a3a6be60a16 (patch) | |
tree | c0f7fb0dcf4041542ec8de58c881faf03db07b54 /compiler/dex/pass.h | |
parent | 132236a802a82cc7d27f82e34e40082ef5c17375 (diff) | |
download | art-8bceccec7eddff8cd872aa20505b4a3a6be60a16.tar.gz art-8bceccec7eddff8cd872aa20505b4a3a6be60a16.tar.bz2 art-8bceccec7eddff8cd872aa20505b4a3a6be60a16.zip |
ART: Print and dump functionalities per pass
LOG is a great logging tool but sometimes a pass has some debugging text it
want to be able to turn on/off easily.
By going via a print_pass flag, we can actually turn it on/off easily per pass
when debugging/instrumenting.
- Added a pass printer to help debug messages for future passes.
- Added a print_pass flag in CompilationUnit to filter out messages.
At the same time, did a similar system for dumping the CFG.
- Also moved some API into public from protected.
Change-Id: Ie0e89a8fc773e8583f3e4ffd6e4bd2eebdbb2bf4
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
Signed-off-by: Yixin Shou <yixin.shou@intel.com>
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
Signed-off-by: Udayan Banerji <udayan.banerji@intel.com>
Diffstat (limited to 'compiler/dex/pass.h')
-rw-r--r-- | compiler/dex/pass.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/dex/pass.h b/compiler/dex/pass.h index 4ce040e9ab..b4906d67df 100644 --- a/compiler/dex/pass.h +++ b/compiler/dex/pass.h @@ -89,6 +89,21 @@ class Pass { return false; } + static void BasePrintMessage(CompilationUnit* c_unit, const char* pass_name, const char* message, ...) { + // Check if we want to log something or not. + if (c_unit->print_pass) { + // Stringify the message. + va_list args; + va_start(args, message); + std::string stringified_message; + StringAppendV(&stringified_message, message, args); + va_end(args); + + // Log the message and ensure to include pass name. + LOG(INFO) << pass_name << ": " << stringified_message; + } + } + protected: /** @brief The pass name: used for searching for a pass when running a particular pass or debugging. */ const char* const pass_name_; |