blob: fde7a379bcffccd1eb9def33ddb1248273e2849f [file] [log] [blame]
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -07001// 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
9namespace art {
10
11class Compiler {
12 public:
Brian Carlstrombffb1552011-08-25 12:23:53 -070013 // Compile the DexFiles on a classpath. Returns a ClassLoader for
14 // the path used by the classes that were compiled. This ClassLoader
15 // can be used with FindClass to lookup a compiled class by name.
16 const ClassLoader* Compile(std::vector<const DexFile*> class_path);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -070017
18 private:
19 // Attempt to resolve all type, methods, fields, and strings
20 // referenced from code in the dex file following PathClassLoader
21 // ordering semantics.
22 void Resolve(const ClassLoader* class_loader);
23 void ResolveDexFile(const ClassLoader* class_loader, const DexFile& dex_file);
24
Brian Carlstrom83db7722011-08-26 17:32:56 -070025 void Compile(const ClassLoader* class_loader);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -070026 void CompileDexFile(const ClassLoader* class_loader, const DexFile& dex_file);
27 void CompileClass(Class* klass);
28 void CompileMethod(Method* klass);
Brian Carlstrom83db7722011-08-26 17:32:56 -070029
30 // After compiling, walk all the DexCaches and set the code and
Brian Carlstrom9cc262e2011-08-28 12:45:30 -070031 // method pointers of CodeAndDirectMethods entries in the DexCaches.
32 void SetCodeAndDirectMethods(const ClassLoader* class_loader);
33 void SetCodeAndDirectMethodsDexFile(const ClassLoader* class_loader, const DexFile& dex_file);
Brian Carlstrom9ea1cb12011-08-24 23:18:18 -070034};
35
36} // namespace art
37
38#endif // ART_SRC_COMPILER_H_