summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Allison <dallison@google.com>2014-06-23 13:19:59 -0700
committerDave Allison <dallison@google.com>2014-06-23 13:19:59 -0700
commit50abf0ad03c2cad0fa7969fc1b0bfadb0ca3bf3a (patch)
tree36e6b2f2453f47dbd12223cfcae07daebf152b8b
parent49e5ec42595b29e233fb92b8bd2cf8ade77c6501 (diff)
downloadandroid_art-50abf0ad03c2cad0fa7969fc1b0bfadb0ca3bf3a.tar.gz
android_art-50abf0ad03c2cad0fa7969fc1b0bfadb0ca3bf3a.tar.bz2
android_art-50abf0ad03c2cad0fa7969fc1b0bfadb0ca3bf3a.zip
Move trampolines to thumb2 instead of ARM
Currently the entrypoint trampolines are compiled using the ARM32 assembler. This changes that to use the thumb2 assembler for consistency with the other compiled code. Bug: 15455279 Change-Id: I6bacdf359e2ae4c0967fb5cd9dc694af11f802ec
-rw-r--r--compiler/compiled_method.cc8
-rw-r--r--compiler/compiled_method.h1
-rw-r--r--compiler/oat_writer.cc4
-rw-r--r--compiler/trampolines/trampoline_compiler.cc6
4 files changed, 11 insertions, 8 deletions
diff --git a/compiler/compiled_method.cc b/compiler/compiled_method.cc
index 7441daccfe..f098a34ea7 100644
--- a/compiler/compiled_method.cc
+++ b/compiler/compiled_method.cc
@@ -86,7 +86,11 @@ uint32_t CompiledCode::AlignCode(uint32_t offset, InstructionSet instruction_set
}
size_t CompiledCode::CodeDelta() const {
- switch (instruction_set_) {
+ return CodeDelta(instruction_set_);
+}
+
+size_t CompiledCode::CodeDelta(InstructionSet instruction_set) {
+ switch (instruction_set) {
case kArm:
case kArm64:
case kMips:
@@ -98,7 +102,7 @@ size_t CompiledCode::CodeDelta() const {
return 1;
}
default:
- LOG(FATAL) << "Unknown InstructionSet: " << instruction_set_;
+ LOG(FATAL) << "Unknown InstructionSet: " << instruction_set;
return 0;
}
}
diff --git a/compiler/compiled_method.h b/compiler/compiled_method.h
index 23cd250678..b8cd851a1f 100644
--- a/compiler/compiled_method.h
+++ b/compiler/compiled_method.h
@@ -67,6 +67,7 @@ class CompiledCode {
// returns the difference between the code address and a usable PC.
// mainly to cope with kThumb2 where the lower bit must be set.
size_t CodeDelta() const;
+ static size_t CodeDelta(InstructionSet instruction_set);
// Returns a pointer suitable for invoking the code at the argument
// code_pointer address. Mainly to cope with kThumb2 where the
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc
index c6b9161b63..4590880c12 100644
--- a/compiler/oat_writer.cc
+++ b/compiler/oat_writer.cc
@@ -800,6 +800,7 @@ size_t OatWriter::InitOatMaps(size_t offset) {
size_t OatWriter::InitOatCode(size_t offset) {
// calculate the offsets within OatHeader to executable code
size_t old_offset = offset;
+ size_t adjusted_offset = offset;
// required to be on a new page boundary
offset = RoundUp(offset, kPageSize);
oat_header_->SetExecutableOffset(offset);
@@ -809,7 +810,8 @@ size_t OatWriter::InitOatCode(size_t offset) {
#define DO_TRAMPOLINE(field, fn_name) \
offset = CompiledCode::AlignCode(offset, instruction_set); \
- oat_header_->Set ## fn_name ## Offset(offset); \
+ adjusted_offset = offset + CompiledCode::CodeDelta(instruction_set); \
+ oat_header_->Set ## fn_name ## Offset(adjusted_offset); \
field.reset(compiler_driver_->Create ## fn_name()); \
offset += field->size();
diff --git a/compiler/trampolines/trampoline_compiler.cc b/compiler/trampolines/trampoline_compiler.cc
index ac84d6ae40..d5225c1f73 100644
--- a/compiler/trampolines/trampoline_compiler.cc
+++ b/compiler/trampolines/trampoline_compiler.cc
@@ -30,11 +30,7 @@ namespace art {
namespace arm {
static const std::vector<uint8_t>* CreateTrampoline(EntryPointCallingConvention abi,
ThreadOffset<4> offset) {
- // NOTE: the assembler used here is ARM, not Thumb. This is because the address
- // returned by this function is a pointer and for thumb we would have to set the
- // bottom bit. It doesn't matter since the instructions generated are the same
- // size anyway.
- std::unique_ptr<ArmAssembler> assembler(static_cast<ArmAssembler*>(Assembler::Create(kArm)));
+ std::unique_ptr<ArmAssembler> assembler(static_cast<ArmAssembler*>(Assembler::Create(kThumb2)));
switch (abi) {
case kInterpreterAbi: // Thread* is first argument (R0) in interpreter ABI.