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!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
In CallFunc we currently always (intentionally and somewhat necessarily)
always fully specify member function template, however this can lead to
an ambiguity with a class template. For example in
roottest/cling/functionTemplate we get:
input_line_171:3:15: warning: lookup of 'set' in member access expression is ambiguous; using member of 't'
((t*)obj)->set<int>(*(int*)args[0]);
^
/local2/pcanal/cint_working/rootcling/root/roottest/cling/functionTemplate/t.h:19:9: note: lookup in the object type 't' refers here
void set(T targ) {
^
/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../include/c++/4.4.5/bits/stl_set.h:87:11: note: lookup from the current scope refers here
class set
^
This is an intention warning implemented in clang, see
http://llvm.org/viewvc/llvm-project?view=revision&revision=105518
This fixes a failure in pythoncintrun in roottest/cling/functionTemplate.
The problem was that the remapping happened on the first executeFunction, which
was fine. Now that we have the Transaction's empty wrapper functions removed it's
not enough.
NOTE: that any decls coming within the RuntimeUniverse.h which need 'managed'
storage will still trigger the same problem.
If we had:
struct MyClass {
void f() {}
}
MyClass::f(){} // expected error redefinition of f.
In that case we would have tried to remove the lookup entry for the decl from
the primary decl context of the lexical decl context, which entry doesn't exist.
It is registered in the semantic decl context of the decl itself.
When we tear down, the ExecutionContext must destroy all 'managed' addresses.
For example the LifetimeHandlers that came from the DynamicLookup. This needs
the interpreter to be in a 'sane' state, because they might call back the
Interpreter. For example gCling->execute("delete ...");
We don't need the intepreter to store clang's state. We can use a separate object
for that which allows to be reused.
Provide *much* shorter and cleaner implementation.
Implementation of .files moved in the Interpreter.cpp
storeState now calls three functions: dumpAST(), dumpLookup(), printIncludedFiles().
compareState now calls three functions: compareAST(), compareLookup(), compareIncludedFiles().
It's working for the included files and the AST, and it needs a new patch for
being able to dump the lookup tables (we cannot use dumpLookups() for the moment).
There are cases where cling needs to 'rollback' its state to a previous one.
Examples for that are cling's error recovery and code unloading. This can become
easily tricky to implement. One step reducing the complexity is the verification
of the 'interesting' data structures.
Implement .storeState and .compareState commands, which dump the internal compiler
data structures like AST (implemented), included files (in progress) and lookup
tables (unimplemented yet). The information is dumped into a file and then that
file is diff-ed to the one taken with .compareState. If they were identical all
files are deleted otherwise a .diff file with the differences remains for debug.
This is what we already do with constructor and when we lookup and search
for destructor we want the actually destructor implementation not the
one which also does the delete.
Track down (almost) all places that might trigger deserialization of declarations
and wrap it with cling::PushTransactionRAII. I could solve it much more elegantly
by putting that RAII in the callback of the ExternalASTSource, but I wanted to be
verbose and denote all the places that trigger deserializations in ROOT. This
will help us in future optimize this code, because we want to deserialize as
rare as possible.
This should make roottest a bit happier.
Parsing code in ROOT can lead to lookups which open a nested transactions. Ending
the current transaction in these cases is misleading because usually the
transaction that is expected to be ended is different.
Add an argument to endTransaction to disambiguate. Please note that this fixes
the regular cases of ROOT autoloading.
One of the remaining issues is autoloading of classes, which are passed in as
template arguments. The second remaining is autoloading of classes residing in
unnamed namespaces. Eg. MyNamespace::MyClass, where the diagnostic is issued upon
seeing that MyNamespace is unknown.
Simplify some of the patches by reverting some of the changed llvm / clang files to the original ones.
git-svn-id: http://root.cern.ch/svn/root/trunk@49363 27541ba8-7e3a-0410-8455-c3a389f83636
Parser::Scope versus Sema::DeclContext are now checked for cross-vailidity.
Emit the TU-transaction explicitly instead of relying on a first transaction.
The typename extraction now takes a stream instead of a string to write to.
The llvm::Linker has much reduced functionality; use llvm::sys::Path instead to find dynamic libraries.
git-svn-id: http://root.cern.ch/svn/root/trunk@49325 27541ba8-7e3a-0410-8455-c3a389f83636
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
Instead publish the single interface we actually need: ConvertType().
Add the corresponding patch.
This brings cling's clang much closer to the original, making the update a lot easier.
git-svn-id: http://root.cern.ch/svn/root/trunk@49192 27541ba8-7e3a-0410-8455-c3a389f83636
The issue is that sometimes we don't have a begun transaction. This can happen
mostly in cases when the code doesn't come from text representation but:
* From lookup, where template is being instantiated
* From a PCH/PCM, where a decl was deserialized.
This patch solves the first case: When we do findScope we have to instantiate
the declaration if needed.
Every time there is a chance that generated code's declarations can be orphaned,
we have to explicitly push a transaction so that we can keep the integrity.
git-svn-id: http://root.cern.ch/svn/root/trunk@49070 27541ba8-7e3a-0410-8455-c3a389f83636
Move CodeGenModule::Reset() to where the initializers are run to enforce the survival of the global inits until they are run.
git-svn-id: http://root.cern.ch/svn/root/trunk@48979 27541ba8-7e3a-0410-8455-c3a389f83636
Remaining:
* callfunc issues finding functions
* vtable issues (likely related)
* in stressHistogram: Test 3: Projection with Range for Histograms and Profiles................OK
Error in <TStreamerInfo::Build>: TProfile, unknown type: EErrorType fErrorMode
git-svn-id: http://root.cern.ch/svn/root/branches/dev/root6-pch@48858 27541ba8-7e3a-0410-8455-c3a389f83636
Reshuffle gCling; definition is now provided by the Interpreter internally, not in any header.
This will cause missing symbols in libraries instead of silently creating dumplicated (JIT / library).
Still requires Vassil to add a parameter to LifetimeHandler() - but this will cause a cling test failure as a reminder.
git-svn-id: http://root.cern.ch/svn/root/trunk@48817 27541ba8-7e3a-0410-8455-c3a389f83636
Use loadModuleForHeader() for DynamicLookupRuntimeUniverse.h - we need to find a way to determine whether CodeGen needs to run on an include (i.e. whether it's from a PCM) or not.
git-svn-id: http://root.cern.ch/svn/root/trunk@48665 27541ba8-7e3a-0410-8455-c3a389f83636
* Merge the DynamicIDHandler into InterpreterCallbacks. The DynamicIDHandler was
used to define the failed lookup names as dependent, so that later on they could
be "healed" by the EvaluateTSynthesizer - by generating a call to gCling->EvaluateT...
* Add a flag in the InterpreterCallbacks giving a hint when the failed lookup is
performed - during compilation time or during evaluation type, maybe its name is
misnomer. Maybe I should rename it to IsInRuntimeEvalMode or smth like that...
* Simplify the evaluation routine. The idea is to be merged with one of the
existing - either echo or evaluate
* Implement proper mock object as test dynamic symbol resolver callback. Now it
fully relies on InterpreterCallbacks.
* Implement dynamic expression node marking. Every node that needs runtime
resolution is marked as dependent. However, clang marks other nodes as dependent,
too (eg. templates). Until now it was very difficult to distinguish between both.
Now every "artificially" (marked by us) node's declaration is annotated so that
it could be found back easily by using a simple RecursiveASTVisitor.
Generally we have two issues when using dynamic scopes - filtering the failed
lookups that need to be evaluated at runtime, and filtering the "artificially"
marked as dependent dynamic nodes/decls. Whereas the second issue is solved by
using the annotations, the first one is more tricky to solve because clang doesn't
give us enough information to conclude what should be done. For now I have
narrowed down the cases so that dynamic nodes can appear only in function decls.
git-svn-id: http://root.cern.ch/svn/root/trunk@48575 27541ba8-7e3a-0410-8455-c3a389f83636
to maybeMangleDeclName (which is more talkative).
Use Interpreter::maybeMangleDeclName instead of duplicating code.
git-svn-id: http://root.cern.ch/svn/root/trunk@48545 27541ba8-7e3a-0410-8455-c3a389f83636
CallFunc representation of a member function, we have its concrete address, and
if there is derived class there is no way how to evaluate the vtable and call the
correct virtual.
In order to evaluate the member's vtable, we either have to calculate it (which
is platform/implementation dependent) or create a trampoline function which calls
the target function. Thus codegen will generate code for vtable evaluation. The
trampolines are created for functions that could be possibly virtual - non-static
member functions, declared as virutal. A trampoline looks like this:
void unique_name(Base* This, MyClass2* a, MyClass3* b, double c, MyClass* ret) {
if (ret)
*ret = This->function(*a, *b, c);
else
This->function(*a, *b, c);
}
where we pass in explicitly the address that CallFunc is given (This), followed
by set of arguments (possibly needing conversion) and if the target is non-void
a last argument that is used to provide a storage for the return result.
The given arguments and the required by *LLVM* IR may differ - in that case
simple argument conversions are done. For now primary pointers and builtins, which
covers pretty much entire LLVM type system.
Note that the first implementation is very rough and suboptimal, however it is
very good starting point (milestone):
* Common code is extracted out in its separate routines (here a lot of refactoring more
could be done).
* cling::Value now stores besides clang::QualType, describing (soft-of inaccurately)
the llvm::GenericValue, LLVM-type which is the actual description of the generic value.
* cling::Value naming conventions improved;
* cling::Interpreter::getLLVMType is added temporarily and soon will be removed.
* TClingCallFunc now preallocates space for the this ptr and the return result.
(instead of multiple array copies)
* TClingCallFunc now stores not llvm::GenericValues but cling::StoredValueRefs
because the type conversions need llvm::GenericValue's description (which
essentially is the type).
* Does better default argument evaluation: it could be even *more betterer* if
we query Sema to fold for us the constant expressions instead of decompiling them
to source and using cling for evaluation.
* Return storage implemented.
And, yes that is the longest commit message in my life...
Implementation of argument conversion is revised.
git-svn-id: http://root.cern.ch/svn/root/trunk@48537 27541ba8-7e3a-0410-8455-c3a389f83636
* The PE magic is not within the first 64 bytes (only the DOS "MK" is); need to read more to identify DLLs.
* Use Windows's EnumProcessModules() even on cygwin to enumerate the loaded libraries; needs a Windows library (psapi) to be linked in.
* Filter system libraries on Windows: ignore it if contains "/usr/bin/cyg" or the Windows install path.
* Don't export any symbols from clang and llvm, we don't need them outside libCore. Before, all symbols were exported leading to a symbol table overflow.
git-svn-id: http://root.cern.ch/svn/root/trunk@48500 27541ba8-7e3a-0410-8455-c3a389f83636
For example, if the module contained virtual classes Sema has to generate/update
the virtual tables and so on, exactly as we do after each incremental parse
(IncrementalParser::ParseInternal)
Now we have the code generated for the inlines coming from a module, but due to
a bug in the current state of the modules it generates some declaration of
a function (declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32) nounwind),
which causes the jit to choke with "LLVM ERROR: Cannot select: intrinsic %llvm.ptr.annotation"
git-svn-id: http://root.cern.ch/svn/root/trunk@48406 27541ba8-7e3a-0410-8455-c3a389f83636
The issue we experienced is that we couldn't pipe the output in the terminal.
The reason is that we were using llvm::outs() which closes explicitly the file
descriptor (thanks Axel for the help debugging).
We introduce our custom stream, which keeps the file descriptor open so that
we can use it in pipes. For debugging purposes, however we use/should use llvm::errs()
The lesson learned:
DONT USE LLVM::OUTS() ANYMORE!
git-svn-id: http://root.cern.ch/svn/root/trunk@48316 27541ba8-7e3a-0410-8455-c3a389f83636
inline functions (and should codegen anything that is not directly provide
by a library 'described' by a module).
git-svn-id: http://root.cern.ch/svn/root/trunk@48197 27541ba8-7e3a-0410-8455-c3a389f83636
on #include. This makes sure that we don't do any extra work causing roottest
failures.
git-svn-id: http://root.cern.ch/svn/root/trunk@47972 27541ba8-7e3a-0410-8455-c3a389f83636
analysis. It just takes the transaction runs all the transformers on it
(depending on the compilation options residing in the transaction itself) and
generate code for it.
git-svn-id: http://root.cern.ch/svn/root/trunk@47518 27541ba8-7e3a-0410-8455-c3a389f83636
Now that it's used twice, extract the conversion from ExeContext::ExeResult to Interp::ExeResult.
IncrementalParser will try to roll the transaction back for unresolved initializers.
git-svn-id: http://root.cern.ch/svn/root/trunk@47484 27541ba8-7e3a-0410-8455-c3a389f83636
Switch BeginSourceFile() on after having parsed Interpreter internals.
Switch it off (EndSourceFile()) in ~Interpreter.
Indentation.
Now that we handle diags appropriately, test/ErrorRecovery/MetaProcessor.C fails; repair it.
git-svn-id: http://root.cern.ch/svn/root/trunk@47476 27541ba8-7e3a-0410-8455-c3a389f83636
new transaction could be triggered, every compile should return the transaction
that it actually compiled. I.e. the cling::IncrementalParser::getLastTransaction
in many cases might not be the transaction we expect. For example in ROOT's case
plugin manager is triggered for some reason and the last transaction is not the
one that I'd personally expect.
This should be fix roottest/.../runMemory.C
git-svn-id: http://root.cern.ch/svn/root/trunk@47465 27541ba8-7e3a-0410-8455-c3a389f83636
Enable kLoadLibExists case in TCintWithCling.
Collect statistics about loaded files.
Give access to that through .file; rename SourceManager dump to fileEx.
Documentation.
(Sorry, should have been three patches.)
git-svn-id: http://root.cern.ch/svn/root/trunk@47330 27541ba8-7e3a-0410-8455-c3a389f83636
Call it like this:
SmallVector<std::string, 100> inclPaths;
interp->GetIncludePaths(inclPaths, false, true);
to get the include paths prefixed with -I, but no system onclude paths.
Mark include paths supplied via AddIncludePath() as IsUserSupplied.
git-svn-id: http://root.cern.ch/svn/root/trunk@47325 27541ba8-7e3a-0410-8455-c3a389f83636
Make tryLinker a member function now that it uses the collection of loaded libraries.
Implement "was alreday loaded" as possible loadLibrary() result.
git-svn-id: http://root.cern.ch/svn/root/trunk@47324 27541ba8-7e3a-0410-8455-c3a389f83636
Prepare new result "library was alreday loaded" - will be implemented if we actually need it.
git-svn-id: http://root.cern.ch/svn/root/trunk@47319 27541ba8-7e3a-0410-8455-c3a389f83636
we don't need pin-point precision while we recover the lookup parser from lookup.
git-svn-id: http://root.cern.ch/svn/root/trunk@47298 27541ba8-7e3a-0410-8455-c3a389f83636
actually support proper nesting of transactions.
(begin|end)Transaction return the transaction began or ended, which simplifies
interaction in case of nested transactions (coming from the autoloading)
Implement new function which transforms the single-linked list into a vector of
transactions for debugging purposes only.
git-svn-id: http://root.cern.ch/svn/root/trunk@47290 27541ba8-7e3a-0410-8455-c3a389f83636
Do that *after* the tranformers have done their work; they change the result type.
Silence a "return 12" inside a (not yet transformed) void wrapper().
The return type will later be repaired by the ReturnSynthesizer if needed.
git-svn-id: http://root.cern.ch/svn/root/trunk@47165 27541ba8-7e3a-0410-8455-c3a389f83636