Commit Graph

562 Commits

Author SHA1 Message Date
Vassil Vassilev
eff367e1b8 Add a fixme.
git-svn-id: http://root.cern.ch/svn/root/trunk@49142 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-09 09:04:30 +00:00
Vassil Vassilev
863970c3ba Include/Fwd decl cleanup.
git-svn-id: http://root.cern.ch/svn/root/trunk@49141 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-09 09:03:54 +00:00
Vassil Vassilev
3ce238085f Reorder: put the nested transaction container right after the decl container.
git-svn-id: http://root.cern.ch/svn/root/trunk@49140 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-09 08:55:54 +00:00
Vassil Vassilev
10de41a757 Remove unused code. Move the relevant comments at the right place.
git-svn-id: http://root.cern.ch/svn/root/trunk@49139 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-09 08:47:47 +00:00
Vassil Vassilev
4760be34eb Remove redundant method. Improve style.
git-svn-id: http://root.cern.ch/svn/root/trunk@49138 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-09 08:44:51 +00:00
Vassil Vassilev
e380ed68ba Move the #include ctime along with the use of time().
git-svn-id: http://root.cern.ch/svn/root/trunk@49126 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-08 15:40:32 +00:00
Vassil Vassilev
564659c170 Fix a misnomer.
git-svn-id: http://root.cern.ch/svn/root/trunk@49125 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-08 14:35:35 +00:00
Vassil Vassilev
df0dc16c07 Make cling::Transaction cheaper to construct. Lazy-create the container of the
nested transactions. 

Now sizeof(cling::Transaction()) == 56.


git-svn-id: http://root.cern.ch/svn/root/trunk@49124 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-08 14:27:57 +00:00
Vassil Vassilev
bfd62ec517 The Transaction coming from the TransactionRAII object must be committed after
parser's state has been reverted, because it may induce parsing. This then would
result into an invalid parser state.


git-svn-id: http://root.cern.ch/svn/root/trunk@49120 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-08 10:16:01 +00:00
Vassil Vassilev
36dedc6eec Remove the multiplex - it's in clang's mainline.
git-svn-id: http://root.cern.ch/svn/root/trunk@49119 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-08 09:48:54 +00:00
Axel Naumann
09a871365f Grammar...
git-svn-id: http://root.cern.ch/svn/root/trunk@49110 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-06 16:59:22 +00:00
Axel Naumann
16d98566aa Return early if no active transaction is available.
Works around consequence of r49108 which reverts part of r49070 until we have a proper fix.


git-svn-id: http://root.cern.ch/svn/root/trunk@49109 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-06 16:57:26 +00:00
Axel Naumann
347d884077 Comment the TransactionRAII until we understand (and fix) why it breaks a good part of roottest.
git-svn-id: http://root.cern.ch/svn/root/trunk@49108 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-06 16:44:22 +00:00
Axel Naumann
0ca1242c5d Simplify, clarify, improve performance: create a transaction and invoke Sema only if there is no definition.
git-svn-id: http://root.cern.ch/svn/root/trunk@49107 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-06 16:43:35 +00:00
Axel Naumann
a91112365b Add documentation!
git-svn-id: http://root.cern.ch/svn/root/trunk@49105 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-05 21:55:12 +00:00
Axel Naumann
2e153295ff Make the default compilation options compatible with a compiler.
Add comparison ops: I needed them for a dead end and now I have them and the compiler won't generate its own.


git-svn-id: http://root.cern.ch/svn/root/trunk@49101 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-05 15:10:05 +00:00
Axel Naumann
8c680be610 Implement hasFunction().
Rephrase !(a==b).

This file still needs major refactoring to remove code duplication.


git-svn-id: http://root.cern.ch/svn/root/trunk@49099 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-05 13:50:01 +00:00
Axel Naumann
89d418feb6 Remove Completed flag; integrated it into state:
collecting->completed->committing->committed
Make m_DeclQueue lazily allocated to reduce sizeof(Transaction) in an effort to make the TransactionRAII cheaper - second part is coming up.
Remove unused thus unneeded and annoying (non-const) iterator interfaces; they clash with the constness of the EmptyQueue.


git-svn-id: http://root.cern.ch/svn/root/trunk@49097 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-05 13:43:01 +00:00
Axel Naumann
ce0752f698 Rename state kUnknown to kCollecting.
Implement Transaction::printStructure().
Remove unnecessary non-const overload of getWrapperFD().


git-svn-id: http://root.cern.ch/svn/root/trunk@49095 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-05 13:12:57 +00:00
Axel Naumann
dddff622c4 The state of the transaction needs to be switched to committed to signal that no new decls should be appended.
That is only needed before iterating over the decls, which only happens at the codegen part.
The transformers must be (and are) able to iterate over a transaction that gets appended to.


git-svn-id: http://root.cern.ch/svn/root/trunk@49094 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-05 13:03:41 +00:00
Vassil Vassilev
e9c68e3d38 One more (final) of "Resurrect the trunk" series:
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
2013-04-04 15:40:05 +00:00
Axel Naumann
a3efe6ce54 Append clang_CodeGen_staticInit.diff to type_lowering.diff to enforce patch order: first move CodeGenModule.h, then patch.
git-svn-id: http://root.cern.ch/svn/root/trunk@49075 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-04 12:59:01 +00:00
Vassil Vassilev
1e8aee2da4 Resurrect the trunk:
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
2013-04-03 16:25:08 +00:00
Vassil Vassilev
2b054ac81d Remove files from cling's trunk. They are in clang's mainline and our vendor drop.
git-svn-id: http://root.cern.ch/svn/root/trunk@49069 27541ba8-7e3a-0410-8455-c3a389f83636
2013-04-03 14:55:23 +00:00
Axel Naumann
1b207049e6 Remove CodeGenerationForModule special treatment; flag will vanish once trunk is working.
git-svn-id: http://root.cern.ch/svn/root/trunk@48988 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-28 14:49:44 +00:00
Axel Naumann
e73e92d027 Wen appending decls, assert that the transaction is not yet committed.
Don't look for the wrapper for each decl if we already have it.
Unless asserts are on and we want to assert that we have only one wrapper.


git-svn-id: http://root.cern.ch/svn/root/trunk@48987 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-28 14:48:13 +00:00
Axel Naumann
4daa80085f Simplify.
git-svn-id: http://root.cern.ch/svn/root/trunk@48985 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-28 14:34:42 +00:00
Axel Naumann
dc4f8a89e2 Process the trailing nested transaction of decls that were collected during the commit of the current transaction even if there are no callbacks.
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
2013-03-28 14:12:23 +00:00
Axel Naumann
8ce98b6610 Should be relative to llvm/src/
git-svn-id: http://root.cern.ch/svn/root/trunk@48978 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-28 14:06:11 +00:00
Axel Naumann
5c82a5d7bd Merge from PCH dev branch: patch for clang.
git-svn-id: http://root.cern.ch/svn/root/trunk@48977 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-28 14:04:37 +00:00
Axel Naumann
8389c5b1e1 Merge development from branches/dev/root6-pch into the trunk: enable PCH for ROOT.
git-svn-id: http://root.cern.ch/svn/root/trunk@48958 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-27 18:07:03 +00:00
Axel Naumann
4a0c1c6e1f Merge with trunk, r48857 - r48937.
git-svn-id: http://root.cern.ch/svn/root/branches/dev/root6-pch@48938 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-26 15:23:24 +00:00
Axel Naumann
cd50723fb1 Start and commit the transaction containing StartTU.
To do: end and begin-of-next transaction should be tied together, else we might have decls not ending up in any transaction.


git-svn-id: http://root.cern.ch/svn/root/branches/dev/root6-pch@48936 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-26 09:59:19 +00:00
Vassil Vassilev
00619b3944 Add fixme.
git-svn-id: http://root.cern.ch/svn/root/trunk@48930 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-25 16:17:01 +00:00
Vassil Vassilev
f65fafc648 Add test exposing weakness in LookupHelper::findFunctionProto
git-svn-id: http://root.cern.ch/svn/root/trunk@48909 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-20 15:22:51 +00:00
Vassil Vassilev
a7a30aed7b Axel's google tech talk.
git-svn-id: http://root.cern.ch/svn/root/trunk@48908 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-20 09:59:25 +00:00
Vassil Vassilev
25e1924b5f *Lay the foundation of return by-value support.
Some functions return temporary objects. Eg:

  std::string getName() {
    return "ROOT";
  }

  In that case the lifetime of the temporary variable is defined by the caller. 
  Such function called by TClingCallFunc would cause undefined behaviour, because
  there is no actual caller and the compiler cannot define any lifetime. 

  In order to provide such concept we have implemented cling::StoredValueRef, which
  is a reference counted cling::Value. As long as somebody "has" a copy of it, the
  boxed value (and the occupied memory) will live.

  However cling::Value and cling::StoredValueRef expose LLVM/clang/cling internals
  to ROOT. We want to avoid for now exposing LLVM/clang/cling internals, so we have
  TInterpreterValue, which makes cling::StoredValueRef opaque.

*New interface taking TInterpreterValue is added to the TInterpreter to allow the
users to manage the lifetime of the returned temporaries.

*Replace the occurrances of cling::Value with cling::StoredValueRef to avoid 
any lifetime management issues.

*Minor optimizations of the existing implementation

*Tweaks to the build system so that TInterpreterValue.cxx could 
#include cling/Interpreter/StoredValueRef.h

PLEASE NOTE: This is not the final implementation it needs polishing. Eg. there
is a bug that should be fixed soon, which doesn't allow to get the actual result
out of the TInterpreterValue.


git-svn-id: http://root.cern.ch/svn/root/trunk@48895 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-18 21:30:00 +00:00
Fons Rademakers
a3cb06c5e6 Fixes for compiling with C++11 and libcxx on OSX.
git-svn-id: http://root.cern.ch/svn/root/trunk@48886 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-17 13:31:45 +00:00
Axel Naumann
0de0164c3f Add a deserialization listener: we do not receive all decls through the ASTConsumer interface.
git-svn-id: http://root.cern.ch/svn/root/branches/dev/root6-pch@48864 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-13 09:26:55 +00:00
Axel Naumann
77ba6929b0 v5 of patches.
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
2013-03-11 13:11:15 +00:00
Vassil Vassilev
03cac10cfd Now we don't do execute("gCling = (cling::Interpreter*)some_ptr") at startup.
This cause the number of unique wrappers to decrease by 1. 

Fix the test correspondingly.


git-svn-id: http://root.cern.ch/svn/root/trunk@48854 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-09 20:12:35 +00:00
Vassil Vassilev
26935c507c It is always better to look for something where you expect it to be.
git-svn-id: http://root.cern.ch/svn/root/trunk@48853 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-08 09:54:42 +00:00
Vassil Vassilev
3f1bce28bc Adapt the code for the dynamic scope's lifetime handler. Its ctor has new signature
and we need to pass in the gCling variable.

Fixes one of cling standalone test failures.


git-svn-id: http://root.cern.ch/svn/root/trunk@48852 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-08 00:32:55 +00:00
Vassil Vassilev
9bad1a3d72 Do not set the callbacks to 0 when the dynamic scopes are disabled.
git-svn-id: http://root.cern.ch/svn/root/trunk@48851 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-07 23:46:57 +00:00
Vassil Vassilev
99dfb99f35 Do not print the address of the temporary value of an enum constants.
For example, when we have enum e {e1=1}; and we do e1 on the prompt we got the 
address of e1 and we printed it out. However, this doesn't make sence because we
cannot use it later, because it is destroyed.


git-svn-id: http://root.cern.ch/svn/root/trunk@48850 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-07 23:29:10 +00:00
Axel Naumann
d104cacb4c Return unhappiness instead of crashing on broken redecl chains.
Where I am not even convinced that this case justifies being unhappy.


git-svn-id: http://root.cern.ch/svn/root/trunk@48826 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-06 11:30:07 +00:00
Axel Naumann
1cbc4971a2 80 cols
git-svn-id: http://root.cern.ch/svn/root/trunk@48825 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-06 11:19:15 +00:00
Axel Naumann
5408532f3b Don't expose DynamicLookupRuntimeUniverse.h to G__Meta.o (missing symbol gCling).
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
2013-03-05 17:03:49 +00:00
Vassil Vassilev
e6a53da83d Add documentation and silence doxygen warning.
git-svn-id: http://root.cern.ch/svn/root/trunk@48812 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-05 11:18:59 +00:00
Philippe Canal
7427626e2b Introduce additional rules to work around an issue (features?) in make that
allows the generation of a product (eg one of the cling.o file) even-though 
one of its dependency (eg. etc/cling/llvm/ADT/OwningPtr.h) has not been 
actually built.  This seems to happens if the rule to make the dependency
is a pattern rule that depend on a file (eg. interpreter/llvm/inst/include/llvm/ADT/OwningPtr.h)
that does not have a specific rule but is the byproduct of another product 
create ($(LLVMLIB)).  This is fixed by adding an explicit dependency of the
byproduct (eg. interpreter/llvm/inst/include/llvm/ADT/OwningPtr.h) on 
the main product (eg $(LLVMLIB))


git-svn-id: http://root.cern.ch/svn/root/trunk@48804 27541ba8-7e3a-0410-8455-c3a389f83636
2013-03-04 22:23:43 +00:00