// 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);
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 =
/// @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.
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));
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";