From 468532ea115657709bc32ee498e701a4c71762d4 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Mon, 5 Aug 2013 10:56:33 -0700 Subject: Entry point clean up. Create set of entry points needed for image methods to avoid fix-up at load time: - interpreter - bridge to interpreter, bridge to compiled code - jni - dlsym lookup - quick - resolution and bridge to interpreter - portable - resolution and bridge to interpreter Fix JNI work around to use JNI work around argument rewriting code that'd been accidentally disabled. Remove abstact method error stub, use interpreter bridge instead. Consolidate trampoline (previously stub) generation in generic helper. Simplify trampolines to jump directly into assembly code, keeps stack crawlable. Dex: replace use of int with ThreadOffset for values that are thread offsets. Tidy entry point routines between interpreter, jni, quick and portable. Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e (cherry picked from commit 848871b4d8481229c32e0d048a9856e5a9a17ef9) --- compiler/driver/compiler_driver.cc | 78 +++++++++++++------------------------- 1 file changed, 26 insertions(+), 52 deletions(-) (limited to 'compiler/driver/compiler_driver.cc') diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index e7ba402b21..56b629c576 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -41,9 +41,9 @@ #include "mirror/throwable.h" #include "scoped_thread_state_change.h" #include "ScopedLocalRef.h" -#include "stubs/stubs.h" #include "thread.h" #include "thread_pool.h" +#include "trampolines/trampoline_compiler.h" #include "verifier/method_verifier.h" #if defined(ART_USE_PORTABLE_COMPILER) @@ -433,64 +433,38 @@ CompilerTls* CompilerDriver::GetTls() { return res; } +const std::vector* CompilerDriver::CreateInterpreterToInterpreterBridge() const { + return CreateTrampoline(instruction_set_, kInterpreterAbi, + INTERPRETER_ENTRYPOINT_OFFSET(pInterpreterToInterpreterBridge)); +} + +const std::vector* CompilerDriver::CreateInterpreterToCompiledCodeBridge() const { + return CreateTrampoline(instruction_set_, kInterpreterAbi, + INTERPRETER_ENTRYPOINT_OFFSET(pInterpreterToCompiledCodeBridge)); +} + +const std::vector* CompilerDriver::CreateJniDlsymLookup() const { + return CreateTrampoline(instruction_set_, kJniAbi, JNI_ENTRYPOINT_OFFSET(pDlsymLookup)); +} + const std::vector* CompilerDriver::CreatePortableResolutionTrampoline() const { - switch (instruction_set_) { - case kArm: - case kThumb2: - return arm::CreatePortableResolutionTrampoline(); - case kMips: - return mips::CreatePortableResolutionTrampoline(); - case kX86: - return x86::CreatePortableResolutionTrampoline(); - default: - LOG(FATAL) << "Unknown InstructionSet: " << instruction_set_; - return NULL; - } + return CreateTrampoline(instruction_set_, kPortableAbi, + PORTABLE_ENTRYPOINT_OFFSET(pPortableResolutionTrampoline)); } -const std::vector* CompilerDriver::CreateQuickResolutionTrampoline() const { - switch (instruction_set_) { - case kArm: - case kThumb2: - return arm::CreateQuickResolutionTrampoline(); - case kMips: - return mips::CreateQuickResolutionTrampoline(); - case kX86: - return x86::CreateQuickResolutionTrampoline(); - default: - LOG(FATAL) << "Unknown InstructionSet: " << instruction_set_; - return NULL; - } +const std::vector* CompilerDriver::CreatePortableToInterpreterBridge() const { + return CreateTrampoline(instruction_set_, kPortableAbi, + PORTABLE_ENTRYPOINT_OFFSET(pPortableToInterpreterBridge)); } -const std::vector* CompilerDriver::CreateInterpreterToInterpreterEntry() const { - switch (instruction_set_) { - case kArm: - case kThumb2: - return arm::CreateInterpreterToInterpreterEntry(); - case kMips: - return mips::CreateInterpreterToInterpreterEntry(); - case kX86: - return x86::CreateInterpreterToInterpreterEntry(); - default: - LOG(FATAL) << "Unknown InstructionSet: " << instruction_set_; - return NULL; - } +const std::vector* CompilerDriver::CreateQuickResolutionTrampoline() const { + return CreateTrampoline(instruction_set_, kQuickAbi, + QUICK_ENTRYPOINT_OFFSET(pQuickResolutionTrampoline)); } -const std::vector* CompilerDriver::CreateInterpreterToQuickEntry() const { - switch (instruction_set_) { - case kArm: - case kThumb2: - return arm::CreateInterpreterToQuickEntry(); - case kMips: - return mips::CreateInterpreterToQuickEntry(); - case kX86: - return x86::CreateInterpreterToQuickEntry(); - default: - LOG(FATAL) << "Unknown InstructionSet: " << instruction_set_; - return NULL; - } +const std::vector* CompilerDriver::CreateQuickToInterpreterBridge() const { + return CreateTrampoline(instruction_set_, kQuickAbi, + QUICK_ENTRYPOINT_OFFSET(pQuickToInterpreterBridge)); } void CompilerDriver::CompileAll(jobject class_loader, -- cgit v1.2.3-59-g8ed1b