Commit Graph

78 Commits

Author SHA1 Message Date
Frederich Munch
4b1389bf38 Add platform::Demangle function. 2017-01-24 12:29:35 +01:00
Vassil Vassilev
bb2de6d3b0 Disambiguate which TargetOptions class we need.
Improves readability and works around a subtle modules bug.
2017-01-12 17:14:07 +01:00
Frederich Munch
075f4ffa83 Add cling output streams to cling/Utils/Output.h 2016-12-19 13:59:11 +01:00
Vassil Vassilev
06704a97fb Tabs. 2016-12-17 21:14:25 +01:00
Axel Naumann
2e4b59990d Move BackendPasses to IncrementalExecutor.
They need the TargetMachine - and that's in the IncrementalExecutor.
2016-11-15 16:44:32 +01:00
David Abdurachmanov
432c91f534 Set code model to Large for PowerPC64 (aka ppc64le)
This is needed because TOC and text sections can be more than 2GB
apart. LLVM SectionMemoryManager is not aware of the design limits of
ppc64le while allocating memory for JIT'ed sections. DSO limit was set
to 2GB by design. While running CMSSW ROOT/Cling puts TOC and .text.func
~2.7GB apart in VA space. Usually was triggered by TFormula in CMSSW.

IBM has modified global entry function prologue. TOC is now stored in
64-bit value before global entry to allow addressing beyond 2GB.
This was merged to Clang months ago, but is only applicable to large
code model.

Later IBM propagated this further:

- binutils patches are here:
https://sourceware.org/ml/binutils/2015-11/msg00232.html
https://sourceware.org/ml/binutils/2015-11/msg00233.html
and will be available with binutils 2.26

- GCC patch is here:
https://gcc.gnu.org/ml/gcc-patches/2015-12/msg00355.html
and will be available with GCC 6.0.

- LLVM patch is here:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20160111/324454.html
and will be available with LLVM 3.8.

- Kernel patches (module loader etc.) are here:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=a61674bdfc7c2bf909c4010699607b62b69b7bec
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2e50c4bef77511b42cc226865d6bc568fa7f8769
and will be available with Linux 4.5.

Signed-off-by: David Abdurachmanov <David.Abdurachmanov@cern.ch>
2016-11-07 13:02:51 +01:00
Roman Zulak
74cb06a22f Fixes issues where symbols can be improperly aligned for llvm::PointerIntPair Use std::pair instead of llvm::PointerIntPair.
Signed-off-by: Vassil Vassilev <vvasilev@cern.ch>
2016-10-19 13:54:07 +02:00
Roman Zulak
8f44fe40c5 Remove unnecessary StringRefs and strlen calls to construct them.
Signed-off-by: Vassil Vassilev <vvasilev@cern.ch>
2016-10-18 17:53:21 +02:00
Roman Zulak
c3869d00cc Windows: Fix looking up data symbols in process' libraries. Consolidate llvm::DynamicLibrary usage into IncrementalJIT.cpp. Add comments describing larger issue.
Signed-off-by: Vassil Vassilev <vvasilev@cern.ch>
2016-10-18 17:53:21 +02:00
Frederich Munch
57339863eb Comment out unused code in IncrementalExecutor::runStaticInitializersOnce 2016-07-22 12:44:12 +02:00
Frederich Munch
e4fc69a122 Cache function name in IncrementalExecutor::runStaticInitializersOnce. It can be non-trivial to lookup. 2016-07-22 12:44:12 +02:00
Axel Naumann
ce6206dd3b Do not access TheTarget if nullptr (Coverity 63252). 2016-07-18 11:29:36 +02:00
Axel Naumann
b58ed53837 Adapt to current llvm master. 2016-06-15 14:14:34 +02:00
Axel Naumann
7745cb17fd This plus inliner = unhappiness. 2016-06-15 14:14:34 +02:00
Axel Naumann
377498e147 llvm upgrade. Possibly revisit (debug info, frame ptr). 2016-06-15 14:14:33 +02:00
Pere Mato
1c1db3c3c9 Changed to avoid wanings when using Xcode >= 7.3 2016-03-24 11:59:43 +01:00
Elisavet Sakellari
b0bdcf4c56 First commit for the Multiple Interpreters. 2016-01-14 20:44:14 +01:00
Elisavet Sakellari
ee92892ad4 First commit for the Multiple Interpreters 2016-01-14 20:44:14 +01:00
Axel Naumann
ca23c88748 Determine OptLevel for TargetMachine from CodeGenOpts. 2015-12-15 20:24:16 +01:00
Axel Naumann
3f650b08c5 Revert "Set optimization level from -O argument when creating TargetMachine."
This reverts commit 73b3a1dbf9ef8760b9e6f335b7bbafbc21247555.
We'll use clang's parsing of -O... instead.
2015-12-15 20:24:16 +01:00
Yves Le Maout
62d51e5f8a Set optimization level from -O argument when creating TargetMachine. 2015-12-15 20:24:16 +01:00
Axel Naumann
25bbe0c617 Cache Dtor wrappers (used by ~Value); reduce calls to dlsym (ROOT-7840).
This fixes a PyROOT performance regression between 6.02 and 6.04, seen by ATLAS.

(cherry picked from commit ba4b0df02a91be4102e62fc76038711d188f07f3)

Conflicts:
	interpreter/cling/lib/Interpreter/Value.cpp
2015-12-15 20:24:16 +01:00
Philippe Canal
9a9004c501 Correct the name of bundle function of global initializer.
This correctly follow the clang commit afafe70f43dbb614f336ccbede1c4bbb132ec658
See https://root.cern.ch/gitweb?p=clang.git;a=commit;f=lib/CodeGen/CGDeclCXX.cpp;h=afafe70f43dbb614f336ccbede1c4bbb132ec658
and fixes the first attempt (75456cd17689730089526417c0d28ba4ed244f58).
2015-12-15 20:24:15 +01:00
Axel Naumann
7217f8099b Silence *calling* unresolved symbols. Handing it out already complains. 2015-08-17 18:45:02 +02:00
Bertrand Bellenot
15dda8ada2 Fix object format on Windows (thanks Axel for the hint!)
Solves the following error on Windows (as reported on the forum: https://root.cern.ch/phpBB3/viewtopic.php?f=21&t=19033):
[cling]$ int i = 0;
>>> Caught an interpreter exception!
>>> Incompatible object format!
2015-05-28 15:17:02 +02:00
Bertrand Bellenot
4d4a4b1270 Fix compilation error on Windows (MSVC doesn't support m_AtExitFuncsSpinLock = ATOMIC_FLAG_INIT; in the class definition) 2015-05-18 11:42:19 +02:00
Philippe Canal
5842d86a2f Protect IncrementalExecutor::m_AtExitFuncs with a spin lock.
This prevents:

==4150== Possible data race during write of size 8 at 0xCC136F0 by thread #3
==4150== Locks held: none
==4150==    at 0x146EC214: llvm::SmallVectorTemplateBase<cling::IncrementalExecutor::CXAAtExitElement, false>::grow(unsigned long) (in /afs/cern.ch/cms/sw/ReleaseCandidates/volB/slc6_amd64_gcc491/lcg/root/6.02.00-lnjiaj2/lib/libCling.so)
==4150==    by 0x146E9DE3: cling::IncrementalExecutor::AddAtExitFunc(void (*)(void*), void*, cling::Transaction const*) (in /afs/cern.ch/cms/sw/ReleaseCandidates/volB/slc6_amd64_gcc491/lcg/root/6.02.00-lnjiaj2/lib/libCling.so)
==4150==    by 0x160A5044: ???
==4150==    by 0x160A67D6: ???
==4150==    by 0x160A6783: ???
==4150==    by 0x145E76D3: TCling::ExecuteWithArgsAndReturn(TMethod*, void*, void const**, int, void*) const (in /afs/cern.ch/cms/sw/ReleaseCandidates/volB/slc6_amd64_gcc491/lcg/root/6.02.00-lnjiaj2/lib/libCling.so)

Conflicts:
	interpreter/cling/lib/Interpreter/IncrementalExecutor.cpp
2015-03-14 03:10:54 +01:00
Axel Naumann
3419001b9a Improve "missing symbol" error messages (ROOT-6755). 2015-02-12 18:29:16 +01:00
Axel Naumann
34c0e373dc Save JIT time. 2015-02-11 22:05:20 +01:00
Axel Naumann
ebacb03d18 Silence warning but keep code - we still need it. 2015-02-11 10:57:48 +01:00
Axel Naumann
16fe3f49dc Replace use of ExecutionEngine by OrcJIT. 2015-02-11 10:57:47 +01:00
Axel Naumann
7e2955f8de Remove unused "remap symbols". 2015-02-11 10:57:46 +01:00
Axel Naumann
8efd56133d Implement getMissingSymbolAddress(). Take ref to IncrementalExecutor.
Weak symbols can be generated after getSymbolAddress(). Instead them "error" part
now needs to go through getMissingSymbolAddress().
2015-02-11 10:57:46 +01:00
Axel Naumann
b59de8a40a Adapt to clang/llvm changes (mostly ownership). 2015-02-11 10:57:43 +01:00
Axel Naumann
9c2d9fb700 Simplify interface: no need for the llvm::Module. 2015-02-11 10:57:41 +01:00
Axel Naumann
46673943f8 MCJIT knows where to find things, do not rely on the module (which one?) 2015-02-11 10:57:40 +01:00
Axel Naumann
9bae38af55 Check for missing symbols found during relocations. 2015-02-11 10:57:37 +01:00
Axel Naumann
e919b241c8 Remove unused struct. 2015-02-11 10:57:36 +01:00
Axel Naumann
061cd37390 Provide __cxa_atexit replacement through custom MemoryManager.
On some platforms, global destructors are registered through a call to
__cxa_atexit(dtor, 0/*args*/, __dso_handle). While __cxa_atexit can be resolved
by the regular MemoryManager, __dso_handle (representing the "current shared
library" such that the corresponding atexit function can be called on its
dlclose) can not be resolved by MCJIT. Instead, we provide our own, poining to
the ExecutionEngine, which in turn holds a "current module" that corresponds in
spirit to the shared library handle.

__cxa_atexit, on the other hand, needs to be re-wired: the interpreter needs to
destruct globals upon its destruction, and those globals from a certain module
when that module is unloaded.

Both is done through a custom MemoryManager, significantly reducing the
complexity of the previous ("JIT without MC") implementation.

The custom MemoryManager also forwards in case of a unknown symbols to the LazyFunctionCreators instead of using the generic
ExecutionEngine::InstallLazyFunctionCreator() which has no effect with MCJIT.
2015-02-11 10:57:36 +01:00
Axel Naumann
2ee6383c36 Remove inline asm boost hack: not needed for MCJIT. 2015-02-11 10:57:35 +01:00
Axel Naumann
baf51f6b04 Create a new llvm::Module per codegen'ed transaction.
MCJIT needs to finalize modules. To simplify the interface with MCJIT, each
transaction now has its own module. It gets created when the previous module
gets passed to the execution engine; the first one is created by
clang::CreateLLVMCodeGen(). CodeGen now releases the module such that it can be
added to the execution engine.

This enables simple use cases of cling with MCJIT; most notably cross-module
linking is still missing.
2015-02-11 10:57:34 +01:00
Axel Naumann
d22c54fd61 Return 0 to signal missing symbols. 2014-10-22 19:16:06 +02:00
Axel Naumann
2dc1fdc217 Silence warning. Keep the FIXME visible :-) 2014-10-16 16:11:05 +02:00
Axel Naumann
2243b3bfdb Bring back old diag format. 2014-10-16 11:26:07 +02:00
Axel Naumann
61dbdbd506 Refactor diag of unresolved syms; also diagnose in getAddressOfGlobal(). 2014-10-15 11:39:12 +02:00
Vassil Vassilev
56473aa73e Name got changed from _GLOBAL__I_a to _GLOBAL__sub_I__. 2014-08-14 14:56:35 +02:00
Vassil Vassilev
a57c866b3d Silence a warning. 2014-06-13 09:19:57 +02:00
Vassil Vassilev
2c16f39465 Align up the comment properly. 2014-06-04 12:12:14 +02:00
Vassil Vassilev
21d9481ce0 Clang diagnostics cause havoc, disable until understood. 2014-06-04 12:06:03 +02:00
Vassil Vassilev
86c66f2b73 Remove useless error msg. 2014-06-04 09:20:09 +02:00