diff options
author | Andreas Gampe <agampe@google.com> | 2015-01-22 20:39:27 -0800 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-01-26 14:30:40 -0800 |
commit | 0b9203e7996ee1856f620f95d95d8a273c43a3df (patch) | |
tree | a9715986cfdbb21e4d64f72b56fac255cc8b9309 /compiler/dex/compiler_ir.h | |
parent | 4dfe58d8f2d398963f31831a57fbd12e282e1196 (diff) | |
download | android_art-0b9203e7996ee1856f620f95d95d8a273c43a3df.tar.gz android_art-0b9203e7996ee1856f620f95d95d8a273c43a3df.tar.bz2 android_art-0b9203e7996ee1856f620f95d95d8a273c43a3df.zip |
ART: Some Quick cleanup
Make several fields const in CompilationUnit. May benefit some Mir2Lir
code that repeats tests, and in general immutability is good.
Remove compiler_internals.h and refactor some other headers to reduce
overly broad imports (and thus forced recompiles on changes).
Change-Id: I898405907c68923581373b5981d8a85d2e5d185a
Diffstat (limited to 'compiler/dex/compiler_ir.h')
-rw-r--r-- | compiler/dex/compiler_ir.h | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/compiler/dex/compiler_ir.h b/compiler/dex/compiler_ir.h index 34585c1f87..e7182a919b 100644 --- a/compiler/dex/compiler_ir.h +++ b/compiler/dex/compiler_ir.h @@ -17,31 +17,25 @@ #ifndef ART_COMPILER_DEX_COMPILER_IR_H_ #define ART_COMPILER_DEX_COMPILER_IR_H_ +#include "jni.h" #include <string> #include <vector> -#include "compiler_enums.h" -#include "driver/compiler_driver.h" -#include "utils/scoped_arena_allocator.h" #include "base/timing_logger.h" +#include "invoke_type.h" +#include "safe_map.h" #include "utils/arena_allocator.h" +#include "utils/scoped_arena_allocator.h" namespace art { class Backend; class ClassLinker; +class CompilerDriver; class MIRGraph; -/* - * TODO: refactoring pass to move these (and other) typedefs towards usage style of runtime to - * add type safety (see runtime/offsets.h). - */ -typedef uint32_t DexOffset; // Dex offset in code units. -typedef uint16_t NarrowDexOffset; // For use in structs, Dex offsets range from 0 .. 0xffff. -typedef uint32_t CodeOffset; // Native code offset in bytes. - struct CompilationUnit { - explicit CompilationUnit(ArenaPool* pool); + CompilationUnit(ArenaPool* pool, InstructionSet isa, CompilerDriver* driver, ClassLinker* linker); ~CompilationUnit(); void StartTimingSplit(const char* label); @@ -52,30 +46,20 @@ struct CompilationUnit { * Fields needed/generated by common frontend and generally used throughout * the compiler. */ - CompilerDriver* compiler_driver; - ClassLinker* class_linker; // Linker to resolve fields and methods. - const DexFile* dex_file; // DexFile containing the method being compiled. - jobject class_loader; // compiling method's class loader. - uint16_t class_def_idx; // compiling method's defining class definition index. - uint32_t method_idx; // compiling method's index into method_ids of DexFile. - uint32_t access_flags; // compiling method's access flags. - InvokeType invoke_type; // compiling method's invocation type. - const char* shorty; // compiling method's shorty. - uint32_t disable_opt; // opt_control_vector flags. - uint32_t enable_debug; // debugControlVector flags. + CompilerDriver* const compiler_driver; + ClassLinker* const class_linker; // Linker to resolve fields and methods. + const DexFile* dex_file; // DexFile containing the method being compiled. + jobject class_loader; // compiling method's class loader. + uint16_t class_def_idx; // compiling method's defining class definition index. + uint32_t method_idx; // compiling method's index into method_ids of DexFile. + uint32_t access_flags; // compiling method's access flags. + InvokeType invoke_type; // compiling method's invocation type. + const char* shorty; // compiling method's shorty. + uint32_t disable_opt; // opt_control_vector flags. + uint32_t enable_debug; // debugControlVector flags. bool verbose; - const Compiler* compiler; - InstructionSet instruction_set; - bool target64; - - const InstructionSetFeatures* GetInstructionSetFeatures() { - return compiler_driver->GetInstructionSetFeatures(); - } - - // If non-empty, apply optimizer/debug flags only to matching methods. - std::string compiler_method_match; - // Flips sense of compiler_method_match - apply flags if doesn't match. - bool compiler_flip_match; + const InstructionSet instruction_set; + const bool target64; // TODO: move memory management to mir_graph, or just switch to using standard containers. ArenaAllocator arena; |