Lines Matching defs:Stub
99 /// FunctionToLazyStubMap - Keep track of the lazy stub created for a
135 // The address given to us for the stub may not be exactly right, it
136 // might be a little bit after the stub. As such, use upper_bound to
159 // unregister the stub addresses from the StubToResolverMap in
179 /// a lazy stub. It's actually here to make it more likely that far calls
180 /// succeed, but no single stub can guarantee that. I'll remove this in a
202 /// lazy-compilation stub if it has already been created.
206 /// lazy-compilation stub, creating one on demand as needed.
209 /// getExternalFunctionStub - Return a stub for the function at the
222 /// JITCompilerFn - This function is called to resolve a stub to a compiled
223 /// address. If the LLVM Function corresponding to the stub has not yet
225 static void *JITCompilerFn(void *Stub);
229 /// Map a stub address to a specific instance of a JITResolver so that
239 /// Registers a Stub to be resolved by Resolver.
240 void RegisterStubResolver(void *Stub, JITResolver *Resolver) {
242 Map.insert(std::make_pair(Stub, Resolver));
244 /// Unregisters the Stub when it's invalidated.
245 void UnregisterStubResolver(void *Stub) {
247 Map.erase(Stub);
249 /// Returns the JITResolver instance that owns the Stub.
250 JITResolver *getResolverFromStub(void *Stub) const {
252 // The address given to us for the stub may not be exactly right, it might
253 // be a little bit after the stub. As such, use upper_bound to find it.
256 std::map<void*, JITResolver*>::const_iterator I = Map.upper_bound(Stub);
257 assert(I != Map.begin() && "This is not a known stub!");
273 /// This needs to be static so that a lazy call stub can access it with no
274 /// context except the address of the stub.
282 // When outputting a function stub in the context of some other function, we
514 /// getLazyFunctionStubIfAvailable - This returns a pointer to a function stub
519 // If we already have a stub for this function, recycle it.
523 /// getFunctionStub - This returns a pointer to a function stub, creating
528 // If we already have a lazy stub for this function, recycle it.
529 void *&Stub = state.getFunctionToLazyStubMap(locked)[F];
530 if (Stub) return Stub;
538 // to place in the stub.
543 // don't emit a stub. Return a null pointer to the application.
549 // Codegen a new stub, calling the lazy resolver or the actual address of the
551 Stub = TheJIT->getJITInfo().emitFunctionStub(F, Actual, JE);
555 // If we are getting the stub for an external function, we really want the
556 // address of the stub in the GlobalAddressMap for the JIT, not the address
558 TheJIT->updateGlobalMapping(F, Stub);
561 DEBUG(dbgs() << "JIT: Lazy stub emitted at [" << Stub << "] for function '"
567 StubToResolverMap->RegisterStubResolver(Stub, this);
569 // Finally, keep track of the stub-to-Function mapping so that the
571 state.AddCallSite(locked, Stub, F);
575 // stub address later.
581 return Stub;
589 // If we already have a stub for this global variable, recycle it.
603 /// getExternalFunctionStub - Return a stub for the function at the
606 // If we already have a stub for this function, recycle it.
607 void *&Stub = ExternalFnToStubMap[FnAddr];
608 if (Stub) return Stub;
612 Stub = TheJIT->getJITInfo().emitFunctionStub(0, FnAddr, JE);
615 DEBUG(dbgs() << "JIT: Stub emitted at [" << Stub
617 return Stub;
631 /// JITCompilerFn - This function is called when a lazy compilation stub has
632 /// been entered. It looks up which function this stub corresponds to, compiles
634 void *JITResolver::JITCompilerFn(void *Stub) {
635 JITResolver *JR = StubToResolverMap->getResolverFromStub(Stub);
647 // The address given to us for the stub may not be exactly right, it might
648 // be a little bit after the stub. As such, use upper_bound to find it.
650 JR->state.LookupFunctionFromCallSite(locked, Stub);
669 << "' In stub ptr = " << Stub << " actual ptr = "
685 // FIXME: We could rewrite all references to this stub if we knew them.
688 // same GOT entry as the stub so that later clients may update the GOT
689 // if they see it still using the stub address.
692 if(JR->revGOTMap.find(Stub) != JR->revGOTMap.end())
693 JR->revGOTMap[Result] = JR->revGOTMap[Stub];
714 // Return the function stub if it's already created. We do this first so
716 // call. TODO: Yes, this is wrong. The lazy stub isn't guaranteed to be
734 // Otherwise, we may need a to emit a stub, and, conservatively, we always do
741 // Make sure GV is emitted first, and create a stub containing the fully
851 // If the target REALLY wants a stub for this function, emit it now.
1205 assert(CurBufferPtr != BufferEnd && "Stub overflowed allocated space.");
1270 // a stub to implement lazy compilation if available.
1277 // Get a stub if the target supports it.
1284 // Get the empty stub we generated earlier.
1287 void *Stub = JE->getJITResolver().getLazyFunctionStub(F);
1289 assert(Addr != Stub && "Function must have non-stub address to be updated.");
1291 // Tell the target jit info to rewrite the stub at the specified address,
1294 JE->startGVStub(Stub, layout.Size);