[llvm-commits] [llvm] r91626 - in /llvm/trunk: lib/ExecutionEngine/JIT/JIT.cpp lib/ExecutionEngine/JIT/JIT.h lib/ExecutionEngine/JIT/JITEmitter.cpp unittests/ExecutionEngine/JIT/JITTest.cpp

Jeffrey Yasskin jyasskin at google.com
Sun Dec 20 20:37:51 PST 2009


Thanks for the list. I'll look more later tonight or tomorrow, but in
the meantime could you send a testcase for each thing I broke? I want
to guarantee I don't break them again in the future.

Sorry for the problems.

On Sunday, December 20, 2009, nicolas geoffray
<nicolas.geoffray at gmail.com> wrote:
> Hi Jeffrey,
>
>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Dec 17 15:35:29 2009
> @@ -517,9 +517,15 @@
>    void *Actual = TheJIT->isCompilingLazily()
>      ? (void *)(intptr_t)LazyResolverFn : (void *)0;
>
> +  // TODO: Delete this when PR5737 is fixed.
> +  std::string ErrorMsg;
> +  if (TheJIT->materializeFunction(F, &ErrorMsg)) {
> +    llvm_report_error("Error reading function '" + F->getName()+
> +                      "' from bitcode file: " + ErrorMsg);
> +  }
>
> This should be guarded by a lazy compilation enabled check.
>
>
>    // If this is an external declaration, attempt to resolve the address now
>    // to place in the stub.
> -  if (F->isDeclaration() && !F->hasNotBeenReadFromBitcode()) {
> +  if (F->isDeclaration() || F->hasAvailableExternallyLinkage()) {
>
> Why remove the hasNotBeenReadFromBitcode? The hasNotBeenReadFromBitcode function verifies that the linkage of the function is GhostLinkage, which is used by lazy compilation. So users that use lazy compilation require the call to hasNotBeenReadFromBitcode.
>
>
>      Actual = TheJIT->getPointerToFunction(F);
>
>      // If we resolved the symbol to a null address (eg. a weak external)
> @@ -552,7 +558,7 @@
>    // exist yet, add it to the JIT's work list so that we can fill in the stub
>    // address later.
>    if (!Actual && !TheJIT->isCompilingLazily())
> -    if (!F->isDeclaration() || F->hasNotBeenReadFromBitcode())
> +    if (!F->isDeclaration() && !F->hasAvailableExternallyLinkage())
>        TheJIT->addPendingFunction(F);
>
> Likewise.
>
>    return Stub;
> @@ -755,9 +761,16 @@
>      void *ResultPtr = TheJIT->getPointerToGlobalIfAvailable(F);
>      if (ResultPtr) return ResultPtr;
>
> +    // TODO: Delete this when PR5737 is fixed.
> +    std::string ErrorMsg;
> +    if (TheJIT->materializeFunction(F, &ErrorMsg)) {
> +      llvm_report_error("Error reading function '" + F->getName()+
> +                        "' from bitcode file: " + ErrorMsg);
> +    }
> +
>
> Add the guard for enabled lazy compilation.
>      // If this is an external function pointer, we can force the JIT to
>      // 'compile' it, which really just adds it to the map.
> -    if (F->isDeclaration() && !F->hasNotBeenReadFromBitcode())
> +    if (F->isDeclaration() || F->hasAvailableExternallyLinkage())
>        return TheJIT->getPointerToFunction(F);
>    }
>
> Don't remove the hasNotBeenReadFromBitcode.
> Hope that still fixes the PR!
> Cheers,Nicolas
>




More information about the llvm-commits mailing list