summaryrefslogtreecommitdiff
path: root/compiler/common_compiler_test.cc
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/common_compiler_test.cc
parent38fee8ef4bc0f4dbe2c6d1f5585895f0c4d16984 (diff)
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/common_compiler_test.cc')
-rw-r--r--compiler/common_compiler_test.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index 1cd78f8168..e8354b2a1b 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -52,19 +52,19 @@ void CommonCompilerTest::MakeExecutable(mirror::ArtMethod* method) {
const SwapVector<uint8_t>* code = compiled_method->GetQuickCode();
uint32_t code_size = code->size();
CHECK_NE(0u, code_size);
- const SwapVector<uint8_t>& vmap_table = compiled_method->GetVmapTable();
- uint32_t vmap_table_offset = vmap_table.empty() ? 0u
- : sizeof(OatQuickMethodHeader) + vmap_table.size();
+ const SwapVector<uint8_t>* vmap_table = compiled_method->GetVmapTable();
+ uint32_t vmap_table_offset = vmap_table->empty() ? 0u
+ : sizeof(OatQuickMethodHeader) + vmap_table->size();
const SwapVector<uint8_t>* mapping_table = compiled_method->GetMappingTable();
bool mapping_table_used = mapping_table != nullptr && !mapping_table->empty();
size_t mapping_table_size = mapping_table_used ? mapping_table->size() : 0U;
uint32_t mapping_table_offset = !mapping_table_used ? 0u
- : sizeof(OatQuickMethodHeader) + vmap_table.size() + mapping_table_size;
+ : sizeof(OatQuickMethodHeader) + vmap_table->size() + mapping_table_size;
const SwapVector<uint8_t>* gc_map = compiled_method->GetGcMap();
bool gc_map_used = gc_map != nullptr && !gc_map->empty();
size_t gc_map_size = gc_map_used ? gc_map->size() : 0U;
uint32_t gc_map_offset = !gc_map_used ? 0u
- : sizeof(OatQuickMethodHeader) + vmap_table.size() + mapping_table_size + gc_map_size;
+ : sizeof(OatQuickMethodHeader) + vmap_table->size() + mapping_table_size + gc_map_size;
OatQuickMethodHeader method_header(mapping_table_offset, vmap_table_offset, gc_map_offset,
compiled_method->GetFrameSizeInBytes(),
compiled_method->GetCoreSpillMask(),
@@ -72,14 +72,14 @@ void CommonCompilerTest::MakeExecutable(mirror::ArtMethod* method) {
header_code_and_maps_chunks_.push_back(std::vector<uint8_t>());
std::vector<uint8_t>* chunk = &header_code_and_maps_chunks_.back();
- size_t size = sizeof(method_header) + code_size + vmap_table.size() + mapping_table_size +
+ size_t size = sizeof(method_header) + code_size + vmap_table->size() + mapping_table_size +
gc_map_size;
size_t code_offset = compiled_method->AlignCode(size - code_size);
size_t padding = code_offset - (size - code_size);
chunk->reserve(padding + size);
chunk->resize(sizeof(method_header));
memcpy(&(*chunk)[0], &method_header, sizeof(method_header));
- chunk->insert(chunk->begin(), vmap_table.begin(), vmap_table.end());
+ chunk->insert(chunk->begin(), vmap_table->begin(), vmap_table->end());
if (mapping_table_used) {
chunk->insert(chunk->begin(), mapping_table->begin(), mapping_table->end());
}
@@ -212,7 +212,7 @@ void CommonCompilerTest::CompileMethod(mirror::ArtMethod* method) {
CHECK(method != nullptr);
TimingLogger timings("CommonTest::CompileMethod", false, false);
TimingLogger::ScopedTiming t(__FUNCTION__, &timings);
- compiler_driver_->CompileOne(method, &timings);
+ compiler_driver_->CompileOne(Thread::Current(), method, &timings);
TimingLogger::ScopedTiming t2("MakeExecutable", &timings);
MakeExecutable(method);
}