Page MenuHomePhabricator

[MCJIT] Eliminate overhead in case of multiple subsequent calls to llvm::MCJIT::getFunctionAddress

Authored by Fznamznon on Feb 2 2018, 6:36 AM.



llvm::MCJIT::finalizeLoadedModules introduces significant overhead per each
call to llvm::MCJIT::getFunctionAddress because it runs symbol relocations,
EH frames registering, and memory page permissions handling every time
although this has to be done only once.

Patch by: Andrey Lizunov.

Diff Detail

Event Timeline

Fznamznon created this revision.Feb 2 2018, 6:36 AM
etyurin added a subscriber: etyurin.Feb 2 2018, 6:40 AM
bader added a reviewer: lhames.Feb 2 2018, 6:43 AM

Did you measure overhead from this in real-world cases? If so, it would be better to fix this down in RuntimeDyld. The current fix will either do nothing, or re-apply all relocations. If we manage the relocations-to-be-applied list in RuntimeDyld properly (clearing it after each application) we should be able to always apply only the relocations that have not been applied yet.

Fznamznon abandoned this revision.Feb 22 2018, 5:24 AM

Overhead not reproduced on latest version of LLVM.