IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Clang allows third party shared libraries to provide user-defined
extensions. For example, a custom libTemplateInstantiation.so can
visualize all template instantiation chains in clang. To enable it
one needs to pass a set of options such as -fplugin.
Cling should be able to inherently work with clang plugins. However,
cling still does not make full use of the clang driver where the plugin
setup is handled.
This patch enables plugins in cling and extends them in some aspects.
In particular, cling allows loading of plugins from shared libraries
but also if they are linked to the same library where cling is. This is
very useful in cases where cling runs itself in a shared library (eg
libCling). Users of libCling (such as ROOT) prefer to keep all llvm and
clang related symbols local to avoid symbol clashes if there is another
version of clang and llvm linked against a package. This can be done by
dlopen-ing libCling with RTLD_LOCAL visibility mode. Then the only way
for clang plugins to work in this scenario is to be linked to libCling.
Patch by Aleksandr Efremov and me.
In previous allmodules&autoloading patch, we used callback from
DeserializationListener to get Decl and loaded corresponding libraries.
It worked, but the performance was bad because ROOT was loading
excessive libraries.
In this patch, we use TCling::LazyFunctionCreatorAutoloadForModule. This
function gets callback when "mangled_name" was not found in loaded
libraries thus we have to the load corresponding library and lookup
again.
I used unordered_map to store mangled identifier and library pair. I'm
doing an optimization by hashing mangled name and storing library not by
name but by uint8 and hold uint8-name information in another vector.
Also tried std::map but unorderd_map was more performant. There are
better hash table like:
https://probablydance.com/2018/05/28/a-new-fast-hash-table-in-response-to-googles-new-fast-hash-table/
we can try to use them if this part gets crucial.
With this patch:
```
Processing tutorials/hsimple.C...
hsimple : Real Time = 0.04 seconds Cpu Time = 0.03 seconds
(TFile *) 0x562b37a14fe0
Processing /home/yuka/CERN/ROOT/memory.C...
cpu time = 0.362307 seconds
sys time = 0.039741 seconds
res memory = 278.215 Mbytes
vir memory = 448.973 Mbytes
```
W/o this patch:
```
Processing tutorials/hsimple.C...
hsimple : Real Time = 0.08 seconds Cpu Time = 0.07 seconds
(TFile *) 0x5563018a1d30
Processing /home/yuka/CERN/ROOT/memory.C...
cpu time = 1.524314 seconds
sys time = 0.157075 seconds
res memory = 546.867 Mbytes
vir memory = 895.184 Mbytes
```
So it improves time by 4x times and memory by 2x.
Preloading all the modules has several advantages. 1. We do not have to
rely on rootmap files which don't support some features (namespaces and
templates) 2. Lookup would be faster because we don't have to do
trampoline via rootmap files.
Autoloading libraries when decls are deserialized gives us correctness.
However we still need to optimize the performance by reducing the amount
of loaded libraries and improving Clang performance.
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/
#
As emitter objects now own their callback objects, DeclCollector has two owners.
Fix that by using an explicit bridge callback for the Preprocessor that it can own.
Implicitly generated members from a CXXRecordDecls coming from a PCH should not be
unloaded. CodeGen 'records' that it once emitted the implicit members and if they
get unloaded it would be out of sync. The key difference is the information about
all the implicitly generated members (trivial ctors/dtors, etc) comes from an
ASTMutationListener and they are not part of the transaction. We still do not
record it as a part of the transaction, we just mark them as used so that they
don't get unloaded from the llvm::Module.
Once the list of llvm.used decls is emitted we need to clear it, otherwise we
end up emitting one and the same thing over and over.
Fixes ROOT-6722
Tests should be coming shortly.
We had two different codepath for codegeneration. The first one was for
declarations that came from text and the second one for declarations that came
from 'ExternalSource' such as PCH. In the latter case we had to do some
extra equilibristics to emulate a PCM and ignore generating code for decls with
static storage, because it will clash with the loading of the library that already
contains them.
The advantage of the new implementation is that instead of communicating the
deserialized decls to ROOT via some fishy deserialization listeners we can use
the cling::Transaction as we use it for decls that came from code.
the callbacks must be triggered for those, too.
As they are not part of a transaction (think "module") they are now sent to the deserialization listener.
This can be removed once the modules work.
Set the state of the transaction to Committing before the static init - which might trigger more decls even though CodeGen has been run over the decls.
Forward DeclCollector::HandleInterestingDecl() to DeclCollector::HandleTopLevelDecl() for decls from the AST reader / from headers describing libraries.
Empty transactions must be passed to TCling; they trigger the sending of deserialized decls to ROOT/Meta.
Don't start TCling's artificial TU Transaction if the transaction coming in is empty - we need a decl to get the ASTContext.
Swap the deserialized decls before handling them in TCling, such that nested calls don't see the same decls again.
git-svn-id: http://root.cern.ch/svn/root/trunk@49197 27541ba8-7e3a-0410-8455-c3a389f83636
Don't codegen statics and non-inline functions if from AST file or "forModules" is set:
Filter decls to be sent to codegen also based on the "forModules" flag, not only on whether it's from an AST file - in the end they are the same (forModules will vanish once we have modules).
Iterate over NamespaceDecls before emitting, to be able to filter their elements.
git-svn-id: http://root.cern.ch/svn/root/trunk@49152 27541ba8-7e3a-0410-8455-c3a389f83636
Implement a shortcut for the deserialized decls to codegen. We do not need to put
the deserialized declaration in a transaction, because they are not interesting.
They are valid so we don't need to do sanity checks and if we'd want to unload
we would unload the entire PCH/PCM, which contains a list of all the deserialized
declarations.
NOTE that the implementation is rough and needs further polishing, which will
happen some time soon...
git-svn-id: http://root.cern.ch/svn/root/trunk@49076 27541ba8-7e3a-0410-8455-c3a389f83636