summaryrefslogtreecommitdiffstats
path: root/compiler/compiled_method.h
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-02-17 10:38:49 -0800
committerMathieu Chartier <mathieuc@google.com>2015-02-23 16:45:49 -0800
commit2535abe7d1fcdd0e6aca782b1f1932a703ed50a4 (patch)
tree140026ff9638ff34050680b6c706b82fa1740b56 /compiler/compiled_method.h
parent38fee8ef4bc0f4dbe2c6d1f5585895f0c4d16984 (diff)
downloadandroid_art-2535abe7d1fcdd0e6aca782b1f1932a703ed50a4.tar.gz
android_art-2535abe7d1fcdd0e6aca782b1f1932a703ed50a4.tar.bz2
android_art-2535abe7d1fcdd0e6aca782b1f1932a703ed50a4.zip
Add JIT
Currently disabled by default unless -Xjit is passed in. The proposed JIT is a method JIT which works by utilizing interpreter instrumentation to request compilation of hot methods async during runtime. JIT options: -Xjit / -Xnojit -Xjitcodecachesize:N -Xjitthreshold:integervalue The JIT has a shared copy of a compiler driver which is accessed by worker threads to compile individual methods. Added JIT code cache and data cache, currently sized at 2 MB capacity by default. Most apps will only fill a small fraction of this cache however. Added support to the compiler for compiling interpreter quickened byte codes. Added test target ART_TEST_JIT=TRUE and --jit for run-test. TODO: Clean up code cache. Delete compiled methods after they are added to code cache. Add more optimizations related to runtime checks e.g. direct pointers for invokes. Add method recompilation. Move instrumentation to DexFile to improve performance and reduce memory usage. Bug: 17950037 Change-Id: Ifa5b2684a2d5059ec5a5210733900aafa3c51bca
Diffstat (limited to 'compiler/compiled_method.h')
-rw-r--r--compiler/compiled_method.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/compiler/compiled_method.h b/compiler/compiled_method.h
index 6013507ac4..d6a07f6226 100644
--- a/compiler/compiled_method.h
+++ b/compiler/compiled_method.h
@@ -27,10 +27,6 @@
#include "utils/array_ref.h"
#include "utils/swap_space.h"
-namespace llvm {
- class Function;
-} // namespace llvm
-
namespace art {
class CompilerDriver;
@@ -39,7 +35,9 @@ class CompiledCode {
public:
// For Quick to supply an code blob
CompiledCode(CompilerDriver* compiler_driver, InstructionSet instruction_set,
- const ArrayRef<const uint8_t>& quick_code);
+ const ArrayRef<const uint8_t>& quick_code, bool owns_code_array);
+
+ virtual ~CompiledCode();
InstructionSet GetInstructionSet() const {
return instruction_set_;
@@ -56,8 +54,8 @@ class CompiledCode {
// To align an offset from a page-aligned value to make it suitable
// for code storage. For example on ARM, to ensure that PC relative
// valu computations work out as expected.
- uint32_t AlignCode(uint32_t offset) const;
- static uint32_t AlignCode(uint32_t offset, InstructionSet instruction_set);
+ size_t AlignCode(size_t offset) const;
+ static size_t AlignCode(size_t offset, InstructionSet instruction_set);
// returns the difference between the code address and a usable PC.
// mainly to cope with kThumb2 where the lower bit must be set.
@@ -78,6 +76,9 @@ class CompiledCode {
const InstructionSet instruction_set_;
+ // If we own the code array (means that we free in destructor).
+ const bool owns_code_array_;
+
// Used to store the PIC code for Quick.
SwapVector<uint8_t>* quick_code_;
@@ -122,6 +123,7 @@ class SrcMap FINAL : public std::vector<SrcMapElem, Allocator> {
using std::vector<SrcMapElem, Allocator>::size;
explicit SrcMap() {}
+ explicit SrcMap(const Allocator& alloc) : std::vector<SrcMapElem, Allocator>(alloc) {}
template <class InputIt>
SrcMap(InputIt first, InputIt last, const Allocator& alloc)
@@ -291,7 +293,7 @@ class CompiledMethod FINAL : public CompiledCode {
const ArrayRef<const uint8_t>& cfi_info,
const ArrayRef<LinkerPatch>& patches = ArrayRef<LinkerPatch>());
- ~CompiledMethod() {}
+ virtual ~CompiledMethod();
static CompiledMethod* SwapAllocCompiledMethod(
CompilerDriver* driver,
@@ -347,9 +349,9 @@ class CompiledMethod FINAL : public CompiledCode {
return mapping_table_;
}
- const SwapVector<uint8_t>& GetVmapTable() const {
+ const SwapVector<uint8_t>* GetVmapTable() const {
DCHECK(vmap_table_ != nullptr);
- return *vmap_table_;
+ return vmap_table_;
}
SwapVector<uint8_t> const* GetGcMap() const {
@@ -365,6 +367,8 @@ class CompiledMethod FINAL : public CompiledCode {
}
private:
+ // Whether or not the arrays are owned by the compiled method or dedupe sets.
+ const bool owns_arrays_;
// For quick code, the size of the activation used by the code.
const size_t frame_size_in_bytes_;
// For quick code, a bit mask describing spilled GPR callee-save registers.