[llvm] r233049 - [Orc] Move delta-handling for trampoline sizes into the resolver block.

Lang Hames lhames at gmail.com
Mon Mar 23 21:27:02 PDT 2015


Author: lhames
Date: Mon Mar 23 23:27:02 2015
New Revision: 233049

URL: http://llvm.org/viewvc/llvm-project?rev=233049&view=rev
Log:
[Orc] Move delta-handling for trampoline sizes into the resolver block.

This is the first step towards adding a target-independent callback
handler API.

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
    llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h
    llvm/trunk/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h?rev=233049&r1=233048&r2=233049&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h Mon Mar 23 23:27:02 2015
@@ -56,7 +56,7 @@ public:
     // Moving the trampoline ID back to the available list first means there's at
     // least one available trampoline if the compile action triggers a request for
     // a new one.
-    AvailableTrampolines.push_back(I->first - TargetT::CallSize);
+    AvailableTrampolines.push_back(I->first);
     auto CallbackHandler = std::move(I->second);
     ActiveTrampolines.erase(I);
 
@@ -140,7 +140,7 @@ public:
   CompileCallbackInfo getCompileCallback(FunctionType &FT) {
     TargetAddress TrampolineAddr = getAvailableTrampolineAddr(FT.getContext());
     auto &CallbackHandler =
-      this->ActiveTrampolines[TrampolineAddr + TargetT::CallSize];
+      this->ActiveTrampolines[TrampolineAddr];
     Constant *AddrIntVal =
       ConstantInt::get(Type::getInt64Ty(FT.getContext()), TrampolineAddr);
     Constant *AddrPtrVal =

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h?rev=233049&r1=233048&r2=233049&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/OrcTargetSupport.h Mon Mar 23 23:27:02 2015
@@ -32,8 +32,6 @@ public:
   /// @brief Get a label name from the given index.
   typedef std::function<std::string(unsigned)> LabelNameFtor;
 
-  static const unsigned CallSize = 6;
-
   /// @brief Insert the requested number of trampolines into the given module.
   /// @param M Module to insert the call block into.
   /// @param NumCalls Number of calls to create in the call block.

Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp?rev=233049&r1=233048&r2=233049&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcTargetSupport.cpp Mon Mar 23 23:27:02 2015
@@ -53,6 +53,7 @@ const char* OrcX86_64::ResolverBlockName
 
 void OrcX86_64::insertResolverBlock(
     Module &M, JITCompileCallbackManagerBase<OrcX86_64> &JCBM) {
+  const unsigned X86_64_TrampolineLength = 6;
   auto CallbackPtr = executeCompileCallback<OrcX86_64>;
   uint64_t CallbackAddr =
       static_cast<uint64_t>(reinterpret_cast<uintptr_t>(CallbackPtr));
@@ -77,6 +78,7 @@ void OrcX86_64::insertResolverBlock(
   AsmStream << "  leaq    jit_callback_manager_addr(%rip), %rdi\n"
             << "  movq    (%rdi), %rdi\n"
             << "  movq    " << ReturnAddrOffset << "(%rsp), %rsi\n"
+            << "  subq    $" << X86_64_TrampolineLength << ", %rsi\n"
             << "  movabsq $" << CallbackAddr << ", %rax\n"
             << "  callq   *%rax\n"
             << "  movq    %rax, " << ReturnAddrOffset << "(%rsp)\n";





More information about the llvm-commits mailing list