Commit Graph

97 Commits

Author SHA1 Message Date
Bertrand Bellenot
e128adbcca Fix cling on Windows (there is no Emulated TLS on Windows) 2018-03-13 18:44:11 +01:00
Raphael Isemann
62eac4d1d2 Fix formatting of the TLS commit 2017-11-07 03:57:48 +01:00
Raphael Isemann
89c6351e3a Fix thread local storage in the cling JIT
TLS is currently not suppored in the JIT on some platforms.

However, it's possible to enable emulated TLS support in LLVM
which means that we now support TLS across many architectures.
The performance downsides of this are the overhead of accessing
the variable due to the additional indirection by the emulation.

However, this overhead is minimal and shouldn't affect most
programs. It also can be easily worked around from the user side.
This can be donefFor example by wrapping TLS variables into a single
TLS struct variable that then contains the other variables. Or just
minimizing referencing the TLS variable and use a normal copy of
the variable instead and write it back later.

Patch created with a lot of help from Lang Hames and Pavel Labath!
2017-11-07 03:57:48 +01:00
Vassil Vassilev
dfc0e8a2d4 shared_ptr-ize the llvm::Module*.
This is in prepare for the upcoming llvm upgrade. The future orc jit compile
layer needs a std::shared_ptr<llvm::Module>. The current design passes a
llvm::Module* around and any conversions to a shared_ptr cause the
destruction of the llvm::Module which is a long-lived object in cling.
2017-10-05 17:59:08 +02:00
Axel Naumann
15a4056c56 Whitespace. 2017-08-31 08:44:16 +02:00
Axel Naumann
8cfa532b72 Interpreter callback is created after Interpreter ctor. 2017-08-31 08:44:15 +02:00
Axel Naumann
4f41d10b0c Inform callback upon invoking functions / static init. 2017-08-31 08:44:15 +02:00
Philippe Canal
6c368913e7 clang-format suggestion 2017-08-24 17:03:58 +02:00
Frederich Munch
38c4b902cf Fix registration of other atexit functions during an atexit handler. Recursive registration of atexit handlers is legal and should be handled, not ignored. 2017-08-24 17:03:58 +02:00
Frederich Munch
5c41b2957c Hide members of CXAAtExitElement and make it a callable object. Update iteration to use llvm::reverse and C++11 range based for loop. 2017-08-24 17:03:58 +02:00
Frederich Munch
baa1cba4d3 Store unresolved symbols in an unordered_set; have no need for ordering. 2017-08-24 17:03:58 +02:00
Frederich Munch
95c67cb818 Cleanup cruft from CreateHostTargetMachine. 2017-06-20 11:44:13 +02:00
Vassil Vassilev
a1bd767b6b Adapt to interface changes due to upgrade to r302975. 2017-06-08 10:29:13 +02:00
Axel Naumann
875a597aff Move target init early. 2017-05-10 08:29:53 +02:00
Axel Naumann
053223229e Enable all available targets, for instance for the cuda backend. 2017-05-08 14:59:05 +02:00
Bertrand Bellenot
09369c4fd6 Remove the Windows ELF formatting from IncrementalExecutor, since it is now in CIFactory 2017-03-02 11:59:59 +01:00
Frederich Munch
b6afe909f3 Use utils::FunctionToVoidPtr for casting unresolvedSymbol. 2017-02-02 10:14:15 +01:00
Frederich Munch
e4c24a133a Move IncrementalExecutor::CreateHostTargetMachine into IncrementalExecutor.cpp. 2017-01-25 12:14:06 +01:00
Frederich Munch
0d15357a12 Full implementation to override atexit and similar calls. 2017-01-25 11:14:11 +01:00
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