From dd7624d2b9e599d57762d12031b10b89defc9807 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Fri, 14 Mar 2014 17:43:00 -0700 Subject: Allow mixing of thread offsets between 32 and 64bit architectures. Begin a more full implementation x86-64 REX prefixes. Doesn't implement 64bit thread offset support for the JNI compiler. Change-Id: If9af2f08a1833c21ddb4b4077f9b03add1a05147 --- compiler/driver/compiler_driver.cc | 40 ++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'compiler/driver/compiler_driver.cc') diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 59754d5a50..c367260a90 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -336,6 +336,7 @@ CompilerDriver::CompilerDriver(const CompilerOptions* compiler_options, compiler_(Compiler::Create(compiler_kind)), instruction_set_(instruction_set), instruction_set_features_(instruction_set_features), + instruction_set_is_64_bit_(instruction_set == kX86_64 || instruction_set == kArm64), freezing_constructor_lock_("freezing constructor lock"), compiled_classes_lock_("compiled classes lock"), compiled_methods_lock_("compiled method lock"), @@ -443,54 +444,55 @@ CompilerTls* CompilerDriver::GetTls() { return res; } +#define CREATE_TRAMPOLINE(type, abi, offset) \ + if (instruction_set_is_64_bit_) { \ + return CreateTrampoline64(instruction_set_, abi, \ + type ## _ENTRYPOINT_OFFSET(8, offset)); \ + } else { \ + return CreateTrampoline32(instruction_set_, abi, \ + type ## _ENTRYPOINT_OFFSET(4, offset)); \ + } + const std::vector* CompilerDriver::CreateInterpreterToInterpreterBridge() const { - return CreateTrampoline(instruction_set_, kInterpreterAbi, - INTERPRETER_ENTRYPOINT_OFFSET(pInterpreterToInterpreterBridge)); + CREATE_TRAMPOLINE(INTERPRETER, kInterpreterAbi, pInterpreterToInterpreterBridge) } const std::vector* CompilerDriver::CreateInterpreterToCompiledCodeBridge() const { - return CreateTrampoline(instruction_set_, kInterpreterAbi, - INTERPRETER_ENTRYPOINT_OFFSET(pInterpreterToCompiledCodeBridge)); + CREATE_TRAMPOLINE(INTERPRETER, kInterpreterAbi, pInterpreterToCompiledCodeBridge) } const std::vector* CompilerDriver::CreateJniDlsymLookup() const { - return CreateTrampoline(instruction_set_, kJniAbi, JNI_ENTRYPOINT_OFFSET(pDlsymLookup)); + CREATE_TRAMPOLINE(JNI, kJniAbi, pDlsymLookup) } const std::vector* CompilerDriver::CreatePortableImtConflictTrampoline() const { - return CreateTrampoline(instruction_set_, kPortableAbi, - PORTABLE_ENTRYPOINT_OFFSET(pPortableImtConflictTrampoline)); + CREATE_TRAMPOLINE(PORTABLE, kPortableAbi, pPortableImtConflictTrampoline) } const std::vector* CompilerDriver::CreatePortableResolutionTrampoline() const { - return CreateTrampoline(instruction_set_, kPortableAbi, - PORTABLE_ENTRYPOINT_OFFSET(pPortableResolutionTrampoline)); + CREATE_TRAMPOLINE(PORTABLE, kPortableAbi, pPortableResolutionTrampoline) } const std::vector* CompilerDriver::CreatePortableToInterpreterBridge() const { - return CreateTrampoline(instruction_set_, kPortableAbi, - PORTABLE_ENTRYPOINT_OFFSET(pPortableToInterpreterBridge)); + CREATE_TRAMPOLINE(PORTABLE, kPortableAbi, pPortableToInterpreterBridge) } const std::vector* CompilerDriver::CreateQuickGenericJniTrampoline() const { - return CreateTrampoline(instruction_set_, kQuickAbi, - QUICK_ENTRYPOINT_OFFSET(pQuickGenericJniTrampoline)); + CREATE_TRAMPOLINE(QUICK, kQuickAbi, pQuickGenericJniTrampoline) } const std::vector* CompilerDriver::CreateQuickImtConflictTrampoline() const { - return CreateTrampoline(instruction_set_, kQuickAbi, - QUICK_ENTRYPOINT_OFFSET(pQuickImtConflictTrampoline)); + CREATE_TRAMPOLINE(QUICK, kQuickAbi, pQuickImtConflictTrampoline) } const std::vector* CompilerDriver::CreateQuickResolutionTrampoline() const { - return CreateTrampoline(instruction_set_, kQuickAbi, - QUICK_ENTRYPOINT_OFFSET(pQuickResolutionTrampoline)); + CREATE_TRAMPOLINE(QUICK, kQuickAbi, pQuickResolutionTrampoline) } const std::vector* CompilerDriver::CreateQuickToInterpreterBridge() const { - return CreateTrampoline(instruction_set_, kQuickAbi, - QUICK_ENTRYPOINT_OFFSET(pQuickToInterpreterBridge)); + CREATE_TRAMPOLINE(QUICK, kQuickAbi, pQuickToInterpreterBridge) } +#undef CREATE_TRAMPOLINE void CompilerDriver::CompileAll(jobject class_loader, const std::vector& dex_files, -- cgit v1.2.3-59-g8ed1b