diff options
| author | 2011-10-04 14:58:28 -0700 | |
|---|---|---|
| committer | 2011-10-07 11:59:20 -0700 | |
| commit | 3320cf46afd082398aa401b246e6f301cebdf64d (patch) | |
| tree | 99ef2b240ad81fa7cafa0bca51ca2364120fa762 /src/compiler.h | |
| parent | 4f0d07c783afef89703dce32c94440fc8621a29b (diff) | |
Move rest of code related blobs from Method to oat
Change-Id: I55041b564ab65317c8b1f863005f20ba650a0322
Diffstat (limited to 'src/compiler.h')
| -rw-r--r-- | src/compiler.h | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/compiler.h b/src/compiler.h index 0f6f02f2bd..6059a2a0e2 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -3,30 +3,37 @@ #ifndef ART_SRC_COMPILER_H_ #define ART_SRC_COMPILER_H_ +#include "compiled_method.h" #include "constants.h" #include "dex_file.h" #include "jni_compiler.h" +#include "oat_file.h" #include "object.h" #include "runtime.h" - -int oatVRegOffsetFromMethod(art::Method* method, int reg); +#include "unordered_map.h" namespace art { class Compiler { public: - explicit Compiler(InstructionSet insns); + explicit Compiler(InstructionSet instruction_set); + + ~Compiler(); // Compile all Methods of all the Classes of all the DexFiles that are part of a ClassLoader. void CompileAll(const ClassLoader* class_loader); // Compile a single Method - void CompileOne(Method* method); + void CompileOne(const Method* method); void SetVerbose(bool verbose) { verbose_ = verbose; } + InstructionSet GetInstructionSet() const { + return instruction_set_; + } + bool IsVerbose() const { return verbose_; } @@ -34,10 +41,14 @@ class Compiler { // Stub to throw AbstractMethodError static ByteArray* CreateAbstractMethodErrorStub(InstructionSet instruction_set); + // Generate the trampoline that's invoked by unresolved direct methods static ByteArray* CreateResolutionStub(InstructionSet instruction_set, Runtime::TrampolineType type); + const CompiledMethod* GetCompiledMethod(const Method* method) const; + const CompiledInvokeStub* GetCompiledInvokeStub(const Method* method) const; + private: // Attempt to resolve all type, methods, fields, and strings // referenced from code in the dex file following PathClassLoader @@ -53,8 +64,8 @@ class Compiler { void Compile(const ClassLoader* class_loader); void CompileDexFile(const ClassLoader* class_loader, const DexFile& dex_file); - void CompileClass(Class* klass); - void CompileMethod(Method* klass); + void CompileClass(const Class* klass); + void CompileMethod(const Method* method); // After compiling, walk all the DexCaches and set the code and // method pointers of CodeAndDirectMethods entries in the DexCaches. @@ -64,6 +75,12 @@ class Compiler { InstructionSet instruction_set_; JniCompiler jni_compiler_; + typedef std::tr1::unordered_map<const Method*, CompiledMethod*, ObjectIdentityHash> MethodTable; + MethodTable compiled_methods_; + + typedef std::tr1::unordered_map<const Method*, CompiledInvokeStub*, ObjectIdentityHash> InvokeStubTable; + InvokeStubTable compiled_invoke_stubs_; + bool verbose_; DISALLOW_COPY_AND_ASSIGN(Compiler); |