Brian Carlstrom | 9ea1cb1 | 2011-08-24 23:18:18 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #ifndef ART_SRC_COMPILER_H_ |
| 4 | #define ART_SRC_COMPILER_H_ |
| 5 | |
| 6 | #include "dex_file.h" |
| 7 | #include "object.h" |
| 8 | |
| 9 | namespace art { |
| 10 | |
| 11 | class Compiler { |
| 12 | public: |
Brian Carlstrom | 8a48741 | 2011-08-29 20:08:52 -0700 | [diff] [blame^] | 13 | // Compile all Methods of all the Classes of all the DexFiles that are part of a ClassLoader. |
| 14 | void CompileAll(const ClassLoader* class_loader); |
| 15 | |
| 16 | // Compile a single Method |
| 17 | void CompileOne(Method* method); |
Brian Carlstrom | 9ea1cb1 | 2011-08-24 23:18:18 -0700 | [diff] [blame] | 18 | |
| 19 | private: |
| 20 | // Attempt to resolve all type, methods, fields, and strings |
| 21 | // referenced from code in the dex file following PathClassLoader |
| 22 | // ordering semantics. |
| 23 | void Resolve(const ClassLoader* class_loader); |
| 24 | void ResolveDexFile(const ClassLoader* class_loader, const DexFile& dex_file); |
| 25 | |
Brian Carlstrom | 83db772 | 2011-08-26 17:32:56 -0700 | [diff] [blame] | 26 | void Compile(const ClassLoader* class_loader); |
Brian Carlstrom | 9ea1cb1 | 2011-08-24 23:18:18 -0700 | [diff] [blame] | 27 | void CompileDexFile(const ClassLoader* class_loader, const DexFile& dex_file); |
| 28 | void CompileClass(Class* klass); |
| 29 | void CompileMethod(Method* klass); |
Brian Carlstrom | 83db772 | 2011-08-26 17:32:56 -0700 | [diff] [blame] | 30 | |
| 31 | // After compiling, walk all the DexCaches and set the code and |
Brian Carlstrom | 9cc262e | 2011-08-28 12:45:30 -0700 | [diff] [blame] | 32 | // method pointers of CodeAndDirectMethods entries in the DexCaches. |
| 33 | void SetCodeAndDirectMethods(const ClassLoader* class_loader); |
Brian Carlstrom | 8a48741 | 2011-08-29 20:08:52 -0700 | [diff] [blame^] | 34 | void SetCodeAndDirectMethodsDexFile(const DexFile& dex_file); |
Brian Carlstrom | 9ea1cb1 | 2011-08-24 23:18:18 -0700 | [diff] [blame] | 35 | }; |
| 36 | |
| 37 | } // namespace art |
| 38 | |
| 39 | #endif // ART_SRC_COMPILER_H_ |