Commit Graph

515 Commits

Author SHA1 Message Date
Axel Naumann
923b4ce39b Also strip the "runtime" part of the Interpreter exception here. 2015-12-15 20:24:16 +01:00
CristinaCristescu
1d46fe88d8 Remove runtime namespace from NullDerefException and rename RuntimeException.h to Exception.h.
(cherry picked from commit 234da8bfedce8661c2b8bc50f72632c240c4dfd8)
2015-12-15 20:24:16 +01:00
CristinaCristescu
8ab37ec3d6 Enable Baozeng Ding's NullDeref protection for ROOT; use exceptions.
The function HandleInterpreterException catches the NullDerefException.
Remove pre-exception longjmp code.
2015-12-15 20:24:15 +01:00
Axel Naumann
a3a1e27b2f Improve doc wording, no functional change. 2015-10-23 21:16:12 +02:00
Philippe Canal
432884aada Add a callback during Transaction's rollback. 2015-10-22 14:56:16 +02:00
Axel Naumann
be55c83f9b Inline Value move ctor to enable the compiler to skip it. 2015-10-20 01:50:13 +02:00
Philippe Canal
fdbc4b985c Remove debug characters 2015-10-15 17:09:17 +02:00
Philippe Canal
cb70c9d802 Fix value printing of TCollection objects.
The iterator for a TCollection currently return the content
(a TObject*) by value, preventing the usual mechanism from
working:
   error: cannot take the address of an rvalue of type 'TObject *'
        str += printValue(&(*iter));
                          ^ ~~~~~
so add a special case when this address taking fails.
2015-10-10 20:08:02 +02:00
Philippe Canal
75fac59326 Coding conventions fixes 2015-09-30 16:41:12 +02:00
Philippe Canal
9c88696445 Implement TCling::ResetGlobals to fix ROOT-7673.
Note we don't want to unload transaction so soon as this might remove the header files still needed
(they need to be removed by the library .... which is still a to-be-done feature)
2015-09-29 22:49:05 +02:00
Boris Perovic
39f64ab7b7 Catch-all printValue implementation changed to enable correct invocation if only parent type overload exists (ex. if there is no overload for TF1*, compiler invokes the overload to its best parent overload match, in the worst case void*). Argument changed from reference to pointer to support this. isEnumType Coverity bug changed from if to assert (coding, not runtime error) Changed the way printValue is invoked in order to correctly cast Value to the needed value (e.g. LL -> short). Extracted value stays in scope while we execute printValue, because we use the address. 2015-08-20 17:06:02 +02:00
Boris Perovic
fc447d5fd5 Small improvements. nullptr -> nullptr_t for isNullPtrType 2015-08-18 18:08:20 +02:00
Boris Perovic
800c644352 Removed "VALID" after address output, fixes roottest. Various fixes based on comments after second round. 2015-08-18 18:08:20 +02:00
Boris Perovic
63bc59dde6 Fixed the bug (missing internal::) from commit 279fc73896036900366fa1596ec4d624b9db1c05. 2015-08-18 18:08:19 +02:00
Boris Perovic
688ad34b3f Minor fixes around printValue, based on comments after the integration. 2015-08-18 18:08:17 +02:00
Boris Perovic
c44940b223 New printValue() integration (printing unified through overloading of printValue() function and template resolution). Modified tests to conform to the new prints. 2015-08-17 18:45:03 +02:00
Elisavet Sakellari
d2953ff9a6 Handling of multiple Redirection RAII's 2015-08-17 18:45:02 +02:00
Axel Naumann
dc2047e7c4 Replace Transaction::reset() by ~Transaction(). Replace RefillPool by new Transaction.
Simplifies code, removes duplication.
2015-06-08 14:58:29 +02:00
Axel Naumann
397f6fb9e9 Fix warning; make determineStorageType() static. 2015-04-07 09:39:25 +02:00
Axel Naumann
ca9ac1961f Accelerate costly Value functions by storing results. 2015-04-06 21:30:19 +02:00
Axel Naumann
8552299b66 Support DynamicLookup test resolver not resolving anything. 2015-04-01 12:09:19 +02:00
Axel Naumann
c91fffa352 Register IssuedDiags with topmost Transaction. 2015-03-17 14:06:39 +01:00
Axel Naumann
166032069e Emit Decls as DeclCollector sees them.
Now that we can easily revert Transactions' IR (by unloading their
module) we do not need to queue the Decls before emitting them.
This enables EndOfTU actions to be emitted seeminglessly, without
extra transactions, or explicit post-EndOfTU-emission: each
Transaction will have its TU finalized exactly once.

This in turn allows us to turn on Debug emission - which relies on
being invoked exactly once per Module.

Transformers must be invoked before emitting Decls. They are now
invoked for each Decl; WrapperTransformers are invoked when seeing
a wrapper decl. They do not see the "full transaction AST" anymore
- luckily none of our transformers requires this and actually become
simpler because of this change.

This also fixes a bug where the relative sequencing of parsed and
deserialized Decls was lost (parsed was emitted before deserialized).

Remove unused IRTransactions; they should really be llvm::Pass-es.
We don't have them anyway.

Disable a few transformations if the Decl isFromASTFile.

When reverting a Transaction, also revert its nested ones.

In the ValueExtractionSynthesizer, pass the ValuePrinter option as
int, instead of the transaction pointer - that might have changed
(at least its options) by the time we invoke the wrapper.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# Explicit paths specified without -i or -o; assuming --only paths...
# rebase in progress; onto b3d9f92
# You are currently splitting a commit while rebasing branch 'declcollector-emits-v2' on 'b3d9f92'.
#
# Changes to be committed:
#	modified:   interpreter/cling/include/cling/Interpreter/RuntimeUniverse.h
#	modified:   interpreter/cling/lib/Interpreter/AutoSynthesizer.cpp
#	modified:   interpreter/cling/lib/Interpreter/AutoSynthesizer.h
#	modified:   interpreter/cling/lib/Interpreter/CheckEmptyTransactionTransformer.cpp
#	modified:   interpreter/cling/lib/Interpreter/CheckEmptyTransactionTransformer.h
#	modified:   interpreter/cling/lib/Interpreter/DeclCollector.cpp
#	modified:   interpreter/cling/lib/Interpreter/DeclCollector.h
#	modified:   interpreter/cling/lib/Interpreter/DeclExtractor.cpp
#	modified:   interpreter/cling/lib/Interpreter/DeclExtractor.h
#	modified:   interpreter/cling/lib/Interpreter/DynamicLookup.cpp
#	modified:   interpreter/cling/lib/Interpreter/DynamicLookup.h
#	modified:   interpreter/cling/lib/Interpreter/IncrementalParser.cpp
#	modified:   interpreter/cling/lib/Interpreter/IncrementalParser.h
#	modified:   interpreter/cling/lib/Interpreter/NullDerefProtectionTransformer.cpp
#	modified:   interpreter/cling/lib/Interpreter/NullDerefProtectionTransformer.h
#	modified:   interpreter/cling/lib/Interpreter/TransactionTransformer.cpp
#	modified:   interpreter/cling/lib/Interpreter/TransactionTransformer.h
#	modified:   interpreter/cling/lib/Interpreter/TransactionUnloader.cpp
#	modified:   interpreter/cling/lib/Interpreter/ValueExtractionSynthesizer.cpp
#	modified:   interpreter/cling/lib/Interpreter/ValueExtractionSynthesizer.h
#	modified:   interpreter/cling/lib/Interpreter/ValuePrinterSynthesizer.cpp
#	modified:   interpreter/cling/lib/Interpreter/ValuePrinterSynthesizer.h
#
# Untracked files:
#	.idea/
#	0001-Fix-llvm-merge-issue.patch
#	0002-Fix-warnings.patch
#	0003-Keep-weak-symbols-around-subsequent-transactions-mig.patch
#	T.cxx
#	T.cxx~
#	TMVA.root
#	a.out
#	boost.root
#	config/Makefile.depend~
#	core/textinput/src/textinput/TerminalDisplayWin.cpp.orig
#	ct.root
#	data.root
#	interpreter/cling/76fc2055249da7b03148a7d4197a279e9943f012.patch
#	interpreter/cling/lib/Interpreter/CIFactory.cpp~
#	interpreter/cling/lib/Interpreter/DeclCollector.h~
#	interpreter/cling/lib/Interpreter/DynamicLibraryManager.cpp~
#	modulemap-one-header-per-file.txt
#	osrm-routed
#	tiles.tar.bz2
#	tmva_class_example.root
#	tutorials/v3.root
#	weights/
#
2015-03-16 14:58:58 +01:00
Bertrand Bellenot
bb53e44094 Fix compilation errors on Windows
MSVC doesn't support fSpinLock=ATOMIC_FLAG_INIT; in the class definition, nor in the class constructor initializer list
2015-02-25 18:03:18 +01:00
martell
6383df2174 use size_t for void pointer cast 2015-02-23 00:31:28 +01:00
Axel Naumann
430a9c7473 Add non-const getParser(). 2015-02-18 14:51:21 +01:00
Axel Naumann
eb75ab36ef Add the transaction to define its lifetime.
This should be migrated to use unique_ptr in the interfaces instead
of relying on comments...
2015-02-11 10:57:48 +01:00
Axel Naumann
93e44e7273 Use ~Transaction() to unload its JITed symbols. 2015-02-11 10:57:47 +01:00
Axel Naumann
16fe3f49dc Replace use of ExecutionEngine by OrcJIT. 2015-02-11 10:57:47 +01:00
Axel Naumann
276ff16454 No DeclCollector in interface; much more efficient OnlyLex path. 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
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
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
e34dec8664 Move Diag suppression to IncrementalParser.
This gets rid of the messy pulling-SourceLocations-out-of-thin-air and instead simply
uses begin and end of the relevant memory buffer where diags are meant to be suppressed.
2015-01-23 16:24:13 +01:00
Axel Naumann
ba995aca73 Add flag whether prompt-style diagnostics should be suppressed. 2015-01-23 16:24:12 +01:00
Axel Naumann
5ff794a175 Prevent re-parse of "#include \"RuntimeUniverse.h\"". 2015-01-23 16:24:12 +01:00
Axel Naumann
7e981e541c Factor out unload point creation. 2015-01-21 16:59:05 +01:00
Axel Naumann
70d7b66616 Fix doc warning. 2014-10-21 17:52:07 +02:00
Axel Naumann
3d69da22fd Remove unneeded static member decls; mark c'tor, d'tor as deleted. 2014-10-14 09:08:06 +02:00
Axel Naumann
556ac8c3dc Use canonical Decls as key for "do not desugar"; may have dupe Type*s. 2014-10-07 22:20:06 +02:00
Axel Naumann
0bc17f63c4 Pass the .L-ed transaction to actOnxCommand; last transaction might be wrong. 2014-10-06 10:40:10 +02:00
Vassil Vassilev
8162fdd340 We do not own our ExternalSemaSource, it is ref-owned by Sema and ASTContext. 2014-10-01 14:24:13 +02:00
Vassil Vassilev
5563ab3d68 Revert "Fix cling tear down crash involving the ExternalSemaSource."
This reverts commit d320b74acf5172f62b8ac565955ea6497688d225.
2014-10-01 14:24:12 +02:00
Vassil Vassilev
122233ada6 Do not display suggestions only for ROOT. 2014-09-19 14:05:15 +02:00
Axel Naumann
fa7ce40d67 Analyze and fwd declare all dependencies (ROOT-6705 ROOT-6719 ROOT-6712 ROOT-6695). 2014-09-18 23:28:04 +02:00
Philippe Canal
2aacd83287 Introduce Lookup::Named overload taking a StringRef 2014-09-15 12:26:13 +02:00
Axel Naumann
3b078ed887 No need to be more const correct than getCI()->getSema()! 2014-09-14 13:53:10 +02:00
Axel Naumann
b7a590c40e Pass StringRef-s instead of copying strings... 2014-09-14 13:53:09 +02:00
Philippe Canal
91e924b262 Delay call to PrepareParsing until really needed 2014-09-12 05:16:06 +02:00
Philippe Canal
b8e57bce99 Fix cling tear down crash involving the ExternalSemaSource.
With the unique_ptr, we were crash due to the held over reference described
below.  Trying to move the m_ExternalSemaSource deletion after the m_IncrParser
deletion also leads to crash due to the double deletion (once by the ASTContext,
once by m_ExternalSemaSource) of the ExternalSemaSource.

If m_Callbacks is declared after m_IncrParser, it will be deleted first
and if m_ExternalSemaSource is a unique_ptr, it willbe deleted before
m_IncrParser is delete.

During the Incremental parser deletion, there is a call to
CodeGenModule::Release, then EmitTargetMetdata is called and it tries to
get the most recent decl which calls
     clang::LazyGenerationalUpdatePtr<...>::get
which has a LazyVal which has a cached pointer to the AST external
source.  So this placement is necessary to solve a tear down crash.

#0  clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::get (this=0x7fff5fbfe0e0, O=0x1069c3f90) at ExternalASTSource.h:428
428	        (LazyVal->ExternalSource->*Update)(O);
(gdb) l
423	  /// Get the value of this pointer, updating its owner if necessary.
424	  T get(Owner O) {
425	    if (LazyData *LazyVal = Value.template dyn_cast<LazyData*>()) {
426	      if (LazyVal->LastGeneration != LazyVal->ExternalSource->getGeneration()) {
427	        LazyVal->LastGeneration = LazyVal->ExternalSource->getGeneration();
428	        (LazyVal->ExternalSource->*Update)(O);
429	      }
430	      return LazyVal->LastValue;
431	    }
432	    return Value.template get<T>();

#0  clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::get (this=0x7fff5fbfe0e0, O=0x1069c3f90) at ExternalASTSource.h:428
#1  0x000000010005ce38 in clang::Redeclarable<clang::FunctionDecl>::DeclLink::getNext (this=0x1069c3ff0, D=0x1069c3f90) at Redeclarable.h:74
#2  0x000000010005cd81 in clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration (this=0x1069c3ff0) at Redeclarable.h:119
#3  0x000000010005d0b3 in clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl (this=0x1069c3ff0) at Redeclarable.h:161
#4  0x000000010137bfdc in clang::FunctionDecl::getMostRecentDeclImpl (this=0x1069c3f90) at Decl.h:1568
#5  0x00000001004b5346 in clang::Decl::getMostRecentDecl (this=0x1069c3f90) at DeclBase.h:806
#6  0x0000000100897128 in clang::CodeGen::CodeGenModule::EmitTargetMetadata (this=0x10689aa00) at /Users/pcanal/root_working/code/rootcling/interpreter/llvm/src/tools/clang/lib/CodeGen/CodeGenModule.cpp:3271
#7  0x0000000100895237 in clang::CodeGen::CodeGenModule::Release (this=0x10689aa00) at /Users/pcanal/root_working/code/rootcling/interpreter/llvm/src/tools/clang/lib/CodeGen/CodeGenModule.cpp:395
#8  0x0000000100981b3c in clang::CodeGeneratorImpl::ReleaseModule (this=0x106506d70) at /Users/pcanal/root_working/code/rootcling/interpreter/llvm/src/tools/clang/lib/CodeGen/ModuleBuilder.cpp:82
#9  0x00000001001c3f88 in ~IncrementalParser (this=0x1065047e0) at /Users/pcanal/root_working/code/rootcling/interpreter/cling/lib/Interpreter/IncrementalParser.cpp:168
#10 0x00000001001c3f25 in ~IncrementalParser (this=0x1065047e0) at /Users/pcanal/root_working/code/rootcling/interpreter/cling/lib/Interpreter/IncrementalParser.cpp:166
#11 0x00000001001d8905 in std::__1::default_delete<cling::IncrementalParser>::operator() () at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/memory:2426
#12 0x00000001001d8905 in ~unique_ptr [inlined] () at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/memory:2625
#13 0x00000001001d8905 in ~Interpreter (this=0x7fff5fbff020) at memory:2593
#14 0x00000001001d8355 in ~Interpreter (this=0x7fff5fbff020) at /Users/pcanal/root_working/code/rootcling/interpreter/cling/lib/Interpreter/Interpreter.cpp:229
#15 0x00000001002b0318 in main (argc=1, argv=0x7fff5fbff740) at /Users/pcanal/root_working/code/rootcling/interpreter/cling/tools/driver/cling.cpp:97
2014-09-11 23:24:02 +02:00