LLVM API Documentation

MCJIT.cpp
Go to the documentation of this file.
00001 //===-- MCJIT.cpp - MC-based Just-in-Time Compiler ------------------------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #include "MCJIT.h"
00011 #include "llvm/ExecutionEngine/GenericValue.h"
00012 #include "llvm/ExecutionEngine/JITEventListener.h"
00013 #include "llvm/ExecutionEngine/MCJIT.h"
00014 #include "llvm/ExecutionEngine/ObjectBuffer.h"
00015 #include "llvm/ExecutionEngine/ObjectImage.h"
00016 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
00017 #include "llvm/IR/DataLayout.h"
00018 #include "llvm/IR/DerivedTypes.h"
00019 #include "llvm/IR/Function.h"
00020 #include "llvm/IR/Mangler.h"
00021 #include "llvm/IR/Module.h"
00022 #include "llvm/MC/MCAsmInfo.h"
00023 #include "llvm/Object/Archive.h"
00024 #include "llvm/PassManager.h"
00025 #include "llvm/Support/DynamicLibrary.h"
00026 #include "llvm/Support/ErrorHandling.h"
00027 #include "llvm/Support/MemoryBuffer.h"
00028 #include "llvm/Support/MutexGuard.h"
00029 #include "llvm/Target/TargetLowering.h"
00030 #include "llvm/Target/TargetSubtargetInfo.h"
00031 
00032 using namespace llvm;
00033 
00034 namespace {
00035 
00036 static struct RegisterJIT {
00037   RegisterJIT() { MCJIT::Register(); }
00038 } JITRegistrator;
00039 
00040 }
00041 
00042 extern "C" void LLVMLinkInMCJIT() {
00043 }
00044 
00045 ExecutionEngine *MCJIT::createJIT(std::unique_ptr<Module> M,
00046                                   std::string *ErrorStr,
00047                                   RTDyldMemoryManager *MemMgr,
00048                                   std::unique_ptr<TargetMachine> TM) {
00049   // Try to register the program as a source of symbols to resolve against.
00050   //
00051   // FIXME: Don't do this here.
00052   sys::DynamicLibrary::LoadLibraryPermanently(nullptr, nullptr);
00053 
00054   return new MCJIT(std::move(M), std::move(TM),
00055                    MemMgr ? MemMgr : new SectionMemoryManager());
00056 }
00057 
00058 MCJIT::MCJIT(std::unique_ptr<Module> M, std::unique_ptr<TargetMachine> tm,
00059              RTDyldMemoryManager *MM)
00060     : ExecutionEngine(std::move(M)), TM(std::move(tm)), Ctx(nullptr),
00061       MemMgr(this, MM), Dyld(&MemMgr), ObjCache(nullptr) {
00062   // FIXME: We are managing our modules, so we do not want the base class
00063   // ExecutionEngine to manage them as well. To avoid double destruction
00064   // of the first (and only) module added in ExecutionEngine constructor
00065   // we remove it from EE and will destruct it ourselves.
00066   //
00067   // It may make sense to move our module manager (based on SmallStPtr) back
00068   // into EE if the JIT and Interpreter can live with it.
00069   // If so, additional functions: addModule, removeModule, FindFunctionNamed,
00070   // runStaticConstructorsDestructors could be moved back to EE as well.
00071   //
00072   std::unique_ptr<Module> First = std::move(Modules[0]);
00073   Modules.clear();
00074 
00075   OwnedModules.addModule(std::move(First));
00076   setDataLayout(TM->getSubtargetImpl()->getDataLayout());
00077 }
00078 
00079 MCJIT::~MCJIT() {
00080   MutexGuard locked(lock);
00081 
00082   Dyld.deregisterEHFrames();
00083 
00084   for (auto &Obj : LoadedObjects)
00085     if (Obj)
00086       NotifyFreeingObject(*Obj);
00087 
00088   Archives.clear();
00089 }
00090 
00091 void MCJIT::addModule(std::unique_ptr<Module> M) {
00092   MutexGuard locked(lock);
00093   OwnedModules.addModule(std::move(M));
00094 }
00095 
00096 bool MCJIT::removeModule(Module *M) {
00097   MutexGuard locked(lock);
00098   return OwnedModules.removeModule(M);
00099 }
00100 
00101 void MCJIT::addObjectFile(std::unique_ptr<object::ObjectFile> Obj) {
00102   std::unique_ptr<ObjectImage> LoadedObject = Dyld.loadObject(std::move(Obj));
00103   if (!LoadedObject || Dyld.hasError())
00104     report_fatal_error(Dyld.getErrorString());
00105 
00106   NotifyObjectEmitted(*LoadedObject);
00107 
00108   LoadedObjects.push_back(std::move(LoadedObject));
00109 }
00110 
00111 void MCJIT::addObjectFile(object::OwningBinary<object::ObjectFile> Obj) {
00112   addObjectFile(std::move(Obj.getBinary()));
00113   Buffers.push_back(std::move(Obj.getBuffer()));
00114 }
00115 
00116 void MCJIT::addArchive(object::OwningBinary<object::Archive> A) {
00117   Archives.push_back(std::move(A));
00118 }
00119 
00120 void MCJIT::setObjectCache(ObjectCache* NewCache) {
00121   MutexGuard locked(lock);
00122   ObjCache = NewCache;
00123 }
00124 
00125 std::unique_ptr<ObjectBufferStream> MCJIT::emitObject(Module *M) {
00126   MutexGuard locked(lock);
00127 
00128   // This must be a module which has already been added but not loaded to this
00129   // MCJIT instance, since these conditions are tested by our caller,
00130   // generateCodeForModule.
00131 
00132   PassManager PM;
00133 
00134   M->setDataLayout(TM->getSubtargetImpl()->getDataLayout());
00135   PM.add(new DataLayoutPass());
00136 
00137   // The RuntimeDyld will take ownership of this shortly
00138   std::unique_ptr<ObjectBufferStream> CompiledObject(new ObjectBufferStream());
00139 
00140   // Turn the machine code intermediate representation into bytes in memory
00141   // that may be executed.
00142   if (TM->addPassesToEmitMC(PM, Ctx, CompiledObject->getOStream(),
00143                             !getVerifyModules())) {
00144     report_fatal_error("Target does not support MC emission!");
00145   }
00146 
00147   // Initialize passes.
00148   PM.run(*M);
00149   // Flush the output buffer to get the generated code into memory
00150   CompiledObject->flush();
00151 
00152   // If we have an object cache, tell it about the new object.
00153   // Note that we're using the compiled image, not the loaded image (as below).
00154   if (ObjCache) {
00155     // MemoryBuffer is a thin wrapper around the actual memory, so it's OK
00156     // to create a temporary object here and delete it after the call.
00157     MemoryBufferRef MB = CompiledObject->getMemBuffer();
00158     ObjCache->notifyObjectCompiled(M, MB);
00159   }
00160 
00161   return CompiledObject;
00162 }
00163 
00164 void MCJIT::generateCodeForModule(Module *M) {
00165   // Get a thread lock to make sure we aren't trying to load multiple times
00166   MutexGuard locked(lock);
00167 
00168   // This must be a module which has already been added to this MCJIT instance.
00169   assert(OwnedModules.ownsModule(M) &&
00170          "MCJIT::generateCodeForModule: Unknown module.");
00171 
00172   // Re-compilation is not supported
00173   if (OwnedModules.hasModuleBeenLoaded(M))
00174     return;
00175 
00176   std::unique_ptr<ObjectBuffer> ObjectToLoad;
00177   // Try to load the pre-compiled object from cache if possible
00178   if (ObjCache) {
00179     if (std::unique_ptr<MemoryBuffer> PreCompiledObject =
00180             ObjCache->getObject(M))
00181       ObjectToLoad =
00182           llvm::make_unique<ObjectBuffer>(std::move(PreCompiledObject));
00183   }
00184 
00185   // If the cache did not contain a suitable object, compile the object
00186   if (!ObjectToLoad) {
00187     ObjectToLoad = emitObject(M);
00188     assert(ObjectToLoad && "Compilation did not produce an object.");
00189   }
00190 
00191   // Load the object into the dynamic linker.
00192   // MCJIT now owns the ObjectImage pointer (via its LoadedObjects list).
00193   std::unique_ptr<ObjectImage> LoadedObject =
00194       Dyld.loadObject(std::move(ObjectToLoad));
00195   if (!LoadedObject)
00196     report_fatal_error(Dyld.getErrorString());
00197 
00198   // FIXME: Make this optional, maybe even move it to a JIT event listener
00199   LoadedObject->registerWithDebugger();
00200 
00201   NotifyObjectEmitted(*LoadedObject);
00202 
00203   LoadedObjects.push_back(std::move(LoadedObject));
00204 
00205   OwnedModules.markModuleAsLoaded(M);
00206 }
00207 
00208 void MCJIT::finalizeLoadedModules() {
00209   MutexGuard locked(lock);
00210 
00211   // Resolve any outstanding relocations.
00212   Dyld.resolveRelocations();
00213 
00214   OwnedModules.markAllLoadedModulesAsFinalized();
00215 
00216   // Register EH frame data for any module we own which has been loaded
00217   Dyld.registerEHFrames();
00218 
00219   // Set page permissions.
00220   MemMgr.finalizeMemory();
00221 }
00222 
00223 // FIXME: Rename this.
00224 void MCJIT::finalizeObject() {
00225   MutexGuard locked(lock);
00226 
00227   // Generate code for module is going to move objects out of the 'added' list,
00228   // so we need to copy that out before using it:
00229   SmallVector<Module*, 16> ModsToAdd;
00230   for (auto M : OwnedModules.added())
00231     ModsToAdd.push_back(M);
00232 
00233   for (auto M : ModsToAdd)
00234     generateCodeForModule(M);
00235 
00236   finalizeLoadedModules();
00237 }
00238 
00239 void MCJIT::finalizeModule(Module *M) {
00240   MutexGuard locked(lock);
00241 
00242   // This must be a module which has already been added to this MCJIT instance.
00243   assert(OwnedModules.ownsModule(M) && "MCJIT::finalizeModule: Unknown module.");
00244 
00245   // If the module hasn't been compiled, just do that.
00246   if (!OwnedModules.hasModuleBeenLoaded(M))
00247     generateCodeForModule(M);
00248 
00249   finalizeLoadedModules();
00250 }
00251 
00252 uint64_t MCJIT::getExistingSymbolAddress(const std::string &Name) {
00253   Mangler Mang(TM->getSubtargetImpl()->getDataLayout());
00254   SmallString<128> FullName;
00255   Mang.getNameWithPrefix(FullName, Name);
00256   return Dyld.getSymbolLoadAddress(FullName);
00257 }
00258 
00259 Module *MCJIT::findModuleForSymbol(const std::string &Name,
00260                                    bool CheckFunctionsOnly) {
00261   MutexGuard locked(lock);
00262 
00263   // If it hasn't already been generated, see if it's in one of our modules.
00264   for (ModulePtrSet::iterator I = OwnedModules.begin_added(),
00265                               E = OwnedModules.end_added();
00266        I != E; ++I) {
00267     Module *M = *I;
00268     Function *F = M->getFunction(Name);
00269     if (F && !F->isDeclaration())
00270       return M;
00271     if (!CheckFunctionsOnly) {
00272       GlobalVariable *G = M->getGlobalVariable(Name);
00273       if (G && !G->isDeclaration())
00274         return M;
00275       // FIXME: Do we need to worry about global aliases?
00276     }
00277   }
00278   // We didn't find the symbol in any of our modules.
00279   return nullptr;
00280 }
00281 
00282 uint64_t MCJIT::getSymbolAddress(const std::string &Name,
00283                                  bool CheckFunctionsOnly)
00284 {
00285   MutexGuard locked(lock);
00286 
00287   // First, check to see if we already have this symbol.
00288   uint64_t Addr = getExistingSymbolAddress(Name);
00289   if (Addr)
00290     return Addr;
00291 
00292   for (object::OwningBinary<object::Archive> &OB : Archives) {
00293     object::Archive *A = OB.getBinary().get();
00294     // Look for our symbols in each Archive
00295     object::Archive::child_iterator ChildIt = A->findSym(Name);
00296     if (ChildIt != A->child_end()) {
00297       // FIXME: Support nested archives?
00298       ErrorOr<std::unique_ptr<object::Binary>> ChildBinOrErr =
00299           ChildIt->getAsBinary();
00300       if (ChildBinOrErr.getError())
00301         continue;
00302       std::unique_ptr<object::Binary> &ChildBin = ChildBinOrErr.get();
00303       if (ChildBin->isObject()) {
00304         std::unique_ptr<object::ObjectFile> OF(
00305             static_cast<object::ObjectFile *>(ChildBin.release()));
00306         // This causes the object file to be loaded.
00307         addObjectFile(std::move(OF));
00308         // The address should be here now.
00309         Addr = getExistingSymbolAddress(Name);
00310         if (Addr)
00311           return Addr;
00312       }
00313     }
00314   }
00315 
00316   // If it hasn't already been generated, see if it's in one of our modules.
00317   Module *M = findModuleForSymbol(Name, CheckFunctionsOnly);
00318   if (M) {
00319     generateCodeForModule(M);
00320 
00321     // Check the RuntimeDyld table again, it should be there now.
00322     return getExistingSymbolAddress(Name);
00323   }
00324 
00325   // If a LazyFunctionCreator is installed, use it to get/create the function.
00326   // FIXME: Should we instead have a LazySymbolCreator callback?
00327   if (LazyFunctionCreator)
00328     Addr = (uint64_t)LazyFunctionCreator(Name);
00329 
00330   return Addr;
00331 }
00332 
00333 uint64_t MCJIT::getGlobalValueAddress(const std::string &Name) {
00334   MutexGuard locked(lock);
00335   uint64_t Result = getSymbolAddress(Name, false);
00336   if (Result != 0)
00337     finalizeLoadedModules();
00338   return Result;
00339 }
00340 
00341 uint64_t MCJIT::getFunctionAddress(const std::string &Name) {
00342   MutexGuard locked(lock);
00343   uint64_t Result = getSymbolAddress(Name, true);
00344   if (Result != 0)
00345     finalizeLoadedModules();
00346   return Result;
00347 }
00348 
00349 // Deprecated.  Use getFunctionAddress instead.
00350 void *MCJIT::getPointerToFunction(Function *F) {
00351   MutexGuard locked(lock);
00352 
00353   Mangler Mang(TM->getSubtargetImpl()->getDataLayout());
00354   SmallString<128> Name;
00355   TM->getNameWithPrefix(Name, F, Mang);
00356 
00357   if (F->isDeclaration() || F->hasAvailableExternallyLinkage()) {
00358     bool AbortOnFailure = !F->hasExternalWeakLinkage();
00359     void *Addr = getPointerToNamedFunction(Name, AbortOnFailure);
00360     updateGlobalMapping(F, Addr);
00361     return Addr;
00362   }
00363 
00364   Module *M = F->getParent();
00365   bool HasBeenAddedButNotLoaded = OwnedModules.hasModuleBeenAddedButNotLoaded(M);
00366 
00367   // Make sure the relevant module has been compiled and loaded.
00368   if (HasBeenAddedButNotLoaded)
00369     generateCodeForModule(M);
00370   else if (!OwnedModules.hasModuleBeenLoaded(M)) {
00371     // If this function doesn't belong to one of our modules, we're done.
00372     // FIXME: Asking for the pointer to a function that hasn't been registered,
00373     //        and isn't a declaration (which is handled above) should probably
00374     //        be an assertion.
00375     return nullptr;
00376   }
00377 
00378   // FIXME: Should the Dyld be retaining module information? Probably not.
00379   //
00380   // This is the accessor for the target address, so make sure to check the
00381   // load address of the symbol, not the local address.
00382   return (void*)Dyld.getSymbolLoadAddress(Name);
00383 }
00384 
00385 void MCJIT::runStaticConstructorsDestructorsInModulePtrSet(
00386     bool isDtors, ModulePtrSet::iterator I, ModulePtrSet::iterator E) {
00387   for (; I != E; ++I) {
00388     ExecutionEngine::runStaticConstructorsDestructors(**I, isDtors);
00389   }
00390 }
00391 
00392 void MCJIT::runStaticConstructorsDestructors(bool isDtors) {
00393   // Execute global ctors/dtors for each module in the program.
00394   runStaticConstructorsDestructorsInModulePtrSet(
00395       isDtors, OwnedModules.begin_added(), OwnedModules.end_added());
00396   runStaticConstructorsDestructorsInModulePtrSet(
00397       isDtors, OwnedModules.begin_loaded(), OwnedModules.end_loaded());
00398   runStaticConstructorsDestructorsInModulePtrSet(
00399       isDtors, OwnedModules.begin_finalized(), OwnedModules.end_finalized());
00400 }
00401 
00402 Function *MCJIT::FindFunctionNamedInModulePtrSet(const char *FnName,
00403                                                  ModulePtrSet::iterator I,
00404                                                  ModulePtrSet::iterator E) {
00405   for (; I != E; ++I) {
00406     if (Function *F = (*I)->getFunction(FnName))
00407       return F;
00408   }
00409   return nullptr;
00410 }
00411 
00412 Function *MCJIT::FindFunctionNamed(const char *FnName) {
00413   Function *F = FindFunctionNamedInModulePtrSet(
00414       FnName, OwnedModules.begin_added(), OwnedModules.end_added());
00415   if (!F)
00416     F = FindFunctionNamedInModulePtrSet(FnName, OwnedModules.begin_loaded(),
00417                                         OwnedModules.end_loaded());
00418   if (!F)
00419     F = FindFunctionNamedInModulePtrSet(FnName, OwnedModules.begin_finalized(),
00420                                         OwnedModules.end_finalized());
00421   return F;
00422 }
00423 
00424 GenericValue MCJIT::runFunction(Function *F,
00425                                 const std::vector<GenericValue> &ArgValues) {
00426   assert(F && "Function *F was null at entry to run()");
00427 
00428   void *FPtr = getPointerToFunction(F);
00429   assert(FPtr && "Pointer to fn's code was null after getPointerToFunction");
00430   FunctionType *FTy = F->getFunctionType();
00431   Type *RetTy = FTy->getReturnType();
00432 
00433   assert((FTy->getNumParams() == ArgValues.size() ||
00434           (FTy->isVarArg() && FTy->getNumParams() <= ArgValues.size())) &&
00435          "Wrong number of arguments passed into function!");
00436   assert(FTy->getNumParams() == ArgValues.size() &&
00437          "This doesn't support passing arguments through varargs (yet)!");
00438 
00439   // Handle some common cases first.  These cases correspond to common `main'
00440   // prototypes.
00441   if (RetTy->isIntegerTy(32) || RetTy->isVoidTy()) {
00442     switch (ArgValues.size()) {
00443     case 3:
00444       if (FTy->getParamType(0)->isIntegerTy(32) &&
00445           FTy->getParamType(1)->isPointerTy() &&
00446           FTy->getParamType(2)->isPointerTy()) {
00447         int (*PF)(int, char **, const char **) =
00448           (int(*)(int, char **, const char **))(intptr_t)FPtr;
00449 
00450         // Call the function.
00451         GenericValue rv;
00452         rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue(),
00453                                  (char **)GVTOP(ArgValues[1]),
00454                                  (const char **)GVTOP(ArgValues[2])));
00455         return rv;
00456       }
00457       break;
00458     case 2:
00459       if (FTy->getParamType(0)->isIntegerTy(32) &&
00460           FTy->getParamType(1)->isPointerTy()) {
00461         int (*PF)(int, char **) = (int(*)(int, char **))(intptr_t)FPtr;
00462 
00463         // Call the function.
00464         GenericValue rv;
00465         rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue(),
00466                                  (char **)GVTOP(ArgValues[1])));
00467         return rv;
00468       }
00469       break;
00470     case 1:
00471       if (FTy->getNumParams() == 1 &&
00472           FTy->getParamType(0)->isIntegerTy(32)) {
00473         GenericValue rv;
00474         int (*PF)(int) = (int(*)(int))(intptr_t)FPtr;
00475         rv.IntVal = APInt(32, PF(ArgValues[0].IntVal.getZExtValue()));
00476         return rv;
00477       }
00478       break;
00479     }
00480   }
00481 
00482   // Handle cases where no arguments are passed first.
00483   if (ArgValues.empty()) {
00484     GenericValue rv;
00485     switch (RetTy->getTypeID()) {
00486     default: llvm_unreachable("Unknown return type for function call!");
00487     case Type::IntegerTyID: {
00488       unsigned BitWidth = cast<IntegerType>(RetTy)->getBitWidth();
00489       if (BitWidth == 1)
00490         rv.IntVal = APInt(BitWidth, ((bool(*)())(intptr_t)FPtr)());
00491       else if (BitWidth <= 8)
00492         rv.IntVal = APInt(BitWidth, ((char(*)())(intptr_t)FPtr)());
00493       else if (BitWidth <= 16)
00494         rv.IntVal = APInt(BitWidth, ((short(*)())(intptr_t)FPtr)());
00495       else if (BitWidth <= 32)
00496         rv.IntVal = APInt(BitWidth, ((int(*)())(intptr_t)FPtr)());
00497       else if (BitWidth <= 64)
00498         rv.IntVal = APInt(BitWidth, ((int64_t(*)())(intptr_t)FPtr)());
00499       else
00500         llvm_unreachable("Integer types > 64 bits not supported");
00501       return rv;
00502     }
00503     case Type::VoidTyID:
00504       rv.IntVal = APInt(32, ((int(*)())(intptr_t)FPtr)());
00505       return rv;
00506     case Type::FloatTyID:
00507       rv.FloatVal = ((float(*)())(intptr_t)FPtr)();
00508       return rv;
00509     case Type::DoubleTyID:
00510       rv.DoubleVal = ((double(*)())(intptr_t)FPtr)();
00511       return rv;
00512     case Type::X86_FP80TyID:
00513     case Type::FP128TyID:
00514     case Type::PPC_FP128TyID:
00515       llvm_unreachable("long double not supported yet");
00516     case Type::PointerTyID:
00517       return PTOGV(((void*(*)())(intptr_t)FPtr)());
00518     }
00519   }
00520 
00521   llvm_unreachable("Full-featured argument passing not supported yet!");
00522 }
00523 
00524 void *MCJIT::getPointerToNamedFunction(StringRef Name, bool AbortOnFailure) {
00525   if (!isSymbolSearchingDisabled()) {
00526     void *ptr = MemMgr.getPointerToNamedFunction(Name, false);
00527     if (ptr)
00528       return ptr;
00529   }
00530 
00531   /// If a LazyFunctionCreator is installed, use it to get/create the function.
00532   if (LazyFunctionCreator)
00533     if (void *RP = LazyFunctionCreator(Name))
00534       return RP;
00535 
00536   if (AbortOnFailure) {
00537     report_fatal_error("Program used external function '"+Name+
00538                        "' which could not be resolved!");
00539   }
00540   return nullptr;
00541 }
00542 
00543 void MCJIT::RegisterJITEventListener(JITEventListener *L) {
00544   if (!L)
00545     return;
00546   MutexGuard locked(lock);
00547   EventListeners.push_back(L);
00548 }
00549 void MCJIT::UnregisterJITEventListener(JITEventListener *L) {
00550   if (!L)
00551     return;
00552   MutexGuard locked(lock);
00553   auto I = std::find(EventListeners.rbegin(), EventListeners.rend(), L);
00554   if (I != EventListeners.rend()) {
00555     std::swap(*I, EventListeners.back());
00556     EventListeners.pop_back();
00557   }
00558 }
00559 void MCJIT::NotifyObjectEmitted(const ObjectImage& Obj) {
00560   MutexGuard locked(lock);
00561   MemMgr.notifyObjectLoaded(this, &Obj);
00562   for (unsigned I = 0, S = EventListeners.size(); I < S; ++I) {
00563     EventListeners[I]->NotifyObjectEmitted(Obj);
00564   }
00565 }
00566 void MCJIT::NotifyFreeingObject(const ObjectImage& Obj) {
00567   MutexGuard locked(lock);
00568   for (JITEventListener *L : EventListeners)
00569     L->NotifyFreeingObject(Obj);
00570 }
00571 
00572 uint64_t LinkingMemoryManager::getSymbolAddress(const std::string &Name) {
00573   uint64_t Result = ParentEngine->getSymbolAddress(Name, false);
00574   // If the symbols wasn't found and it begins with an underscore, try again
00575   // without the underscore.
00576   if (!Result && Name[0] == '_')
00577     Result = ParentEngine->getSymbolAddress(Name.substr(1), false);
00578   if (Result)
00579     return Result;
00580   if (ParentEngine->isSymbolSearchingDisabled())
00581     return 0;
00582   return ClientMM->getSymbolAddress(Name);
00583 }