Merge "Multiple-inclusion protection for Android.common.mk" into dalvik-dev
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index ad33365..4648d44 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -17,6 +17,11 @@
LOCAL_PATH := art
TEST_COMMON_SRC_FILES := \
+ compiler/driver/compiler_driver_test.cc \
+ compiler/elf_writer_test.cc \
+ compiler/jni/jni_compiler_test.cc \
+ compiler/utils/arm/managed_register_arm_test.cc \
+ compiler/utils/x86/managed_register_x86_test.cc \
runtime/barrier_test.cc \
runtime/base/histogram_test.cc \
runtime/base/mutex_test.cc \
@@ -39,10 +44,9 @@
runtime/indirect_reference_table_test.cc \
runtime/intern_table_test.cc \
runtime/jni_internal_test.cc \
+ runtime/mem_map_test.cc \
runtime/mirror/dex_cache_test.cc \
runtime/mirror/object_test.cc \
- runtime/oat/utils/arm/managed_register_arm_test.cc \
- runtime/oat/utils/x86/managed_register_x86_test.cc \
runtime/oat_test.cc \
runtime/output_stream_test.cc \
runtime/reference_table_test.cc \
@@ -52,10 +56,7 @@
runtime/utils_test.cc \
runtime/verifier/method_verifier_test.cc \
runtime/verifier/reg_type_test.cc \
- runtime/zip_archive_test.cc \
- compiler/driver/compiler_driver_test.cc \
- compiler/elf_writer_test.cc \
- compiler/jni/jni_compiler_test.cc
+ runtime/zip_archive_test.cc
ifeq ($(ART_SEA_IR_MODE),true)
TEST_COMMON_SRC_FILES += \
@@ -67,7 +68,7 @@
TEST_HOST_SRC_FILES := \
$(TEST_COMMON_SRC_FILES) \
- runtime/oat/utils/x86/assembler_x86_test.cc
+ compiler/utils/x86/assembler_x86_test.cc
ART_HOST_TEST_EXECUTABLES :=
ART_TARGET_TEST_EXECUTABLES :=
diff --git a/compiler/Android.mk b/compiler/Android.mk
index 68223a2..95c9a69 100644
--- a/compiler/Android.mk
+++ b/compiler/Android.mk
@@ -76,12 +76,20 @@
llvm/runtime_support_builder_x86.cc \
stubs/portable/stubs.cc \
stubs/quick/stubs.cc \
+ utils/arm/assembler_arm.cc \
+ utils/arm/managed_register_arm.cc \
+ utils/assembler.cc \
+ utils/mips/assembler_mips.cc \
+ utils/mips/managed_register_mips.cc \
+ utils/x86/assembler_x86.cc \
+ utils/x86/managed_register_x86.cc \
elf_fixup.cc \
elf_stripper.cc \
elf_writer.cc \
elf_writer_quick.cc \
image_writer.cc \
- oat_writer.cc
+ oat_writer.cc \
+ vector_output_stream.cc
ifeq ($(ART_SEA_IR_MODE),true)
LIBART_COMPILER_SRC_FILES += \
diff --git a/compiler/dex/quick/arm/call_arm.cc b/compiler/dex/quick/arm/call_arm.cc
index 64ebb6a..7c3ec14 100644
--- a/compiler/dex/quick/arm/call_arm.cc
+++ b/compiler/dex/quick/arm/call_arm.cc
@@ -19,7 +19,7 @@
#include "arm_lir.h"
#include "codegen_arm.h"
#include "dex/quick/mir_to_lir-inl.h"
-#include "oat/runtime/oat_support_entrypoints.h"
+#include "entrypoints/quick/quick_entrypoints.h"
namespace art {
diff --git a/compiler/dex/quick/arm/int_arm.cc b/compiler/dex/quick/arm/int_arm.cc
index e1a77da..4bb507b 100644
--- a/compiler/dex/quick/arm/int_arm.cc
+++ b/compiler/dex/quick/arm/int_arm.cc
@@ -19,8 +19,8 @@
#include "arm_lir.h"
#include "codegen_arm.h"
#include "dex/quick/mir_to_lir-inl.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "mirror/array.h"
-#include "oat/runtime/oat_support_entrypoints.h"
namespace art {
diff --git a/compiler/dex/quick/gen_common.cc b/compiler/dex/quick/gen_common.cc
index 40db2c6..8934340 100644
--- a/compiler/dex/quick/gen_common.cc
+++ b/compiler/dex/quick/gen_common.cc
@@ -17,8 +17,8 @@
#include "dex/compiler_ir.h"
#include "dex/compiler_internals.h"
#include "dex/quick/mir_to_lir-inl.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "mirror/array.h"
-#include "oat/runtime/oat_support_entrypoints.h"
#include "verifier/method_verifier.h"
namespace art {
diff --git a/compiler/dex/quick/gen_invoke.cc b/compiler/dex/quick/gen_invoke.cc
index cae1319..91f2500 100644
--- a/compiler/dex/quick/gen_invoke.cc
+++ b/compiler/dex/quick/gen_invoke.cc
@@ -16,11 +16,11 @@
#include "dex/compiler_ir.h"
#include "dex_file-inl.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "invoke_type.h"
#include "mirror/array.h"
#include "mirror/string.h"
#include "mir_to_lir-inl.h"
-#include "oat/runtime/oat_support_entrypoints.h"
#include "x86/codegen_x86.h"
namespace art {
diff --git a/compiler/dex/quick/mips/call_mips.cc b/compiler/dex/quick/mips/call_mips.cc
index 8b375ea..b6c200c 100644
--- a/compiler/dex/quick/mips/call_mips.cc
+++ b/compiler/dex/quick/mips/call_mips.cc
@@ -18,8 +18,8 @@
#include "codegen_mips.h"
#include "dex/quick/mir_to_lir-inl.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "mips_lir.h"
-#include "oat/runtime/oat_support_entrypoints.h"
namespace art {
diff --git a/compiler/dex/quick/mips/fp_mips.cc b/compiler/dex/quick/mips/fp_mips.cc
index 6cd9acc..620527e 100644
--- a/compiler/dex/quick/mips/fp_mips.cc
+++ b/compiler/dex/quick/mips/fp_mips.cc
@@ -16,8 +16,8 @@
#include "codegen_mips.h"
#include "dex/quick/mir_to_lir-inl.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "mips_lir.h"
-#include "oat/runtime/oat_support_entrypoints.h"
namespace art {
diff --git a/compiler/dex/quick/mips/int_mips.cc b/compiler/dex/quick/mips/int_mips.cc
index ea7da60..7c8214b 100644
--- a/compiler/dex/quick/mips/int_mips.cc
+++ b/compiler/dex/quick/mips/int_mips.cc
@@ -18,9 +18,9 @@
#include "codegen_mips.h"
#include "dex/quick/mir_to_lir-inl.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "mips_lir.h"
#include "mirror/array.h"
-#include "oat/runtime/oat_support_entrypoints.h"
namespace art {
diff --git a/compiler/jni/quick/arm/calling_convention_arm.cc b/compiler/jni/quick/arm/calling_convention_arm.cc
index e9b09c5..9778293 100644
--- a/compiler/jni/quick/arm/calling_convention_arm.cc
+++ b/compiler/jni/quick/arm/calling_convention_arm.cc
@@ -16,7 +16,7 @@
#include "base/logging.h"
#include "calling_convention_arm.h"
-#include "oat/utils/arm/managed_register_arm.h"
+#include "utils/arm/managed_register_arm.h"
namespace art {
namespace arm {
diff --git a/compiler/jni/quick/calling_convention.h b/compiler/jni/quick/calling_convention.h
index d492b42..f2b7fd9 100644
--- a/compiler/jni/quick/calling_convention.h
+++ b/compiler/jni/quick/calling_convention.h
@@ -18,9 +18,9 @@
#define ART_COMPILER_JNI_QUICK_CALLING_CONVENTION_H_
#include <vector>
-#include "oat/utils/managed_register.h"
#include "stack_indirect_reference_table.h"
#include "thread.h"
+#include "utils/managed_register.h"
namespace art {
diff --git a/compiler/jni/quick/jni_compiler.cc b/compiler/jni/quick/jni_compiler.cc
index fa227f7..aeadb54 100644
--- a/compiler/jni/quick/jni_compiler.cc
+++ b/compiler/jni/quick/jni_compiler.cc
@@ -25,13 +25,13 @@
#include "dex_file-inl.h"
#include "driver/compiler_driver.h"
#include "disassembler.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "jni_internal.h"
-#include "oat/runtime/oat_support_entrypoints.h"
-#include "oat/utils/assembler.h"
-#include "oat/utils/managed_register.h"
-#include "oat/utils/arm/managed_register_arm.h"
-#include "oat/utils/mips/managed_register_mips.h"
-#include "oat/utils/x86/managed_register_x86.h"
+#include "utils/assembler.h"
+#include "utils/managed_register.h"
+#include "utils/arm/managed_register_arm.h"
+#include "utils/mips/managed_register_mips.h"
+#include "utils/x86/managed_register_x86.h"
#include "thread.h"
#include "UniquePtr.h"
diff --git a/compiler/jni/quick/mips/calling_convention_mips.cc b/compiler/jni/quick/mips/calling_convention_mips.cc
index 053ab44..0a48500 100644
--- a/compiler/jni/quick/mips/calling_convention_mips.cc
+++ b/compiler/jni/quick/mips/calling_convention_mips.cc
@@ -17,7 +17,7 @@
#include "calling_convention_mips.h"
#include "base/logging.h"
-#include "oat/utils/mips/managed_register_mips.h"
+#include "utils/mips/managed_register_mips.h"
namespace art {
namespace mips {
diff --git a/compiler/jni/quick/x86/calling_convention_x86.cc b/compiler/jni/quick/x86/calling_convention_x86.cc
index 45dd429..8b5c86d 100644
--- a/compiler/jni/quick/x86/calling_convention_x86.cc
+++ b/compiler/jni/quick/x86/calling_convention_x86.cc
@@ -17,7 +17,7 @@
#include "calling_convention_x86.h"
#include "base/logging.h"
-#include "oat/utils/x86/managed_register_x86.h"
+#include "utils/x86/managed_register_x86.h"
#include "utils.h"
namespace art {
diff --git a/compiler/llvm/runtime_support_builder.cc b/compiler/llvm/runtime_support_builder.cc
index 7299803..24e283d 100644
--- a/compiler/llvm/runtime_support_builder.cc
+++ b/compiler/llvm/runtime_support_builder.cc
@@ -20,6 +20,7 @@
#include "ir_builder.h"
#include "monitor.h"
#include "mirror/object.h"
+#include "runtime_support_llvm_func_list.h"
#include "thread.h"
#include <llvm/IR/DerivedTypes.h>
@@ -47,10 +48,7 @@
runtime_support_func_decls_[runtime_support::ID] = fn; \
} while (0);
-#include "runtime_support_llvm_func_list.h"
RUNTIME_SUPPORT_FUNC_LIST(GET_RUNTIME_SUPPORT_FUNC_DECL)
-#undef RUNTIME_SUPPORT_FUNC_LIST
-#undef GET_RUNTIME_SUPPORT_FUNC_DECL
}
diff --git a/compiler/llvm/runtime_support_llvm_func.h b/compiler/llvm/runtime_support_llvm_func.h
index 2634c68..a5ad852 100644
--- a/compiler/llvm/runtime_support_llvm_func.h
+++ b/compiler/llvm/runtime_support_llvm_func.h
@@ -17,16 +17,15 @@
#ifndef ART_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_FUNC_H_
#define ART_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_FUNC_H_
+#include "runtime_support_llvm_func_list.h"
+
namespace art {
namespace llvm {
namespace runtime_support {
enum RuntimeId {
#define DEFINE_RUNTIME_SUPPORT_FUNC_ID(ID, NAME) ID,
-#include "runtime_support_llvm_func_list.h"
RUNTIME_SUPPORT_FUNC_LIST(DEFINE_RUNTIME_SUPPORT_FUNC_ID)
-#undef RUNTIME_SUPPORT_FUNC_LIST
-#undef DEFINE_RUNTIME_SUPPORT_FUNC_ID
MAX_ID
};
diff --git a/runtime/runtime_support_llvm_func_list.h b/compiler/llvm/runtime_support_llvm_func_list.h
similarity index 94%
rename from runtime/runtime_support_llvm_func_list.h
rename to compiler/llvm/runtime_support_llvm_func_list.h
index 8b635cb..b5ac1ff 100644
--- a/runtime/runtime_support_llvm_func_list.h
+++ b/compiler/llvm/runtime_support_llvm_func_list.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_RUNTIME_SUPPORT_LLVM_FUNC_LIST_H_
-#define ART_RUNTIME_RUNTIME_SUPPORT_LLVM_FUNC_LIST_H_
+#ifndef ART_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_FUNC_LIST_H_
+#define ART_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_FUNC_LIST_H_
#define RUNTIME_SUPPORT_FUNC_LIST(V) \
V(LockObject, art_portable_lock_object_from_code) \
@@ -78,5 +78,4 @@
V(JniMethodEndWithReference, art_portable_jni_method_end_with_reference) \
V(JniMethodEndWithReferenceSynchronized, art_portable_jni_method_end_with_reference_synchronized)
-#endif // ART_RUNTIME_RUNTIME_SUPPORT_LLVM_FUNC_LIST_H_
-#undef ART_RUNTIME_RUNTIME_SUPPORT_LLVM_FUNC_LIST_H_ // the guard in this file is just for cpplint
+#endif // ART_COMPILER_LLVM_RUNTIME_SUPPORT_LLVM_FUNC_LIST_H_
diff --git a/compiler/sea_ir/instruction_nodes.h b/compiler/sea_ir/instruction_nodes.h
index 103c16f..6f9bddd 100644
--- a/compiler/sea_ir/instruction_nodes.h
+++ b/compiler/sea_ir/instruction_nodes.h
@@ -57,6 +57,7 @@
// essentially creating SSA form.
void RenameToSSA(int reg_no, InstructionNode* definition) {
definition_edges_.insert(std::pair<int, InstructionNode*>(reg_no, definition));
+ definition->AddSSAUse(this);
}
// Returns the ordered set of Instructions that define the input operands of this instruction.
// Precondition: SeaGraph.ConvertToSSA().
@@ -69,6 +70,10 @@
return ssa_uses;
}
+ virtual void AddSSAUse(InstructionNode* use) {
+ used_in_.push_back(use);
+ }
+
void Accept(IRVisitor* v) {
v->Visit(this);
v->Traverse(this);
@@ -85,11 +90,14 @@
protected:
explicit InstructionNode(const art::Instruction* in):
- SeaNode(), instruction_(in), de_def_(false), region_(NULL) { }
+ SeaNode(), instruction_(in), used_in_(), de_def_(false), region_(NULL) { }
+ void ToDotSSAEdges(std::string& result) const;
protected:
const art::Instruction* const instruction_;
std::map<int, InstructionNode* > definition_edges_;
+ // Stores pointers to instructions that use the result of the current instruction.
+ std::vector<InstructionNode*> used_in_;
bool de_def_;
Region* region_;
};
@@ -136,15 +144,7 @@
result += "style=bold";
}
result += "];\n";
- // SSA definitions:
- for (std::map<int, InstructionNode* >::const_iterator def_it = definition_edges_.begin();
- def_it != definition_edges_.end(); def_it++) {
- if (NULL != def_it->second) {
- result += def_it->second->StringId() + " -> " + StringId() +"[color=gray,label=\"";
- result += art::StringPrintf("vR = %d", def_it->first);
- result += "\"] ; // ssa edge\n";
- }
- }
+ ToDotSSAEdges(result);
}
private:
diff --git a/compiler/sea_ir/sea.cc b/compiler/sea_ir/sea.cc
index e9a3e1c..99b21f8 100644
--- a/compiler/sea_ir/sea.cc
+++ b/compiler/sea_ir/sea.cc
@@ -692,6 +692,27 @@
return sea_instructions;
}
+void InstructionNode::ToDotSSAEdges(std::string& result) const {
+ // SSA definitions:
+ for (std::map<int, InstructionNode*>::const_iterator def_it = definition_edges_.begin();
+ def_it != definition_edges_.end(); def_it++) {
+ if (NULL != def_it->second) {
+ result += def_it->second->StringId() + " -> " + StringId() + "[color=gray,label=\"";
+ result += art::StringPrintf("vR = %d", def_it->first);
+ result += "\"] ; // ssa edge\n";
+ }
+ }
+
+ // SSA used-by:
+ if (DotConversion::SaveUseEdges()) {
+ for (std::vector<InstructionNode*>::const_iterator cit = used_in_.begin();
+ cit != used_in_.end(); cit++) {
+ result += (*cit)->StringId() + " -> " + StringId() + "[color=gray,label=\"";
+ result += "\"] ; // SSA used-by edge\n";
+ }
+ }
+}
+
void InstructionNode::ToDot(std::string& result, const art::DexFile& dex_file) const {
result += "// Instruction ("+StringId()+"): \n" + StringId() +
" [label=\"" + instruction_->DumpString(&dex_file) + "\"";
@@ -699,15 +720,8 @@
result += "style=bold";
}
result += "];\n";
- // SSA definitions:
- for (std::map<int, InstructionNode* >::const_iterator def_it = definition_edges_.begin();
- def_it != definition_edges_.end(); def_it++) {
- if (NULL != def_it->second) {
- result += def_it->second->StringId() + " -> " + StringId() +"[color=gray,label=\"";
- result += art::StringPrintf("vR = %d", def_it->first);
- result += "\"] ; // ssa edge\n";
- }
- }
+
+ ToDotSSAEdges(result);
}
void InstructionNode::MarkAsDEDef() {
@@ -756,17 +770,6 @@
result += art::StringPrintf("%d", register_no_);
result += ")\"";
result += "];\n";
-
- for (std::vector<std::vector<InstructionNode*>*>::const_iterator pred_it =
- definition_edges_.begin();
- pred_it != definition_edges_.end(); pred_it++) {
- std::vector<InstructionNode*>* defs_from_pred = *pred_it;
- for (std::vector<InstructionNode* >::const_iterator def_it = defs_from_pred->begin();
- def_it != defs_from_pred->end(); def_it++) {
- result += (*def_it)->StringId() + " -> " + StringId() +"[color=gray,label=\"vR = ";
- result += art::StringPrintf("%d", GetRegisterNumber());
- result += "\"] ; // phi-ssa edge\n";
- }
- }
+ ToDotSSAEdges(result);
}
} // namespace sea_ir
diff --git a/compiler/sea_ir/sea.h b/compiler/sea_ir/sea.h
index c64703a..5cb8424 100644
--- a/compiler/sea_ir/sea.h
+++ b/compiler/sea_ir/sea.h
@@ -35,6 +35,17 @@
VISITING = -2
};
+// Stores options for turning a SEA IR graph to a .dot file.
+class DotConversion {
+ public:
+ static bool SaveUseEdges() {
+ return save_use_edges_;
+ }
+
+ private:
+ static const bool save_use_edges_ = false; // TODO: Enable per-sea graph configuration.
+};
+
class Region;
class InstructionNode;
@@ -53,6 +64,7 @@
result += StringId() +" [label=\"signature:";
result += art::StringPrintf("r%d", GetResultRegister());
result += "\"] // signature node\n";
+ ToDotSSAEdges(result);
}
int GetResultRegister() const {
@@ -98,6 +110,7 @@
definition_edges_[predecessor_id] = new std::vector<InstructionNode*>();
}
definition_edges_[predecessor_id]->push_back(definition);
+ definition->AddSSAUse(this);
}
// Returns the instruction that defines the phi register from predecessor
diff --git a/compiler/stubs/portable/stubs.cc b/compiler/stubs/portable/stubs.cc
index 69568d7..cee6847 100644
--- a/compiler/stubs/portable/stubs.cc
+++ b/compiler/stubs/portable/stubs.cc
@@ -16,11 +16,11 @@
#include "stubs/stubs.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "jni_internal.h"
-#include "oat/utils/arm/assembler_arm.h"
-#include "oat/utils/mips/assembler_mips.h"
-#include "oat/utils/x86/assembler_x86.h"
-#include "oat/runtime/oat_support_entrypoints.h"
+#include "utils/arm/assembler_arm.h"
+#include "utils/mips/assembler_mips.h"
+#include "utils/x86/assembler_x86.h"
#include "stack_indirect_reference_table.h"
#include "sirt_ref.h"
diff --git a/compiler/stubs/quick/stubs.cc b/compiler/stubs/quick/stubs.cc
index 8fc2a81..598481f 100644
--- a/compiler/stubs/quick/stubs.cc
+++ b/compiler/stubs/quick/stubs.cc
@@ -16,11 +16,11 @@
#include "stubs/stubs.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "jni_internal.h"
-#include "oat/runtime/oat_support_entrypoints.h"
-#include "oat/utils/arm/assembler_arm.h"
-#include "oat/utils/mips/assembler_mips.h"
-#include "oat/utils/x86/assembler_x86.h"
+#include "utils/arm/assembler_arm.h"
+#include "utils/mips/assembler_mips.h"
+#include "utils/x86/assembler_x86.h"
#include "sirt_ref.h"
#include "stack_indirect_reference_table.h"
diff --git a/runtime/oat/utils/arm/assembler_arm.cc b/compiler/utils/arm/assembler_arm.cc
similarity index 99%
rename from runtime/oat/utils/arm/assembler_arm.cc
rename to compiler/utils/arm/assembler_arm.cc
index 960a60d..0778cd3 100644
--- a/runtime/oat/utils/arm/assembler_arm.cc
+++ b/compiler/utils/arm/assembler_arm.cc
@@ -17,7 +17,7 @@
#include "assembler_arm.h"
#include "base/logging.h"
-#include "oat/runtime/oat_support_entrypoints.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "offsets.h"
#include "thread.h"
#include "utils.h"
diff --git a/runtime/oat/utils/arm/assembler_arm.h b/compiler/utils/arm/assembler_arm.h
similarity index 98%
rename from runtime/oat/utils/arm/assembler_arm.h
rename to compiler/utils/arm/assembler_arm.h
index b8c79d21..757a8a2 100644
--- a/runtime/oat/utils/arm/assembler_arm.h
+++ b/compiler/utils/arm/assembler_arm.h
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_UTILS_ARM_ASSEMBLER_ARM_H_
-#define ART_RUNTIME_OAT_UTILS_ARM_ASSEMBLER_ARM_H_
+#ifndef ART_COMPILER_UTILS_ARM_ASSEMBLER_ARM_H_
+#define ART_COMPILER_UTILS_ARM_ASSEMBLER_ARM_H_
#include <vector>
#include "base/logging.h"
#include "constants_arm.h"
-#include "oat/utils/arm/managed_register_arm.h"
-#include "oat/utils/assembler.h"
+#include "utils/arm/managed_register_arm.h"
+#include "utils/assembler.h"
#include "offsets.h"
#include "utils.h"
@@ -656,4 +656,4 @@
} // namespace arm
} // namespace art
-#endif // ART_RUNTIME_OAT_UTILS_ARM_ASSEMBLER_ARM_H_
+#endif // ART_COMPILER_UTILS_ARM_ASSEMBLER_ARM_H_
diff --git a/runtime/constants_arm.h b/compiler/utils/arm/constants_arm.h
similarity index 91%
rename from runtime/constants_arm.h
rename to compiler/utils/arm/constants_arm.h
index bbb9242..cc795b1 100644
--- a/runtime/constants_arm.h
+++ b/compiler/utils/arm/constants_arm.h
@@ -14,13 +14,14 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_CONSTANTS_ARM_H_
-#define ART_RUNTIME_CONSTANTS_ARM_H_
+#ifndef ART_COMPILER_UTILS_ARM_CONSTANTS_ARM_H_
+#define ART_COMPILER_UTILS_ARM_CONSTANTS_ARM_H_
#include <stdint.h>
#include <iosfwd>
+#include "arch/arm/registers_arm.h"
#include "base/casts.h"
#include "base/logging.h"
#include "globals.h"
@@ -47,36 +48,6 @@
#endif
-// Values for registers.
-enum Register {
- R0 = 0,
- R1 = 1,
- R2 = 2,
- R3 = 3,
- R4 = 4,
- R5 = 5,
- R6 = 6,
- R7 = 7,
- R8 = 8,
- R9 = 9,
- R10 = 10,
- R11 = 11,
- R12 = 12,
- R13 = 13,
- R14 = 14,
- R15 = 15,
- TR = 9, // thread register
- FP = 11,
- IP = 12,
- SP = 13,
- LR = 14,
- PC = 15,
- kNumberOfCoreRegisters = 16,
- kNoRegister = -1,
-};
-std::ostream& operator<<(std::ostream& os, const Register& rhs);
-
-
enum ScaleFactor {
TIMES_1 = 0,
TIMES_2 = 1,
@@ -84,47 +55,6 @@
TIMES_8 = 3
};
-
-// Values for single-precision floating point registers.
-enum SRegister {
- S0 = 0,
- S1 = 1,
- S2 = 2,
- S3 = 3,
- S4 = 4,
- S5 = 5,
- S6 = 6,
- S7 = 7,
- S8 = 8,
- S9 = 9,
- S10 = 10,
- S11 = 11,
- S12 = 12,
- S13 = 13,
- S14 = 14,
- S15 = 15,
- S16 = 16,
- S17 = 17,
- S18 = 18,
- S19 = 19,
- S20 = 20,
- S21 = 21,
- S22 = 22,
- S23 = 23,
- S24 = 24,
- S25 = 25,
- S26 = 26,
- S27 = 27,
- S28 = 28,
- S29 = 29,
- S30 = 30,
- S31 = 31,
- kNumberOfSRegisters = 32,
- kNoSRegister = -1,
-};
-std::ostream& operator<<(std::ostream& os, const SRegister& rhs);
-
-
// Values for double-precision floating point registers.
enum DRegister {
D0 = 0,
@@ -516,4 +446,4 @@
} // namespace arm
} // namespace art
-#endif // ART_RUNTIME_CONSTANTS_ARM_H_
+#endif // ART_COMPILER_UTILS_ARM_CONSTANTS_ARM_H_
diff --git a/runtime/oat/utils/arm/managed_register_arm.cc b/compiler/utils/arm/managed_register_arm.cc
similarity index 100%
rename from runtime/oat/utils/arm/managed_register_arm.cc
rename to compiler/utils/arm/managed_register_arm.cc
diff --git a/runtime/oat/utils/arm/managed_register_arm.h b/compiler/utils/arm/managed_register_arm.h
similarity index 97%
rename from runtime/oat/utils/arm/managed_register_arm.h
rename to compiler/utils/arm/managed_register_arm.h
index 01596bb..a496c87 100644
--- a/runtime/oat/utils/arm/managed_register_arm.h
+++ b/compiler/utils/arm/managed_register_arm.h
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_UTILS_ARM_MANAGED_REGISTER_ARM_H_
-#define ART_RUNTIME_OAT_UTILS_ARM_MANAGED_REGISTER_ARM_H_
+#ifndef ART_COMPILER_UTILS_ARM_MANAGED_REGISTER_ARM_H_
+#define ART_COMPILER_UTILS_ARM_MANAGED_REGISTER_ARM_H_
#include "base/logging.h"
#include "constants_arm.h"
-#include "oat/utils/managed_register.h"
+#include "utils/managed_register.h"
namespace art {
namespace arm {
@@ -271,4 +271,4 @@
} // namespace art
-#endif // ART_RUNTIME_OAT_UTILS_ARM_MANAGED_REGISTER_ARM_H_
+#endif // ART_COMPILER_UTILS_ARM_MANAGED_REGISTER_ARM_H_
diff --git a/runtime/oat/utils/arm/managed_register_arm_test.cc b/compiler/utils/arm/managed_register_arm_test.cc
similarity index 100%
rename from runtime/oat/utils/arm/managed_register_arm_test.cc
rename to compiler/utils/arm/managed_register_arm_test.cc
diff --git a/runtime/oat/utils/assembler.cc b/compiler/utils/assembler.cc
similarity index 100%
rename from runtime/oat/utils/assembler.cc
rename to compiler/utils/assembler.cc
diff --git a/runtime/oat/utils/assembler.h b/compiler/utils/assembler.h
similarity index 98%
rename from runtime/oat/utils/assembler.h
rename to compiler/utils/assembler.h
index 05e2732..9d79002 100644
--- a/runtime/oat/utils/assembler.h
+++ b/compiler/utils/assembler.h
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_UTILS_ASSEMBLER_H_
-#define ART_RUNTIME_OAT_UTILS_ASSEMBLER_H_
+#ifndef ART_COMPILER_UTILS_ASSEMBLER_H_
+#define ART_COMPILER_UTILS_ASSEMBLER_H_
#include <vector>
#include "base/logging.h"
#include "base/macros.h"
-#include "constants_arm.h"
-#include "constants_mips.h"
-#include "constants_x86.h"
+#include "arm/constants_arm.h"
+#include "mips/constants_mips.h"
+#include "x86/constants_x86.h"
#include "instruction_set.h"
#include "managed_register.h"
#include "memory_region.h"
@@ -456,4 +456,4 @@
} // namespace art
-#endif // ART_RUNTIME_OAT_UTILS_ASSEMBLER_H_
+#endif // ART_COMPILER_UTILS_ASSEMBLER_H_
diff --git a/runtime/oat/utils/managed_register.h b/compiler/utils/managed_register.h
similarity index 91%
rename from runtime/oat/utils/managed_register.h
rename to compiler/utils/managed_register.h
index 4dd2acd..4ad1763 100644
--- a/runtime/oat/utils/managed_register.h
+++ b/compiler/utils/managed_register.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_UTILS_MANAGED_REGISTER_H_
-#define ART_RUNTIME_OAT_UTILS_MANAGED_REGISTER_H_
+#ifndef ART_COMPILER_UTILS_MANAGED_REGISTER_H_
+#define ART_COMPILER_UTILS_MANAGED_REGISTER_H_
namespace art {
@@ -69,4 +69,4 @@
} // namespace art
-#endif // ART_RUNTIME_OAT_UTILS_MANAGED_REGISTER_H_
+#endif // ART_COMPILER_UTILS_MANAGED_REGISTER_H_
diff --git a/runtime/oat/utils/mips/assembler_mips.cc b/compiler/utils/mips/assembler_mips.cc
similarity index 97%
rename from runtime/oat/utils/mips/assembler_mips.cc
rename to compiler/utils/mips/assembler_mips.cc
index 25ba9b2..58815da 100644
--- a/runtime/oat/utils/mips/assembler_mips.cc
+++ b/compiler/utils/mips/assembler_mips.cc
@@ -17,8 +17,8 @@
#include "assembler_mips.h"
#include "base/casts.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "memory_region.h"
-#include "oat/runtime/oat_support_entrypoints.h"
#include "thread.h"
namespace art {
@@ -36,30 +36,6 @@
};
#endif
-static const char* kRegisterNames[] = {
- "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
- "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
- "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
- "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra",
-};
-std::ostream& operator<<(std::ostream& os, const Register& rhs) {
- if (rhs >= ZERO && rhs <= RA) {
- os << kRegisterNames[rhs];
- } else {
- os << "Register[" << static_cast<int>(rhs) << "]";
- }
- return os;
-}
-
-std::ostream& operator<<(std::ostream& os, const FRegister& rhs) {
- if (rhs >= F0 && rhs < kNumberOfFRegisters) {
- os << "f" << static_cast<int>(rhs);
- } else {
- os << "FRegister[" << static_cast<int>(rhs) << "]";
- }
- return os;
-}
-
std::ostream& operator<<(std::ostream& os, const DRegister& rhs) {
if (rhs >= D0 && rhs < kNumberOfDRegisters) {
os << "d" << static_cast<int>(rhs);
diff --git a/runtime/oat/utils/mips/assembler_mips.h b/compiler/utils/mips/assembler_mips.h
similarity index 98%
rename from runtime/oat/utils/mips/assembler_mips.h
rename to compiler/utils/mips/assembler_mips.h
index 8f4a33a..0f5f2fe 100644
--- a/runtime/oat/utils/mips/assembler_mips.h
+++ b/compiler/utils/mips/assembler_mips.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_UTILS_MIPS_ASSEMBLER_MIPS_H_
-#define ART_RUNTIME_OAT_UTILS_MIPS_ASSEMBLER_MIPS_H_
+#ifndef ART_COMPILER_UTILS_MIPS_ASSEMBLER_MIPS_H_
+#define ART_COMPILER_UTILS_MIPS_ASSEMBLER_MIPS_H_
#include <vector>
@@ -23,7 +23,7 @@
#include "constants_mips.h"
#include "globals.h"
#include "managed_register_mips.h"
-#include "oat/utils/assembler.h"
+#include "utils/assembler.h"
#include "offsets.h"
#include "utils.h"
@@ -504,4 +504,4 @@
} // namespace mips
} // namespace art
-#endif // ART_RUNTIME_OAT_UTILS_MIPS_ASSEMBLER_MIPS_H_
+#endif // ART_COMPILER_UTILS_MIPS_ASSEMBLER_MIPS_H_
diff --git a/runtime/constants_mips.h b/compiler/utils/mips/constants_mips.h
similarity index 61%
rename from runtime/constants_mips.h
rename to compiler/utils/mips/constants_mips.h
index fb56493..44ed5cc 100644
--- a/runtime/constants_mips.h
+++ b/compiler/utils/mips/constants_mips.h
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_CONSTANTS_MIPS_H_
-#define ART_RUNTIME_CONSTANTS_MIPS_H_
+#ifndef ART_COMPILER_UTILS_MIPS_CONSTANTS_MIPS_H_
+#define ART_COMPILER_UTILS_MIPS_CONSTANTS_MIPS_H_
#include <iosfwd>
+#include "arch/mips/registers_mips.h"
#include "base/logging.h"
#include "base/macros.h"
#include "globals.h"
@@ -26,83 +27,6 @@
namespace art {
namespace mips {
-enum Register {
- ZERO = 0,
- AT = 1, // Assembler temporary.
- V0 = 2, // Values.
- V1 = 3,
- A0 = 4, // Arguments.
- A1 = 5,
- A2 = 6,
- A3 = 7,
- T0 = 8, // Temporaries.
- T1 = 9,
- T2 = 10,
- T3 = 11,
- T4 = 12,
- T5 = 13,
- T6 = 14,
- T7 = 15,
- S0 = 16, // Saved values.
- S1 = 17,
- S2 = 18,
- S3 = 19,
- S4 = 20,
- S5 = 21,
- S6 = 22,
- S7 = 23,
- T8 = 24, // More temporaries.
- T9 = 25,
- K0 = 26, // Reserved for trap handler.
- K1 = 27,
- GP = 28, // Global pointer.
- SP = 29, // Stack pointer.
- FP = 30, // Saved value/frame pointer.
- RA = 31, // Return address.
- kNumberOfCoreRegisters = 32,
- kNoRegister = -1 // Signals an illegal register.
-};
-std::ostream& operator<<(std::ostream& os, const Register& rhs);
-
-// Values for single-precision floating point registers.
-enum FRegister {
- F0 = 0,
- F1 = 1,
- F2 = 2,
- F3 = 3,
- F4 = 4,
- F5 = 5,
- F6 = 6,
- F7 = 7,
- F8 = 8,
- F9 = 9,
- F10 = 10,
- F11 = 11,
- F12 = 12,
- F13 = 13,
- F14 = 14,
- F15 = 15,
- F16 = 16,
- F17 = 17,
- F18 = 18,
- F19 = 19,
- F20 = 20,
- F21 = 21,
- F22 = 22,
- F23 = 23,
- F24 = 24,
- F25 = 25,
- F26 = 26,
- F27 = 27,
- F28 = 28,
- F29 = 29,
- F30 = 30,
- F31 = 31,
- kNumberOfFRegisters = 32,
- kNoFRegister = -1,
-};
-std::ostream& operator<<(std::ostream& os, const FRegister& rhs);
-
// Values for double-precision floating point registers.
enum DRegister {
D0 = 0,
@@ -183,4 +107,4 @@
} // namespace mips
} // namespace art
-#endif // ART_RUNTIME_CONSTANTS_MIPS_H_
+#endif // ART_COMPILER_UTILS_MIPS_CONSTANTS_MIPS_H_
diff --git a/runtime/oat/utils/mips/managed_register_mips.cc b/compiler/utils/mips/managed_register_mips.cc
similarity index 100%
rename from runtime/oat/utils/mips/managed_register_mips.cc
rename to compiler/utils/mips/managed_register_mips.cc
diff --git a/runtime/oat/utils/mips/managed_register_mips.h b/compiler/utils/mips/managed_register_mips.h
similarity index 96%
rename from runtime/oat/utils/mips/managed_register_mips.h
rename to compiler/utils/mips/managed_register_mips.h
index b335ff9..dd55cc4 100644
--- a/runtime/oat/utils/mips/managed_register_mips.h
+++ b/compiler/utils/mips/managed_register_mips.h
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_
-#define ART_RUNTIME_OAT_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_
+#ifndef ART_COMPILER_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_
+#define ART_COMPILER_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_
#include "constants_mips.h"
-#include "oat/utils/managed_register.h"
+#include "utils/managed_register.h"
namespace art {
namespace mips {
@@ -225,4 +225,4 @@
} // namespace art
-#endif // ART_RUNTIME_OAT_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_
+#endif // ART_COMPILER_UTILS_MIPS_MANAGED_REGISTER_MIPS_H_
diff --git a/runtime/oat/utils/x86/assembler_x86.cc b/compiler/utils/x86/assembler_x86.cc
similarity index 98%
rename from runtime/oat/utils/x86/assembler_x86.cc
rename to compiler/utils/x86/assembler_x86.cc
index fd8f152..89bfeb5 100644
--- a/runtime/oat/utils/x86/assembler_x86.cc
+++ b/compiler/utils/x86/assembler_x86.cc
@@ -17,8 +17,8 @@
#include "assembler_x86.h"
#include "base/casts.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "memory_region.h"
-#include "oat/runtime/oat_support_entrypoints.h"
#include "thread.h"
namespace art {
@@ -35,18 +35,6 @@
}
};
-static const char* kRegisterNames[] = {
- "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
-};
-std::ostream& operator<<(std::ostream& os, const Register& rhs) {
- if (rhs >= EAX && rhs <= EDI) {
- os << kRegisterNames[rhs];
- } else {
- os << "Register[" << static_cast<int>(rhs) << "]";
- }
- return os;
-}
-
std::ostream& operator<<(std::ostream& os, const XmmRegister& reg) {
return os << "XMM" << static_cast<int>(reg);
}
diff --git a/runtime/oat/utils/x86/assembler_x86.h b/compiler/utils/x86/assembler_x86.h
similarity index 98%
rename from runtime/oat/utils/x86/assembler_x86.h
rename to compiler/utils/x86/assembler_x86.h
index e0fbe0e..4ba03d1 100644
--- a/runtime/oat/utils/x86/assembler_x86.h
+++ b/compiler/utils/x86/assembler_x86.h
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_UTILS_X86_ASSEMBLER_X86_H_
-#define ART_RUNTIME_OAT_UTILS_X86_ASSEMBLER_X86_H_
+#ifndef ART_COMPILER_UTILS_X86_ASSEMBLER_X86_H_
+#define ART_COMPILER_UTILS_X86_ASSEMBLER_X86_H_
#include <vector>
#include "base/macros.h"
#include "constants_x86.h"
#include "globals.h"
#include "managed_register_x86.h"
-#include "oat/utils/assembler.h"
#include "offsets.h"
+#include "utils/assembler.h"
#include "utils.h"
namespace art {
@@ -643,4 +643,4 @@
} // namespace x86
} // namespace art
-#endif // ART_RUNTIME_OAT_UTILS_X86_ASSEMBLER_X86_H_
+#endif // ART_COMPILER_UTILS_X86_ASSEMBLER_X86_H_
diff --git a/runtime/oat/utils/x86/assembler_x86_test.cc b/compiler/utils/x86/assembler_x86_test.cc
similarity index 100%
rename from runtime/oat/utils/x86/assembler_x86_test.cc
rename to compiler/utils/x86/assembler_x86_test.cc
diff --git a/runtime/constants_x86.h b/compiler/utils/x86/constants_x86.h
similarity index 86%
rename from runtime/constants_x86.h
rename to compiler/utils/x86/constants_x86.h
index bb18b6b..45c3834 100644
--- a/runtime/constants_x86.h
+++ b/compiler/utils/x86/constants_x86.h
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_CONSTANTS_X86_H_
-#define ART_RUNTIME_CONSTANTS_X86_H_
+#ifndef ART_COMPILER_UTILS_X86_CONSTANTS_X86_H_
+#define ART_COMPILER_UTILS_X86_CONSTANTS_X86_H_
#include <iosfwd>
+#include "arch/x86/registers_x86.h"
#include "base/logging.h"
#include "base/macros.h"
#include "globals.h"
@@ -26,21 +27,6 @@
namespace art {
namespace x86 {
-enum Register {
- EAX = 0,
- ECX = 1,
- EDX = 2,
- EBX = 3,
- ESP = 4,
- EBP = 5,
- ESI = 6,
- EDI = 7,
- kNumberOfCpuRegisters = 8,
- kFirstByteUnsafeRegister = 4,
- kNoRegister = -1 // Signals an illegal register.
-};
-std::ostream& operator<<(std::ostream& os, const Register& rhs);
-
enum ByteRegister {
AL = 0,
CL = 1,
@@ -137,4 +123,4 @@
} // namespace x86
} // namespace art
-#endif // ART_RUNTIME_CONSTANTS_X86_H_
+#endif // ART_COMPILER_UTILS_X86_CONSTANTS_X86_H_
diff --git a/runtime/oat/utils/x86/managed_register_x86.cc b/compiler/utils/x86/managed_register_x86.cc
similarity index 100%
rename from runtime/oat/utils/x86/managed_register_x86.cc
rename to compiler/utils/x86/managed_register_x86.cc
diff --git a/runtime/oat/utils/x86/managed_register_x86.h b/compiler/utils/x86/managed_register_x86.h
similarity index 96%
rename from runtime/oat/utils/x86/managed_register_x86.h
rename to compiler/utils/x86/managed_register_x86.h
index b564a83..0201a96 100644
--- a/runtime/oat/utils/x86/managed_register_x86.h
+++ b/compiler/utils/x86/managed_register_x86.h
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_UTILS_X86_MANAGED_REGISTER_X86_H_
-#define ART_RUNTIME_OAT_UTILS_X86_MANAGED_REGISTER_X86_H_
+#ifndef ART_COMPILER_UTILS_X86_MANAGED_REGISTER_X86_H_
+#define ART_COMPILER_UTILS_X86_MANAGED_REGISTER_X86_H_
#include "constants_x86.h"
-#include "oat/utils/managed_register.h"
+#include "utils/managed_register.h"
namespace art {
namespace x86 {
@@ -215,4 +215,4 @@
} // namespace art
-#endif // ART_RUNTIME_OAT_UTILS_X86_MANAGED_REGISTER_X86_H_
+#endif // ART_COMPILER_UTILS_X86_MANAGED_REGISTER_X86_H_
diff --git a/runtime/oat/utils/x86/managed_register_x86_test.cc b/compiler/utils/x86/managed_register_x86_test.cc
similarity index 100%
rename from runtime/oat/utils/x86/managed_register_x86_test.cc
rename to compiler/utils/x86/managed_register_x86_test.cc
diff --git a/runtime/vector_output_stream.cc b/compiler/vector_output_stream.cc
similarity index 100%
rename from runtime/vector_output_stream.cc
rename to compiler/vector_output_stream.cc
diff --git a/runtime/vector_output_stream.h b/compiler/vector_output_stream.h
similarity index 92%
rename from runtime/vector_output_stream.h
rename to compiler/vector_output_stream.h
index 7daa39f..a3f8226 100644
--- a/runtime/vector_output_stream.h
+++ b/compiler/vector_output_stream.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_VECTOR_OUTPUT_STREAM_H_
-#define ART_RUNTIME_VECTOR_OUTPUT_STREAM_H_
+#ifndef ART_COMPILER_VECTOR_OUTPUT_STREAM_H_
+#define ART_COMPILER_VECTOR_OUTPUT_STREAM_H_
#include "output_stream.h"
@@ -62,4 +62,4 @@
} // namespace art
-#endif // ART_RUNTIME_VECTOR_OUTPUT_STREAM_H_
+#endif // ART_COMPILER_VECTOR_OUTPUT_STREAM_H_
diff --git a/runtime/Android.mk b/runtime/Android.mk
index 4638e78..bc6a2ed 100644
--- a/runtime/Android.mk
+++ b/runtime/Android.mk
@@ -111,13 +111,6 @@
native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc \
native/sun_misc_Unsafe.cc \
oat.cc \
- oat/utils/arm/assembler_arm.cc \
- oat/utils/arm/managed_register_arm.cc \
- oat/utils/assembler.cc \
- oat/utils/mips/assembler_mips.cc \
- oat/utils/mips/managed_register_mips.cc \
- oat/utils/x86/assembler_x86.cc \
- oat/utils/x86/managed_register_x86.cc \
oat_file.cc \
offsets.cc \
os_linux.cc \
@@ -136,7 +129,6 @@
trace.cc \
utf.cc \
utils.cc \
- vector_output_stream.cc \
verifier/dex_gc_map.cc \
verifier/instruction_flags.cc \
verifier/method_verifier.cc \
@@ -147,23 +139,26 @@
zip_archive.cc
LIBART_COMMON_SRC_FILES += \
- oat/runtime/context.cc \
- oat/runtime/support_alloc.cc \
- oat/runtime/support_cast.cc \
- oat/runtime/support_deoptimize.cc \
- oat/runtime/support_dexcache.cc \
- oat/runtime/support_field.cc \
- oat/runtime/support_fillarray.cc \
- oat/runtime/support_instrumentation.cc \
- oat/runtime/support_invoke.cc \
- oat/runtime/support_jni.cc \
- oat/runtime/support_locks.cc \
- oat/runtime/support_math.cc \
- oat/runtime/support_proxy.cc \
- oat/runtime/support_stubs.cc \
- oat/runtime/support_thread.cc \
- oat/runtime/support_throw.cc \
- oat/runtime/support_interpreter.cc
+ arch/context.cc \
+ arch/arm/registers_arm.cc \
+ arch/x86/registers_x86.cc \
+ arch/mips/registers_mips.cc \
+ entrypoints/quick/quick_alloc_entrypoints.cc \
+ entrypoints/quick/quick_cast_entrypoints.cc \
+ entrypoints/quick/quick_deoptimization_entrypoints.cc \
+ entrypoints/quick/quick_dexcache_entrypoints.cc \
+ entrypoints/quick/quick_field_entrypoints.cc \
+ entrypoints/quick/quick_fillarray_entrypoints.cc \
+ entrypoints/quick/quick_instrumentation_entrypoints.cc \
+ entrypoints/quick/quick_interpreter_entrypoints.cc \
+ entrypoints/quick/quick_invoke_entrypoints.cc \
+ entrypoints/quick/quick_jni_entrypoints.cc \
+ entrypoints/quick/quick_lock_entrypoints.cc \
+ entrypoints/quick/quick_math_entrypoints.cc \
+ entrypoints/quick/quick_proxy_entrypoints.cc \
+ entrypoints/quick/quick_stub_entrypoints.cc \
+ entrypoints/quick/quick_thread_entrypoints.cc \
+ entrypoints/quick/quick_throw_entrypoints.cc
LIBART_TARGET_SRC_FILES := \
$(LIBART_COMMON_SRC_FILES) \
@@ -175,21 +170,21 @@
ifeq ($(TARGET_ARCH),arm)
LIBART_TARGET_SRC_FILES += \
- oat/runtime/arm/context_arm.cc.arm \
- oat/runtime/arm/oat_support_entrypoints_arm.cc \
- oat/runtime/arm/runtime_support_arm.S
+ arch/arm/context_arm.cc.arm \
+ arch/arm/quick_entrypoints_arm.S \
+ arch/arm/quick_entrypoints_init_arm.cc
else # TARGET_ARCH != arm
ifeq ($(TARGET_ARCH),x86)
LIBART_TARGET_SRC_FILES += \
- oat/runtime/x86/context_x86.cc \
- oat/runtime/x86/oat_support_entrypoints_x86.cc \
- oat/runtime/x86/runtime_support_x86.S
+ arch/x86/context_x86.cc \
+ arch/x86/quick_entrypoints_init_x86.cc \
+ arch/x86/quick_entrypoints_x86.S
else # TARGET_ARCH != x86
ifeq ($(TARGET_ARCH),mips)
LIBART_TARGET_SRC_FILES += \
- oat/runtime/mips/context_mips.cc \
- oat/runtime/mips/oat_support_entrypoints_mips.cc \
- oat/runtime/mips/runtime_support_mips.S
+ arch/mips/context_mips.cc \
+ arch/mips/quick_entrypoints_init_mips.cc \
+ arch/mips/quick_entrypoints_mips.S
else # TARGET_ARCH != mips
$(error unsupported TARGET_ARCH=$(TARGET_ARCH))
endif # TARGET_ARCH != mips
@@ -219,9 +214,9 @@
ifeq ($(HOST_ARCH),x86)
LIBART_HOST_SRC_FILES += \
- oat/runtime/x86/context_x86.cc \
- oat/runtime/x86/oat_support_entrypoints_x86.cc \
- oat/runtime/x86/runtime_support_x86.S
+ arch/x86/context_x86.cc \
+ arch/x86/quick_entrypoints_init_x86.cc \
+ arch/x86/quick_entrypoints_x86.S
else # HOST_ARCH != x86
$(error unsupported HOST_ARCH=$(HOST_ARCH))
endif # HOST_ARCH != x86
diff --git a/runtime/oat/runtime/arm/context_arm.cc b/runtime/arch/arm/context_arm.cc
similarity index 100%
rename from runtime/oat/runtime/arm/context_arm.cc
rename to runtime/arch/arm/context_arm.cc
diff --git a/runtime/oat/runtime/arm/context_arm.h b/runtime/arch/arm/context_arm.h
similarity index 84%
rename from runtime/oat/runtime/arm/context_arm.h
rename to runtime/arch/arm/context_arm.h
index 0be85e3..00651ff 100644
--- a/runtime/oat/runtime/arm/context_arm.h
+++ b/runtime/arch/arm/context_arm.h
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_RUNTIME_ARM_CONTEXT_ARM_H_
-#define ART_RUNTIME_OAT_RUNTIME_ARM_CONTEXT_ARM_H_
+#ifndef ART_RUNTIME_ARCH_ARM_CONTEXT_ARM_H_
+#define ART_RUNTIME_ARCH_ARM_CONTEXT_ARM_H_
#include "locks.h"
-#include "constants_arm.h"
-#include "oat/runtime/context.h"
+#include "arch/context.h"
+#include "base/logging.h"
+#include "registers_arm.h"
namespace art {
namespace arm {
@@ -45,7 +46,7 @@
}
virtual uintptr_t GetGPR(uint32_t reg) {
- CHECK_LT(reg, static_cast<uint32_t>(kNumberOfCoreRegisters));
+ DCHECK_LT(reg, static_cast<uint32_t>(kNumberOfCoreRegisters));
return *gprs_[reg];
}
@@ -64,4 +65,4 @@
} // namespace arm
} // namespace art
-#endif // ART_RUNTIME_OAT_RUNTIME_ARM_CONTEXT_ARM_H_
+#endif // ART_RUNTIME_ARCH_ARM_CONTEXT_ARM_H_
diff --git a/runtime/oat/runtime/arm/runtime_support_arm.S b/runtime/arch/arm/quick_entrypoints_arm.S
similarity index 100%
rename from runtime/oat/runtime/arm/runtime_support_arm.S
rename to runtime/arch/arm/quick_entrypoints_arm.S
diff --git a/runtime/oat/runtime/arm/oat_support_entrypoints_arm.cc b/runtime/arch/arm/quick_entrypoints_init_arm.cc
similarity index 98%
rename from runtime/oat/runtime/arm/oat_support_entrypoints_arm.cc
rename to runtime/arch/arm/quick_entrypoints_init_arm.cc
index 2e9453c..2f66b36 100644
--- a/runtime/oat/runtime/arm/oat_support_entrypoints_arm.cc
+++ b/runtime/arch/arm/quick_entrypoints_init_arm.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "oat/runtime/oat_support_entrypoints.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "runtime_support.h"
namespace art {
@@ -130,7 +130,7 @@
extern "C" void art_quick_throw_null_pointer_exception_from_code();
extern "C" void art_quick_throw_stack_overflow_from_code(void*);
-void InitEntryPoints(EntryPoints* points) {
+void InitEntryPoints(QuickEntryPoints* points) {
// Alloc
points->pAllocArrayFromCode = art_quick_alloc_array_from_code;
points->pAllocArrayFromCodeWithAccessCheck = art_quick_alloc_array_from_code_with_access_check;
diff --git a/runtime/arch/arm/registers_arm.cc b/runtime/arch/arm/registers_arm.cc
new file mode 100644
index 0000000..4f04647
--- /dev/null
+++ b/runtime/arch/arm/registers_arm.cc
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "registers_arm.h"
+
+#include <ostream>
+
+namespace art {
+namespace arm {
+
+static const char* kRegisterNames[] = {
+ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",
+ "fp", "ip", "sp", "lr", "pc"
+};
+std::ostream& operator<<(std::ostream& os, const Register& rhs) {
+ if (rhs >= R0 && rhs <= PC) {
+ os << kRegisterNames[rhs];
+ } else {
+ os << "Register[" << static_cast<int>(rhs) << "]";
+ }
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, const SRegister& rhs) {
+ if (rhs >= S0 && rhs < kNumberOfSRegisters) {
+ os << "s" << static_cast<int>(rhs);
+ } else {
+ os << "SRegister[" << static_cast<int>(rhs) << "]";
+ }
+ return os;
+}
+
+} // namespace arm
+} // namespace art
diff --git a/runtime/arch/arm/registers_arm.h b/runtime/arch/arm/registers_arm.h
new file mode 100644
index 0000000..932095d
--- /dev/null
+++ b/runtime/arch/arm/registers_arm.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_RUNTIME_ARCH_ARM_REGISTERS_ARM_H_
+#define ART_RUNTIME_ARCH_ARM_REGISTERS_ARM_H_
+
+#include <iosfwd>
+
+namespace art {
+namespace arm {
+
+// Values for registers.
+enum Register {
+ R0 = 0,
+ R1 = 1,
+ R2 = 2,
+ R3 = 3,
+ R4 = 4,
+ R5 = 5,
+ R6 = 6,
+ R7 = 7,
+ R8 = 8,
+ R9 = 9,
+ R10 = 10,
+ R11 = 11,
+ R12 = 12,
+ R13 = 13,
+ R14 = 14,
+ R15 = 15,
+ TR = 9, // thread register
+ FP = 11,
+ IP = 12,
+ SP = 13,
+ LR = 14,
+ PC = 15,
+ kNumberOfCoreRegisters = 16,
+ kNoRegister = -1,
+};
+std::ostream& operator<<(std::ostream& os, const Register& rhs);
+
+
+// Values for single-precision floating point registers.
+enum SRegister {
+ S0 = 0,
+ S1 = 1,
+ S2 = 2,
+ S3 = 3,
+ S4 = 4,
+ S5 = 5,
+ S6 = 6,
+ S7 = 7,
+ S8 = 8,
+ S9 = 9,
+ S10 = 10,
+ S11 = 11,
+ S12 = 12,
+ S13 = 13,
+ S14 = 14,
+ S15 = 15,
+ S16 = 16,
+ S17 = 17,
+ S18 = 18,
+ S19 = 19,
+ S20 = 20,
+ S21 = 21,
+ S22 = 22,
+ S23 = 23,
+ S24 = 24,
+ S25 = 25,
+ S26 = 26,
+ S27 = 27,
+ S28 = 28,
+ S29 = 29,
+ S30 = 30,
+ S31 = 31,
+ kNumberOfSRegisters = 32,
+ kNoSRegister = -1,
+};
+std::ostream& operator<<(std::ostream& os, const SRegister& rhs);
+
+} // namespace arm
+} // namespace art
+
+#endif // ART_RUNTIME_ARCH_ARM_REGISTERS_ARM_H_
diff --git a/runtime/oat/runtime/context.cc b/runtime/arch/context.cc
similarity index 100%
rename from runtime/oat/runtime/context.cc
rename to runtime/arch/context.cc
diff --git a/runtime/oat/runtime/context.h b/runtime/arch/context.h
similarity index 93%
rename from runtime/oat/runtime/context.h
rename to runtime/arch/context.h
index ac43e9a..91e0cd6 100644
--- a/runtime/oat/runtime/context.h
+++ b/runtime/arch/context.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_RUNTIME_CONTEXT_H_
-#define ART_RUNTIME_OAT_RUNTIME_CONTEXT_H_
+#ifndef ART_RUNTIME_ARCH_CONTEXT_H_
+#define ART_RUNTIME_ARCH_CONTEXT_H_
#include <stddef.h>
#include <stdint.h>
@@ -67,4 +67,4 @@
} // namespace art
-#endif // ART_RUNTIME_OAT_RUNTIME_CONTEXT_H_
+#endif // ART_RUNTIME_ARCH_CONTEXT_H_
diff --git a/runtime/oat/runtime/mips/context_mips.cc b/runtime/arch/mips/context_mips.cc
similarity index 100%
rename from runtime/oat/runtime/mips/context_mips.cc
rename to runtime/arch/mips/context_mips.cc
diff --git a/runtime/oat/runtime/mips/context_mips.h b/runtime/arch/mips/context_mips.h
similarity index 87%
rename from runtime/oat/runtime/mips/context_mips.h
rename to runtime/arch/mips/context_mips.h
index f27124c..5595f86 100644
--- a/runtime/oat/runtime/mips/context_mips.h
+++ b/runtime/arch/mips/context_mips.h
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_
-#define ART_RUNTIME_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_
+#ifndef ART_RUNTIME_ARCH_MIPS_CONTEXT_MIPS_H_
+#define ART_RUNTIME_ARCH_MIPS_CONTEXT_MIPS_H_
-#include "constants_mips.h"
-#include "oat/runtime/context.h"
+#include "arch/context.h"
+#include "base/logging.h"
+#include "registers_mips.h"
namespace art {
namespace mips {
@@ -61,4 +62,4 @@
} // namespace mips
} // namespace art
-#endif // ART_RUNTIME_OAT_RUNTIME_MIPS_CONTEXT_MIPS_H_
+#endif // ART_RUNTIME_ARCH_MIPS_CONTEXT_MIPS_H_
diff --git a/runtime/oat/runtime/mips/oat_support_entrypoints_mips.cc b/runtime/arch/mips/quick_entrypoints_init_mips.cc
similarity index 98%
rename from runtime/oat/runtime/mips/oat_support_entrypoints_mips.cc
rename to runtime/arch/mips/quick_entrypoints_init_mips.cc
index 8e06611..d494c65 100644
--- a/runtime/oat/runtime/mips/oat_support_entrypoints_mips.cc
+++ b/runtime/arch/mips/quick_entrypoints_init_mips.cc
@@ -14,8 +14,8 @@
* limitations under the License.
*/
+#include "entrypoints/quick/quick_entrypoints.h"
#include "runtime_support.h"
-#include "oat/runtime/oat_support_entrypoints.h"
namespace art {
@@ -132,7 +132,7 @@
extern "C" void art_quick_throw_null_pointer_exception_from_code();
extern "C" void art_quick_throw_stack_overflow_from_code(void*);
-void InitEntryPoints(EntryPoints* points) {
+void InitEntryPoints(QuickEntryPoints* points) {
// Alloc
points->pAllocArrayFromCode = art_quick_alloc_array_from_code;
points->pAllocArrayFromCodeWithAccessCheck = art_quick_alloc_array_from_code_with_access_check;
diff --git a/runtime/oat/runtime/mips/runtime_support_mips.S b/runtime/arch/mips/quick_entrypoints_mips.S
similarity index 100%
rename from runtime/oat/runtime/mips/runtime_support_mips.S
rename to runtime/arch/mips/quick_entrypoints_mips.S
diff --git a/runtime/arch/mips/registers_mips.cc b/runtime/arch/mips/registers_mips.cc
new file mode 100644
index 0000000..5d31f2f
--- /dev/null
+++ b/runtime/arch/mips/registers_mips.cc
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "registers_mips.h"
+
+#include <ostream>
+
+namespace art {
+namespace mips {
+
+static const char* kRegisterNames[] = {
+ "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
+ "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
+ "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
+ "t8", "t9", "k0", "k1", "gp", "sp", "fp", "ra",
+};
+std::ostream& operator<<(std::ostream& os, const Register& rhs) {
+ if (rhs >= ZERO && rhs <= RA) {
+ os << kRegisterNames[rhs];
+ } else {
+ os << "Register[" << static_cast<int>(rhs) << "]";
+ }
+ return os;
+}
+
+std::ostream& operator<<(std::ostream& os, const FRegister& rhs) {
+ if (rhs >= F0 && rhs < kNumberOfFRegisters) {
+ os << "f" << static_cast<int>(rhs);
+ } else {
+ os << "FRegister[" << static_cast<int>(rhs) << "]";
+ }
+ return os;
+}
+
+} // namespace mips
+} // namespace art
diff --git a/runtime/arch/mips/registers_mips.h b/runtime/arch/mips/registers_mips.h
new file mode 100644
index 0000000..0f784ed
--- /dev/null
+++ b/runtime/arch/mips/registers_mips.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_RUNTIME_ARCH_MIPS_REGISTERS_MIPS_H_
+#define ART_RUNTIME_ARCH_MIPS_REGISTERS_MIPS_H_
+
+#include <iosfwd>
+
+#include "base/logging.h"
+#include "base/macros.h"
+#include "globals.h"
+
+namespace art {
+namespace mips {
+
+enum Register {
+ ZERO = 0,
+ AT = 1, // Assembler temporary.
+ V0 = 2, // Values.
+ V1 = 3,
+ A0 = 4, // Arguments.
+ A1 = 5,
+ A2 = 6,
+ A3 = 7,
+ T0 = 8, // Temporaries.
+ T1 = 9,
+ T2 = 10,
+ T3 = 11,
+ T4 = 12,
+ T5 = 13,
+ T6 = 14,
+ T7 = 15,
+ S0 = 16, // Saved values.
+ S1 = 17,
+ S2 = 18,
+ S3 = 19,
+ S4 = 20,
+ S5 = 21,
+ S6 = 22,
+ S7 = 23,
+ T8 = 24, // More temporaries.
+ T9 = 25,
+ K0 = 26, // Reserved for trap handler.
+ K1 = 27,
+ GP = 28, // Global pointer.
+ SP = 29, // Stack pointer.
+ FP = 30, // Saved value/frame pointer.
+ RA = 31, // Return address.
+ kNumberOfCoreRegisters = 32,
+ kNoRegister = -1 // Signals an illegal register.
+};
+std::ostream& operator<<(std::ostream& os, const Register& rhs);
+
+// Values for single-precision floating point registers.
+enum FRegister {
+ F0 = 0,
+ F1 = 1,
+ F2 = 2,
+ F3 = 3,
+ F4 = 4,
+ F5 = 5,
+ F6 = 6,
+ F7 = 7,
+ F8 = 8,
+ F9 = 9,
+ F10 = 10,
+ F11 = 11,
+ F12 = 12,
+ F13 = 13,
+ F14 = 14,
+ F15 = 15,
+ F16 = 16,
+ F17 = 17,
+ F18 = 18,
+ F19 = 19,
+ F20 = 20,
+ F21 = 21,
+ F22 = 22,
+ F23 = 23,
+ F24 = 24,
+ F25 = 25,
+ F26 = 26,
+ F27 = 27,
+ F28 = 28,
+ F29 = 29,
+ F30 = 30,
+ F31 = 31,
+ kNumberOfFRegisters = 32,
+ kNoFRegister = -1,
+};
+std::ostream& operator<<(std::ostream& os, const FRegister& rhs);
+
+} // namespace mips
+} // namespace art
+
+#endif // ART_RUNTIME_ARCH_MIPS_REGISTERS_MIPS_H_
diff --git a/runtime/oat/runtime/x86/context_x86.cc b/runtime/arch/x86/context_x86.cc
similarity index 100%
rename from runtime/oat/runtime/x86/context_x86.cc
rename to runtime/arch/x86/context_x86.cc
diff --git a/runtime/oat/runtime/x86/context_x86.h b/runtime/arch/x86/context_x86.h
similarity index 84%
rename from runtime/oat/runtime/x86/context_x86.h
rename to runtime/arch/x86/context_x86.h
index 4ecfc51..d7d2210 100644
--- a/runtime/oat/runtime/x86/context_x86.h
+++ b/runtime/arch/x86/context_x86.h
@@ -14,11 +14,12 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_RUNTIME_X86_CONTEXT_X86_H_
-#define ART_RUNTIME_OAT_RUNTIME_X86_CONTEXT_X86_H_
+#ifndef ART_RUNTIME_ARCH_X86_CONTEXT_X86_H_
+#define ART_RUNTIME_ARCH_X86_CONTEXT_X86_H_
-#include "constants_x86.h"
-#include "oat/runtime/context.h"
+#include "arch/context.h"
+#include "base/logging.h"
+#include "registers_x86.h"
namespace art {
namespace x86 {
@@ -43,7 +44,8 @@
}
virtual uintptr_t GetGPR(uint32_t reg) {
- CHECK_LT(reg, static_cast<uint32_t>(kNumberOfCpuRegisters));
+ const uint32_t kNumberOfCpuRegisters = 8;
+ DCHECK_LT(reg, kNumberOfCpuRegisters);
return *gprs_[reg];
}
@@ -64,4 +66,4 @@
} // namespace x86
} // namespace art
-#endif // ART_RUNTIME_OAT_RUNTIME_X86_CONTEXT_X86_H_
+#endif // ART_RUNTIME_ARCH_X86_CONTEXT_X86_H_
diff --git a/runtime/oat/runtime/x86/oat_support_entrypoints_x86.cc b/runtime/arch/x86/quick_entrypoints_init_x86.cc
similarity index 98%
rename from runtime/oat/runtime/x86/oat_support_entrypoints_x86.cc
rename to runtime/arch/x86/quick_entrypoints_init_x86.cc
index 7dfb07c..cced916 100644
--- a/runtime/oat/runtime/x86/oat_support_entrypoints_x86.cc
+++ b/runtime/arch/x86/quick_entrypoints_init_x86.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "oat/runtime/oat_support_entrypoints.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "runtime_support.h"
namespace art {
@@ -115,7 +115,7 @@
extern "C" void art_quick_throw_null_pointer_exception_from_code();
extern "C" void art_quick_throw_stack_overflow_from_code(void*);
-void InitEntryPoints(EntryPoints* points) {
+void InitEntryPoints(QuickEntryPoints* points) {
// Alloc
points->pAllocArrayFromCode = art_quick_alloc_array_from_code;
points->pAllocArrayFromCodeWithAccessCheck = art_quick_alloc_array_from_code_with_access_check;
diff --git a/runtime/oat/runtime/x86/runtime_support_x86.S b/runtime/arch/x86/quick_entrypoints_x86.S
similarity index 100%
rename from runtime/oat/runtime/x86/runtime_support_x86.S
rename to runtime/arch/x86/quick_entrypoints_x86.S
diff --git a/runtime/arch/x86/registers_x86.cc b/runtime/arch/x86/registers_x86.cc
new file mode 100644
index 0000000..4255d64
--- /dev/null
+++ b/runtime/arch/x86/registers_x86.cc
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "registers_x86.h"
+
+#include <ostream>
+
+namespace art {
+namespace x86 {
+
+static const char* kRegisterNames[] = {
+ "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
+};
+std::ostream& operator<<(std::ostream& os, const Register& rhs) {
+ if (rhs >= EAX && rhs <= EDI) {
+ os << kRegisterNames[rhs];
+ } else {
+ os << "Register[" << static_cast<int>(rhs) << "]";
+ }
+ return os;
+}
+
+} // namespace x86
+} // namespace art
diff --git a/runtime/arch/x86/registers_x86.h b/runtime/arch/x86/registers_x86.h
new file mode 100644
index 0000000..23027ed
--- /dev/null
+++ b/runtime/arch/x86/registers_x86.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_RUNTIME_ARCH_X86_REGISTERS_X86_H_
+#define ART_RUNTIME_ARCH_X86_REGISTERS_X86_H_
+
+#include <iosfwd>
+
+#include "base/logging.h"
+#include "base/macros.h"
+#include "globals.h"
+
+namespace art {
+namespace x86 {
+
+enum Register {
+ EAX = 0,
+ ECX = 1,
+ EDX = 2,
+ EBX = 3,
+ ESP = 4,
+ EBP = 5,
+ ESI = 6,
+ EDI = 7,
+ kNumberOfCpuRegisters = 8,
+ kFirstByteUnsafeRegister = 4,
+ kNoRegister = -1 // Signals an illegal register.
+};
+std::ostream& operator<<(std::ostream& os, const Register& rhs);
+
+} // namespace x86
+} // namespace art
+
+#endif // ART_RUNTIME_ARCH_X86_REGISTERS_X86_H_
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 40033b7..72e0f48 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -1022,15 +1022,19 @@
return;
}
- // Set entry points to interpreter for methods in interpreter only mode.
if (obj->IsMethod()) {
mirror::AbstractMethod* method = obj->AsMethod();
+ // Set entry points to interpreter for methods in interpreter only mode.
if (Runtime::Current()->GetInstrumentation()->InterpretOnly() && !method->IsNative()) {
method->SetEntryPointFromInterpreter(interpreter::artInterpreterToInterpreterEntry);
if (method != Runtime::Current()->GetResolutionMethod()) {
method->SetEntryPointFromCompiledCode(GetInterpreterEntryPoint());
}
}
+ // Populate native method pointer with jni lookup stub.
+ if (method->IsNative()) {
+ method->UnregisterNative(Thread::Current());
+ }
}
}
@@ -1523,6 +1527,13 @@
// Special case to get oat code without overwriting a trampoline.
const void* ClassLinker::GetOatCodeFor(const mirror::AbstractMethod* method) {
CHECK(!method->IsAbstract()) << PrettyMethod(method);
+ if (method->IsProxyMethod()) {
+#if !defined(ART_USE_PORTABLE_COMPILER)
+ return reinterpret_cast<void*>(art_quick_proxy_invoke_handler);
+#else
+ return reinterpret_cast<void*>(art_portable_proxy_invoke_handler);
+#endif
+ }
const void* result = GetOatMethodFor(method).GetCode();
if (result == NULL) {
// No code? You must mean to go into the interpreter.
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 7ebd6a3..3591a50 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -20,6 +20,7 @@
#include <set>
+#include "arch/context.h"
#include "class_linker.h"
#include "class_linker-inl.h"
#include "dex_file-inl.h"
@@ -37,7 +38,6 @@
#include "mirror/object-inl.h"
#include "mirror/object_array-inl.h"
#include "mirror/throwable.h"
-#include "oat/runtime/context.h"
#include "object_utils.h"
#include "safe_map.h"
#include "scoped_thread_state_change.h"
diff --git a/runtime/oat/runtime/callee_save_frame.h b/runtime/entrypoints/quick/callee_save_frame.h
similarity index 87%
rename from runtime/oat/runtime/callee_save_frame.h
rename to runtime/entrypoints/quick/callee_save_frame.h
index 59f46ac..0cb578d 100644
--- a/runtime/oat/runtime/callee_save_frame.h
+++ b/runtime/entrypoints/quick/callee_save_frame.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_
-#define ART_RUNTIME_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_
+#ifndef ART_RUNTIME_ENTRYPOINTS_QUICK_CALLEE_SAVE_FRAME_H_
+#define ART_RUNTIME_ENTRYPOINTS_QUICK_CALLEE_SAVE_FRAME_H_
#include "base/mutex.h"
#include "thread-inl.h"
@@ -38,4 +38,4 @@
} // namespace art
-#endif // ART_RUNTIME_OAT_RUNTIME_CALLEE_SAVE_FRAME_H_
+#endif // ART_RUNTIME_ENTRYPOINTS_QUICK_CALLEE_SAVE_FRAME_H_
diff --git a/runtime/oat/runtime/support_alloc.cc b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_alloc.cc
rename to runtime/entrypoints/quick/quick_alloc_entrypoints.cc
diff --git a/runtime/oat/runtime/argument_visitor.h b/runtime/entrypoints/quick/quick_argument_visitor.h
similarity index 97%
rename from runtime/oat/runtime/argument_visitor.h
rename to runtime/entrypoints/quick/quick_argument_visitor.h
index aaf93f7..4f81151 100644
--- a/runtime/oat/runtime/argument_visitor.h
+++ b/runtime/entrypoints/quick/quick_argument_visitor.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_RUNTIME_ARGUMENT_VISITOR_H_
-#define ART_RUNTIME_OAT_RUNTIME_ARGUMENT_VISITOR_H_
+#ifndef ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ARGUMENT_VISITOR_H_
+#define ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ARGUMENT_VISITOR_H_
#include "object_utils.h"
@@ -245,4 +245,4 @@
} // namespace art
-#endif // ART_RUNTIME_OAT_RUNTIME_ARGUMENT_VISITOR_H_
+#endif // ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ARGUMENT_VISITOR_H_
diff --git a/runtime/oat/runtime/support_cast.cc b/runtime/entrypoints/quick/quick_cast_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_cast.cc
rename to runtime/entrypoints/quick/quick_cast_entrypoints.cc
diff --git a/runtime/oat/runtime/support_deoptimize.cc b/runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_deoptimize.cc
rename to runtime/entrypoints/quick/quick_deoptimization_entrypoints.cc
diff --git a/runtime/oat/runtime/support_dexcache.cc b/runtime/entrypoints/quick/quick_dexcache_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_dexcache.cc
rename to runtime/entrypoints/quick/quick_dexcache_entrypoints.cc
diff --git a/runtime/oat/runtime/oat_support_entrypoints.h b/runtime/entrypoints/quick/quick_entrypoints.h
similarity index 92%
rename from runtime/oat/runtime/oat_support_entrypoints.h
rename to runtime/entrypoints/quick/quick_entrypoints.h
index 546ee01..8692e92 100644
--- a/runtime/oat/runtime/oat_support_entrypoints.h
+++ b/runtime/entrypoints/quick/quick_entrypoints.h
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-#ifndef ART_RUNTIME_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_
-#define ART_RUNTIME_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_
+#ifndef ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ENTRYPOINTS_H_
+#define ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ENTRYPOINTS_H_
#include "dex_file-inl.h"
#include "runtime.h"
#define ENTRYPOINT_OFFSET(x) \
(static_cast<uintptr_t>(OFFSETOF_MEMBER(Thread, entrypoints_)) + \
- static_cast<uintptr_t>(OFFSETOF_MEMBER(EntryPoints, x)))
+ static_cast<uintptr_t>(OFFSETOF_MEMBER(QuickEntryPoints, x)))
namespace art {
namespace mirror {
@@ -35,7 +35,8 @@
class ShadowFrame;
class Thread;
-struct PACKED(4) EntryPoints {
+// Pointers to functions that are called by quick compiler generated code via thread-local storage.
+struct PACKED(4) QuickEntryPoints {
// Alloc
void* (*pAllocArrayFromCode)(uint32_t, void*, int32_t);
void* (*pAllocArrayFromCodeWithAccessCheck)(uint32_t, void*, int32_t);
@@ -166,12 +167,9 @@
jobject locked, Thread* self)
SHARED_LOCK_FUNCTION(Locks::mutator_lock_) HOT_ATTR;
-// Initialize an entry point data structure.
-void InitEntryPoints(EntryPoints* points);
-
-// Change the debugger entry point in the data structure.
-void ChangeDebuggerEntryPoint(EntryPoints* points, bool enabled);
+// Initialize an entry point data structure, architecture specific.
+void InitEntryPoints(QuickEntryPoints* points);
} // namespace art
-#endif // ART_RUNTIME_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_
+#endif // ART_RUNTIME_ENTRYPOINTS_QUICK_QUICK_ENTRYPOINTS_H_
diff --git a/runtime/oat/runtime/support_field.cc b/runtime/entrypoints/quick/quick_field_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_field.cc
rename to runtime/entrypoints/quick/quick_field_entrypoints.cc
diff --git a/runtime/oat/runtime/support_fillarray.cc b/runtime/entrypoints/quick/quick_fillarray_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_fillarray.cc
rename to runtime/entrypoints/quick/quick_fillarray_entrypoints.cc
diff --git a/runtime/oat/runtime/support_instrumentation.cc b/runtime/entrypoints/quick/quick_instrumentation_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_instrumentation.cc
rename to runtime/entrypoints/quick/quick_instrumentation_entrypoints.cc
diff --git a/runtime/oat/runtime/support_interpreter.cc b/runtime/entrypoints/quick/quick_interpreter_entrypoints.cc
similarity index 98%
rename from runtime/oat/runtime/support_interpreter.cc
rename to runtime/entrypoints/quick/quick_interpreter_entrypoints.cc
index 78b7e10..656df8d 100644
--- a/runtime/oat/runtime/support_interpreter.cc
+++ b/runtime/entrypoints/quick/quick_interpreter_entrypoints.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "argument_visitor.h"
+#include "quick_argument_visitor.h"
#include "callee_save_frame.h"
#include "dex_file-inl.h"
#include "interpreter/interpreter.h"
diff --git a/runtime/oat/runtime/support_invoke.cc b/runtime/entrypoints/quick/quick_invoke_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_invoke.cc
rename to runtime/entrypoints/quick/quick_invoke_entrypoints.cc
diff --git a/runtime/oat/runtime/support_jni.cc b/runtime/entrypoints/quick/quick_jni_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_jni.cc
rename to runtime/entrypoints/quick/quick_jni_entrypoints.cc
diff --git a/runtime/oat/runtime/support_locks.cc b/runtime/entrypoints/quick/quick_lock_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_locks.cc
rename to runtime/entrypoints/quick/quick_lock_entrypoints.cc
diff --git a/runtime/oat/runtime/support_math.cc b/runtime/entrypoints/quick/quick_math_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_math.cc
rename to runtime/entrypoints/quick/quick_math_entrypoints.cc
diff --git a/runtime/oat/runtime/support_proxy.cc b/runtime/entrypoints/quick/quick_proxy_entrypoints.cc
similarity index 98%
rename from runtime/oat/runtime/support_proxy.cc
rename to runtime/entrypoints/quick/quick_proxy_entrypoints.cc
index d4d0ca1..e4ef45f 100644
--- a/runtime/oat/runtime/support_proxy.cc
+++ b/runtime/entrypoints/quick/quick_proxy_entrypoints.cc
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "argument_visitor.h"
+#include "quick_argument_visitor.h"
#include "dex_file-inl.h"
#include "mirror/abstract_method-inl.h"
#include "mirror/object_array-inl.h"
diff --git a/runtime/oat/runtime/support_stubs.cc b/runtime/entrypoints/quick/quick_stub_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_stubs.cc
rename to runtime/entrypoints/quick/quick_stub_entrypoints.cc
diff --git a/runtime/oat/runtime/support_thread.cc b/runtime/entrypoints/quick/quick_thread_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_thread.cc
rename to runtime/entrypoints/quick/quick_thread_entrypoints.cc
diff --git a/runtime/oat/runtime/support_throw.cc b/runtime/entrypoints/quick/quick_throw_entrypoints.cc
similarity index 100%
rename from runtime/oat/runtime/support_throw.cc
rename to runtime/entrypoints/quick/quick_throw_entrypoints.cc
diff --git a/runtime/indirect_reference_table.cc b/runtime/indirect_reference_table.cc
index 0616d28..3e75716 100644
--- a/runtime/indirect_reference_table.cc
+++ b/runtime/indirect_reference_table.cc
@@ -237,7 +237,7 @@
mirror::Object* direct_pointer = reinterpret_cast<mirror::Object*>(iref);
idx = Find(direct_pointer, bottomIndex, topIndex, table_);
if (idx == -1) {
- LOG(WARNING) << "trying to work around app JNI bugs, but didn't find " << iref << " in table!";
+ LOG(WARNING) << "Trying to work around app JNI bugs, but didn't find " << iref << " in table!";
return false;
}
}
diff --git a/runtime/instrumentation.cc b/runtime/instrumentation.cc
index e99fbd8..c0b85f4 100644
--- a/runtime/instrumentation.cc
+++ b/runtime/instrumentation.cc
@@ -30,7 +30,7 @@
#include "mirror/object-inl.h"
#include "nth_caller_visitor.h"
#if !defined(ART_USE_PORTABLE_COMPILER)
-#include "oat/runtime/oat_support_entrypoints.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#endif
#include "object_utils.h"
#include "os.h"
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc
index 8d7d028..37c45fa 100644
--- a/runtime/interpreter/interpreter.cc
+++ b/runtime/interpreter/interpreter.cc
@@ -975,7 +975,9 @@
self->VerifyStack();
ThrowLocation throw_location;
mirror::Throwable* exception = self->GetException(&throw_location);
- uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock(exception->GetClass(), dex_pc);
+ bool clear_exception;
+ uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock(exception->GetClass(), dex_pc,
+ &clear_exception);
if (found_dex_pc == DexFile::kDexNoIndex) {
instrumentation->MethodUnwindEvent(self, this_object_ref.get(),
shadow_frame.GetMethod(), dex_pc);
@@ -984,6 +986,9 @@
instrumentation->ExceptionCaughtEvent(self, throw_location,
shadow_frame.GetMethod(),
found_dex_pc, exception);
+ if (clear_exception) {
+ self->ClearException();
+ }
return Instruction::At(insns + found_dex_pc);
}
}
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index 858ac34..6681d56 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -833,11 +833,7 @@
return NULL;
}
ScopedObjectAccess soa(env);
- IndirectReferenceTable& locals = soa.Env()->locals;
-
- uint32_t cookie = soa.Env()->local_ref_cookie;
- IndirectRef ref = locals.Add(cookie, soa.Decode<Object*>(obj));
- return reinterpret_cast<jobject>(ref);
+ return soa.AddLocalReference<jobject>(soa.Decode<Object*>(obj));
}
static void DeleteLocalRef(JNIEnv* env, jobject obj) {
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index 619b73c..9a34610 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -68,7 +68,9 @@
#endif
MemMap* MemMap::MapAnonymous(const char* name, byte* addr, size_t byte_count, int prot) {
- CHECK_NE(0U, byte_count);
+ if (byte_count == 0) {
+ return new MemMap(name, NULL, 0, NULL, 0, prot);
+ }
size_t page_aligned_byte_count = RoundUp(byte_count, kPageSize);
CheckMapRequest(addr, page_aligned_byte_count);
@@ -102,9 +104,11 @@
MemMap* MemMap::MapFileAtAddress(byte* addr, size_t byte_count,
int prot, int flags, int fd, off_t start, bool reuse) {
- CHECK_NE(0U, byte_count);
CHECK_NE(0, prot);
CHECK_NE(0, flags & (MAP_SHARED | MAP_PRIVATE));
+ if (byte_count == 0) {
+ return new MemMap("file", NULL, 0, NULL, 0, prot);
+ }
// Adjust 'offset' to be page-aligned as required by mmap.
int page_offset = start % kPageSize;
off_t page_aligned_offset = start - page_offset;
@@ -153,10 +157,15 @@
size_t base_size, int prot)
: name_(name), begin_(begin), size_(size), base_begin_(base_begin), base_size_(base_size),
prot_(prot) {
- CHECK(begin_ != NULL);
- CHECK_NE(size_, 0U);
- CHECK(base_begin_ != NULL);
- CHECK_NE(base_size_, 0U);
+ if (size_ == 0) {
+ CHECK(begin_ == NULL);
+ CHECK(base_begin_ == NULL);
+ CHECK_EQ(base_size_, 0U);
+ } else {
+ CHECK(begin_ != NULL);
+ CHECK(base_begin_ != NULL);
+ CHECK_NE(base_size_, 0U);
+ }
};
void MemMap::UnMapAtEnd(byte* new_end) {
diff --git a/runtime/mem_map_test.cc b/runtime/mem_map_test.cc
new file mode 100644
index 0000000..dade01b
--- /dev/null
+++ b/runtime/mem_map_test.cc
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mem_map.h"
+
+#include "UniquePtr.h"
+#include "gtest/gtest.h"
+
+namespace art {
+
+class MemMapTest : public testing::Test {};
+
+TEST_F(MemMapTest, MapAnonymousEmpty) {
+ UniquePtr<MemMap> map(MemMap::MapAnonymous("MapAnonymousEmpty",
+ NULL,
+ 0,
+ PROT_READ));
+ ASSERT_TRUE(map.get() != NULL);
+}
+
+} // namespace art
diff --git a/runtime/mirror/abstract_method.cc b/runtime/mirror/abstract_method.cc
index 58ef5f7..d08708f 100644
--- a/runtime/mirror/abstract_method.cc
+++ b/runtime/mirror/abstract_method.cc
@@ -20,6 +20,7 @@
#include "base/stringpiece.h"
#include "class-inl.h"
#include "dex_file-inl.h"
+#include "dex_instruction.h"
#include "gc/accounting/card_table-inl.h"
#include "interpreter/interpreter.h"
#include "jni_internal.h"
@@ -225,7 +226,8 @@
return 0;
}
-uint32_t AbstractMethod::FindCatchBlock(Class* exception_type, uint32_t dex_pc) const {
+uint32_t AbstractMethod::FindCatchBlock(Class* exception_type, uint32_t dex_pc,
+ bool* has_no_move_exception) const {
MethodHelper mh(this);
const DexFile::CodeItem* code_item = mh.GetCodeItem();
// Iterate over the catch handlers associated with dex_pc
@@ -242,7 +244,11 @@
LOG(WARNING) << "Unresolved exception class when finding catch block: "
<< mh.GetTypeDescriptorFromTypeIdx(iter_type_idx);
} else if (iter_exception_type->IsAssignableFrom(exception_type)) {
- return it.GetHandlerAddress();
+ uint32_t found_dex_pc = it.GetHandlerAddress();
+ const Instruction* first_catch_instr =
+ Instruction::At(&mh.GetCodeItem()->insns_[found_dex_pc]);
+ *has_no_move_exception = (first_catch_instr->Opcode() != Instruction::MOVE_EXCEPTION);
+ return found_dex_pc;
}
}
// Handler not found
diff --git a/runtime/mirror/abstract_method.h b/runtime/mirror/abstract_method.h
index bbebece..2e6e262 100644
--- a/runtime/mirror/abstract_method.h
+++ b/runtime/mirror/abstract_method.h
@@ -407,8 +407,10 @@
uintptr_t ToFirstNativeSafepointPc(const uint32_t dex_pc)
const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
- // Find the catch block for the given exception type and dex_pc
- uint32_t FindCatchBlock(Class* exception_type, uint32_t dex_pc) const
+ // Find the catch block for the given exception type and dex_pc. When a catch block is found,
+ // indicates whether the found catch block is responsible for clearing the exception or whether
+ // a move-exception instruction is present.
+ uint32_t FindCatchBlock(Class* exception_type, uint32_t dex_pc, bool* has_no_move_exception) const
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static void SetClasses(Class* java_lang_reflect_Constructor, Class* java_lang_reflect_Method);
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 35667e7..485c636 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -28,11 +28,11 @@
#include <limits>
#include <vector>
+#include "arch/arm/registers_arm.h"
+#include "arch/mips/registers_mips.h"
+#include "arch/x86/registers_x86.h"
#include "atomic.h"
#include "class_linker.h"
-#include "constants_arm.h"
-#include "constants_mips.h"
-#include "constants_x86.h"
#include "debugger.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/heap.h"
diff --git a/runtime/runtime_support_llvm.cc b/runtime/runtime_support_llvm.cc
index 9d83f9e..93396d6 100644
--- a/runtime/runtime_support_llvm.cc
+++ b/runtime/runtime_support_llvm.cc
@@ -33,7 +33,6 @@
#include "object_utils.h"
#include "reflection.h"
#include "runtime_support.h"
-#include "runtime_support_llvm_func_list.h"
#include "scoped_thread_state_change.h"
#include "thread.h"
#include "thread_list.h"
@@ -325,6 +324,12 @@
current_method,
catch_dex_pc,
exception);
+ // If the catch block has no move-exception then clear the exception for it.
+ const Instruction* first_catch_instr =
+ Instruction::At(&mh.GetCodeItem()->insns_[catch_dex_pc]);
+ if (first_catch_instr->Opcode() != Instruction::MOVE_EXCEPTION) {
+ self->ClearException();
+ }
}
return result;
}
diff --git a/runtime/scoped_thread_state_change.h b/runtime/scoped_thread_state_change.h
index 853d684..965e6b8 100644
--- a/runtime/scoped_thread_state_change.h
+++ b/runtime/scoped_thread_state_change.h
@@ -154,16 +154,11 @@
/*
* Add a local reference for an object to the indirect reference table associated with the
* current stack frame. When the native function returns, the reference will be discarded.
- * Part of the ScopedJniThreadState as native code shouldn't be working on raw Object* without
- * having transitioned its state.
*
- * We need to allow the same reference to be added multiple times.
+ * We need to allow the same reference to be added multiple times, and cope with NULL.
*
- * This will be called on otherwise unreferenced objects. We cannot do GC allocations here, and
+ * This will be called on otherwise unreferenced objects. We cannot do GC allocations here, and
* it's best if we don't grab a mutex.
- *
- * Returns the local reference (currently just the same pointer that was
- * passed in), or NULL on failure.
*/
template<typename T>
T AddLocalReference(mirror::Object* obj) const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
diff --git a/runtime/stack.cc b/runtime/stack.cc
index 286a2a6..aeb15f0 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -16,7 +16,6 @@
#include "stack.h"
-#include "oat/runtime/context.h"
#include "mirror/abstract_method-inl.h"
#include "mirror/class-inl.h"
#include "mirror/object.h"
diff --git a/runtime/stack.h b/runtime/stack.h
index 0b94f27..de93846 100644
--- a/runtime/stack.h
+++ b/runtime/stack.h
@@ -20,7 +20,7 @@
#include "dex_file.h"
#include "instrumentation.h"
#include "base/macros.h"
-#include "oat/runtime/context.h"
+#include "arch/context.h"
#include <stdint.h>
#include <string>
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 0b3a5b4..d5fdd20 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -30,6 +30,7 @@
#include <iostream>
#include <list>
+#include "arch/context.h"
#include "base/mutex.h"
#include "class_linker.h"
#include "class_linker-inl.h"
@@ -50,7 +51,6 @@
#include "mirror/object_array-inl.h"
#include "mirror/stack_trace_element.h"
#include "monitor.h"
-#include "oat/runtime/context.h"
#include "object_utils.h"
#include "reflection.h"
#include "runtime.h"
@@ -1686,7 +1686,7 @@
#undef DO_THREAD_OFFSET
size_t entry_point_count = arraysize(gThreadEntryPointInfo);
- CHECK_EQ(entry_point_count * size_of_pointers, sizeof(EntryPoints));
+ CHECK_EQ(entry_point_count * size_of_pointers, sizeof(QuickEntryPoints));
uint32_t expected_offset = OFFSETOF_MEMBER(Thread, entrypoints_);
for (size_t i = 0; i < entry_point_count; ++i) {
CHECK_EQ(gThreadEntryPointInfo[i].offset, expected_offset) << gThreadEntryPointInfo[i].name;
@@ -1709,7 +1709,7 @@
self_(self), exception_(exception), is_deoptimization_(is_deoptimization),
to_find_(is_deoptimization ? NULL : exception->GetClass()), throw_location_(throw_location),
handler_quick_frame_(NULL), handler_quick_frame_pc_(0), handler_dex_pc_(0),
- native_method_count_(0),
+ native_method_count_(0), clear_exception_(false),
method_tracing_active_(is_deoptimization ||
Runtime::Current()->GetInstrumentation()->AreExitStubsInstalled()),
instrumentation_frames_to_pop_(0), top_shadow_frame_(NULL), prev_shadow_frame_(NULL) {
@@ -1754,7 +1754,7 @@
dex_pc = GetDexPc();
}
if (dex_pc != DexFile::kDexNoIndex) {
- uint32_t found_dex_pc = method->FindCatchBlock(to_find_, dex_pc);
+ uint32_t found_dex_pc = method->FindCatchBlock(to_find_, dex_pc, &clear_exception_);
if (found_dex_pc != DexFile::kDexNoIndex) {
handler_dex_pc_ = found_dex_pc;
handler_quick_frame_pc_ = method->ToNativePc(found_dex_pc);
@@ -1820,8 +1820,13 @@
LOG(INFO) << "Handler: " << PrettyMethod(catch_method) << " (line: " << line_number << ")";
}
}
- // Put exception back in root set and clear throw location.
- self_->SetException(ThrowLocation(), exception_);
+ if (clear_exception_) {
+ // Exception was cleared as part of delivery.
+ DCHECK(!self_->IsExceptionPending());
+ } else {
+ // Put exception back in root set with clear throw location.
+ self_->SetException(ThrowLocation(), exception_);
+ }
self_->EndAssertNoThreadSuspension(last_no_assert_suspension_cause_);
// Do instrumentation events after allowing thread suspension again.
instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
@@ -1864,6 +1869,8 @@
uint32_t handler_dex_pc_;
// Number of native methods passed in crawl (equates to number of SIRTs to pop)
uint32_t native_method_count_;
+ // Should the exception be cleared as the catch block has no move-exception?
+ bool clear_exception_;
// Is method tracing active?
const bool method_tracing_active_;
// Support for nesting no thread suspension checks.
diff --git a/runtime/thread.h b/runtime/thread.h
index b9393a3..d02ab36 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -28,7 +28,7 @@
#include "base/macros.h"
#include "globals.h"
#include "jvalue.h"
-#include "oat/runtime/oat_support_entrypoints.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "locks.h"
#include "offsets.h"
#include "root_visitor.h"
@@ -775,7 +775,7 @@
public:
// Runtime support function pointers
// TODO: move this near the top, since changing its offset requires all oats to be recompiled!
- EntryPoints entrypoints_;
+ QuickEntryPoints entrypoints_;
private:
// How many times has our pthread key's destructor been called?
diff --git a/runtime/trace.cc b/runtime/trace.cc
index 177fd48..2bce70f 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -29,14 +29,14 @@
#include "mirror/dex_cache.h"
#include "mirror/object_array-inl.h"
#include "mirror/object-inl.h"
-#if !defined(ART_USE_PORTABLE_COMPILER)
-#include "oat/runtime/oat_support_entrypoints.h"
-#endif
#include "object_utils.h"
#include "os.h"
#include "scoped_thread_state_change.h"
#include "thread.h"
#include "thread_list.h"
+#if !defined(ART_USE_PORTABLE_COMPILER)
+#include "entrypoints/quick/quick_entrypoints.h"
+#endif
namespace art {
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 1481ad9..9f0d911 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -555,12 +555,6 @@
<< "exception handler starts at bad address (" << dex_pc << ")";
return false;
}
- const Instruction* inst = Instruction::At(code_item_->insns_ + dex_pc);
- if (inst->Opcode() != Instruction::MOVE_EXCEPTION) {
- Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "exception handler doesn't start with move-exception ("
- << dex_pc << ")";
- return false;
- }
insn_flags_[dex_pc].SetBranchTarget();
// Ensure exception types are resolved so that they don't need resolution to be delivered,
// unresolved exception types will be ignored by exception delivery
diff --git a/runtime/zip_archive.cc b/runtime/zip_archive.cc
index 2a48dc6..fc26f0f 100644
--- a/runtime/zip_archive.cc
+++ b/runtime/zip_archive.cc
@@ -259,6 +259,10 @@
}
bool ZipEntry::ExtractToMemory(uint8_t* begin, size_t size) {
+ // If size is zero, data offset will be meaningless, so bail out early.
+ if (size == 0) {
+ return true;
+ }
off_t data_offset = GetDataOffset();
if (data_offset == -1) {
LOG(WARNING) << "Zip: data_offset=" << data_offset;