Commit Graph

4315 Commits

Author SHA1 Message Date
Bertrand Bellenot
4f2d4a8477 Initialize the token kind to "tok::eof" to prevent potential infinite loop 2018-04-11 09:59:09 +02:00
Bertrand Bellenot
119b70b8f8 From Axel: Empty token queue for late parsed templates also for pending instantiations.
Late parsed templated are parsed from a token chain, as if expanding a macro. This confuses subsequent parses. Make sure that the token quere is emptied, which is exactly what ParseInternal() does after parsing.
2018-04-11 09:59:09 +02:00
Wolf Behrenhoff
ace18e2b02 Add const& to foreach loops
In case of TProtoClass.cxx, all the loop was doing
is to copy the collection (loop body with comments
only - and those don't compile when removing the //.
Thus comment out the whole loop.

In TDFNodes.cxx remove the redundant get() as well.
2018-04-10 16:29:10 +02:00
Bertrand Bellenot
129e60ab4b Add comment referencing where the 0x2C value is coming from 2018-04-09 15:45:00 +02:00
Bertrand Bellenot
252dd842df Inject the "_tls_array" constant (0x2C) to avoid unresolved symbol error when JITting 2018-04-09 15:45:00 +02:00
Yuka Takahashi
09c4952325 Revert changing headers and inline functions 2018-04-03 16:14:39 +02:00
Yuka Takahashi
638e5969d8 ROOT start up time and memory optimization
There are some codes compiled at the start up time. For example,
    - #include \"cling/Interpreter/RuntimeUniverse.h\"
    - #include \"cling/Interpreter/DynamicLookupRuntimeUniverse.h\"
    - namespace cling { class Interpreter; namespace runtime { Interpreter* gCling }}}
    - PrintValue
  These are passed to Cling as string and initialized at the start up time.  So I think it makes sense to reduce top-level global variables, #includes and virtual functions.

  1. Global variables
    If we break at emitModule, we can get a list of global variables and functions which are actually deserialized. These include functions, variables, STL classes and all the functions derives from them.
 I tried to change them to for example constexpr, so that it's processed at compile time.
  2. Eagerly Deserialized decls
    Thanks to @Axel 's hint and tip, we could minimize eagerly deserialized decls deserialized in ASTReader::PassInterestingDeclsToConsumer. We already removed most of eagerly deserialized decls (Some are remaining to be removed, some are hard to remove and some don't cost a lot).

  So far, we got 9.2% of cpu time improvement and 8.8% of memory improvement at start up time in release build.

  - root.exe -q -l
    - master
      cpu time = 0.09186914285714286 sec (average of 7 times)
      res  memory = 142.008 Mbytes

    - HEAD
      cpu time = 0.08337842857142856 sec
      res  memory = 129.508 Mbytes

  - hsimple.C
  Improved by 13% of cpu time and 8.5% of memory
    - master
      cpu time = 0.0954708 sec (average)
      res  memory = 142.891 Mbytes

    - HEAD
      cpu time = 0.0833258 sec
      res  memory = 130.73 Mbytes

  With modules
    - Improvement by 17.7% in cputime and 2% in memory on root.exe -q -l
    (For memory, small improvement is because most of the memory is taken by LoadModules)
    - With this patch, modules is 11.2% slower in cpu time and 6% better in residential memory.
2018-04-03 16:14:39 +02:00
Vassil Vassilev
5367e13c15 Restore removed dependency.
For in-tree builds we need Options.inc to be tablegen-ed before
building clingInterpreter library.
2018-04-01 20:44:18 +02:00
Vassil Vassilev
6c74a386ba Enable ROOT to be built with prebuilt clang and llvm.
To do so one needs to pass -Dbuiltin_llvm=Off -Dbuiltin_clang=Off and the
PATH should contain the path to llvm-config.

Note this is not enabling ROOT to work with vanilla clang!

This patch allows ROOT to be built against a prebuilt clang and llvm from
https://root.cern.ch/git/{llvm.git,clang.git}. It allows to reduce ROOT's
build times (in cases when cmake decides to rebuild the in-tree llvm for
no good reason). It moves the common denominator of different ROOT builds
in one place to save space. It also allows easy switch between LLVM in
debug and release mode.

To build the external clang and llvm exactly in the same way as the
in-tree builds use:

CMAKE_FLAGS="\
            -DLLVM_ENABLE_WARNINGS=OFF                   \
            -DLLVM_INCLUDE_TESTS=OFF                     \
            -DCLANG_INCLUDE_TESTS=OFF                    \
            -DLLVM_INCLUDE_EXAMPLES=OFF                  \
            -DCLANG_BUILD_TOOLS=OFF                      \
            -DCLANG_TOOL_ARCMT_TEST_BUILD=OFF            \
            -DCLANG_TOOL_CLANG_CHECK_BUILD=OFF           \
            -DCLANG_TOOL_CLANG_FORMAT_BUILD=OFF          \
            -DCLANG_TOOL_CLANG_FORMAT_VS_BUILD=OFF       \
            -DCLANG_TOOL_CLANG_FUZZER_BUILD=OFF          \
            -DCLANG_TOOL_CLANG_IMPORT_TEST_BUILD=OFF     \
            -DCLANG_TOOL_CLANG_OFFLOAD_BUNDLER_BUILD=OFF \
            -DCLANG_TOOL_CLANG_RENAME_BUILD=OFF          \
            -DCLANG_TOOL_C_ARCMT_TEST_BUILD=OFF          \
            -DCLANG_TOOL_C_INDEX_TEST_BUILD=OFF          \
            -DCLANG_TOOL_DIAGTOOL_BUILD=OFF              \
            -DCLANG_TOOL_LIBCLANG_BUILD=OFF              \
            -DCLANG_TOOL_SCAN_BUILD_BUILD=OFF            \
            -DCLANG_TOOL_SCAN_VIEW_BUILD=OFF             \
            -DLLVM_BUILD_TOOLS=OFF                       \
            -DLLVM_TOOL_LLVM_AR_BUILD=OFF                \
            -DCLANG_TOOL_CLANG_OFFLOAD_BUNDLER_BUILD=OFF \
            -DLLVM_FORCE_USE_OLD_TOOLCHAIN=ON            \
            -DCLANG_ENABLE_STATIC_ANALYZER=OFF           \
            -DCLANG_ENABLE_ARCMT=OFF                     \
            -DCLANG_ENABLE_FORMAT=OFF                    \
            -DLLVM_TARGETS_TO_BUILD=host                 \
            -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF         \
            -DLLVM_ENABLE_ABI_BREAKING_CHECKS=OFF        \
            -DCMAKE_INSTALL_PREFIX=..                    \
            -DCMAKE_BUILD_TYPE=Debug"

cmake "$CMAKE_FLAGS"   ../../../sources/root-llvm/
2018-03-28 19:29:10 +02:00
Danilo Piparo
c79fd92638 For the value printing of tuples, prefer an if to a template
in order to reduce the deserialisations which happen at ROOT startup.
2018-03-27 21:29:07 +02:00
Axel Naumann
c0fa0173b9 Remove configure/make buildsystem files. 2018-03-27 16:15:07 +02:00
Simeon Ehrig
3b656d1d3f add automatic load of libcudart.so at start of cling -xcuda 2018-03-23 18:29:07 +01:00
Simeon Ehrig
4f73d1b93d reduce arguments at start of cling -xcling
the argument --cuda-host-only and the default c++ stardard will be set at start of cling -xcuda
2018-03-23 18:29:07 +01:00
Simeon Ehrig
757fca022f allow to enable the cuda mode of the compilerInstance
set the AuxTarget, if the LangOpt CUDA is true and enable the compilation of cuda runtime code
needs a preload of the libcudart.so and the arguments -std=c++11 and --cuda-host-only at start of cling
2018-03-23 18:29:06 +01:00
Damien L-G
6bbf1f3311 Use CLING_OPTS env variable to pass extra arguments to jupyter-cling-kernel
This patch let you customize your kernel:
```
{
  "display_name": "C++14-custom",
  "argv": [
      "jupyter-cling-kernel",
      "-f",
      "{connection_file}",
      "--std=c++14"
  ],
  "language": "C++",
  "env": {"CLING_OPTS": "-I<add_directory_to_include_search_path> -L<add_directory_to_library_search_path>"}
}
```
2018-03-23 16:59:08 +01:00
Simeon Ehrig
83e3eafc44 fix CMakeFiles to allow cling build with shared libraries 2018-03-22 15:59:06 +01:00
Bertrand Bellenot
e26a6cb2df Several fixes for Windows
- cling: add missing symbol in the export list and fix semicolon issue in CMakeList.txt (it has to be in quotes)
 - cling-demo: export symbols and format hexadecimal output
2018-03-22 13:44:16 +01:00
Bertrand Bellenot
e128adbcca Fix cling on Windows (there is no Emulated TLS on Windows) 2018-03-13 18:44:11 +01:00
Vassil Vassilev
7919b1c9c2 We do not need to use std::addressof. Clang has a builtin analog. 2018-03-12 00:14:06 +01:00
Vassil Vassilev
d45d26ae1d Revert "Use a stable way to determine the address of printed objects."
This reverts commit 56b56bf25e5a4ef29555c2f7e9ea30bf76b9000e.
2018-03-12 00:14:06 +01:00
Vassil Vassilev
c2bda52ba2 The test is expected to fail on cling standalone. 2018-03-11 17:14:05 +01:00
Vassil Vassilev
7b70052776 Add forgotten to commit protection and check clause.
This should have landed in 7554be9571.
2018-03-10 10:29:05 +01:00
Vassil Vassilev
01dbb6d9d5 Use a stable way to determine the address of printed objects.
Using unary operator address of (eg. MyClass m; &m) takes into account
overloaded operators which may not give us the precide address of the
allocated storage.

This patch teaches cling to use std::addressof instead.
2018-03-08 22:44:16 +01:00
Vassil Vassilev
911071a080 CLANG_INCLUDE_DIRS and LLVM_INCLUDE_DIRS can be lists of values.
The cmake lists are semicolon-separated strings which we fail to pass
to the colon-expecting interface.
2018-03-08 22:44:16 +01:00
Vassil Vassilev
6eca8bd693 Revert "Silence cling test error until after the break."
This reverts commit 16b0a0b8bb2aa4415a9a40138b70406f4c2b6c20.

The error seems to be fixed but we forgot to update the test.
2018-03-08 22:44:15 +01:00
Vassil Vassilev
3a5d26ebf0 Enable ROOT's builtin_llvm=Off
This patch allows ROOT to be built against compatible external llvm (5.0
or 5.0.1). Note that we still need to build clang (eg. we require
builtin_clang=On) due to the ROOT-specific patches which are not yet
upstream.

Since we have externally installed llvm, we configure and build clang as
a standalone project. The configuration relies on finding llvm-config-5.0
and uses an adapted version of the standard clang standalone build
procedure.

Clang provides dependencies such as FileCheck and not which are used by
cling's testsuite and are not being installed with the standard llvm
package.

Cling (which depends on llvm and clang) is built as a clang tool to avoid
unresolved dependencies to clang and complicating further the already
complicated cmake setup.

This patch intends a minimal change and follows the initial (suboptimal)
design to configure and build llvm, clang and cling as part of ROOT. An
ultimate solution would be to have llvm, clang and cling built as separate
standalone projects (following the recommended way by the LLVM cmake
developers).
2018-02-20 13:44:05 +01:00
Vassil Vassilev
75b9ee317f Fix typo. 2018-02-20 13:44:05 +01:00
Vassil Vassilev
e9c073dbd0 Remove outdated and commented cmake arg. 2018-02-20 13:44:05 +01:00
Vassil Vassilev
53c9768f20 Remove redundant dependency 'count'. 2018-02-20 13:44:05 +01:00
Vassil Vassilev
c2a28b097f Remove redundant include. 2018-02-20 13:44:05 +01:00
Vassil Vassilev
0fa6cbe4f7 Use the standard cmake variables showing the include path. 2018-02-20 13:44:05 +01:00
Bertrand Bellenot
52028886df remove -fno-threadsafe-statics
this will have to be investigated/fixed in the JIT
2018-02-20 13:29:03 +01:00
Bertrand Bellenot
619d59ca32 Add comment
Windows requires std::ifstream::binary to properly handle
 CRLF and LF line endings
2018-02-20 13:29:03 +01:00
Bertrand Bellenot
67fc6cba13 inconditionally provide the std::ifstream::binary flag 2018-02-20 13:29:03 +01:00
Bertrand Bellenot
7c3649035f Several fixes for Windows
in CIFactory:
- Add -fno-threadsafe-statics flag (for Windows only), to prevent potential unresolved symbols at run-time

in MetaProcessor::readInputFromFile:
- add required std::ifstream::binary flag when opening the std::ifstream
- add missing backslashes

in PlatformWin:
- properly format error messages
- in IsDLL(): check and return false if the file size is 0
- fix _CxxThrowException symbol name (not fully understood - to be reviewed)
- filter out a couple of system dlls when looking for symbols
2018-02-20 13:29:03 +01:00
Vassil Vassilev
47aa5c23ef Find clang's binary include paths.
In cases where we do not have 'installed' clang we should try to find the
relevant include directories.
2018-02-20 10:59:12 +01:00
Vassil Vassilev
bfb4168dc9 Implement basic plugin support in cling.
We rely on clang's plugin infrastructure for loading, argument processing
and unloading plugins.

This patch teaches cling to work with clang plugins such as clad -- a
clang plugin implementing automatic differentiation facilities.
2018-02-20 10:59:12 +01:00
Vassil Vassilev
988ebf7be1 Adjust comment. 2018-02-20 10:59:12 +01:00
Vassil Vassilev
e13c60a010 Reduce extra char -> llvm::StringRef conversions. 2018-02-17 11:44:06 +01:00
Vassil Vassilev
847d280aac Use the regular lookup mechanisms in cling.
TClingClassInfo has a constructor that is supposed to be used for TU
scope lookups. However, it iterates over decls and causes lots of
deserializations. It does not respect the C++ lookup rules because it
returns the first decl with the name it finds.

This patch tries to keep the original behavior by first trying to do
a regular lookup and if the result is unambigious it returns the found
decl. If the result was ambiguous we try to disambiguate it (by turning
off the using directives) and return the found result.
2018-02-15 22:29:11 +01:00
Vassil Vassilev
d9babce973 Forward declare the class in the correct namespace. 2018-01-29 15:29:26 +01:00
Vassil Vassilev
3a82a25051 Do not rely on getSpecializations.
The getSpecialization interface now deserializes lazily template
specializations. While unloading we trigger creation of new specializations
which does not make sense.
2018-01-21 09:14:46 +01:00
Houkime
51acb456a1 Add "language" field to kernel.json 2018-01-15 17:14:05 +01:00
Axel Naumann
3848d29556 Fix exception if cling is not found.
See https://stackoverflow.com/questions/48244332/c-jupyter-kernel-death
2018-01-15 15:59:58 +01:00
Dheepak Krishnamurthy
bf88ee12d3 Get correct path for cling
Required for Mac with `brew install cling`
2018-01-15 12:59:47 +01:00
Dheepak Krishnamurthy
f9db95721e Check in libexec folder as well
Required for Mac brew install
2018-01-15 12:59:47 +01:00
Axel Naumann
b302a6bcfe Silence cling test error until after the break. 2017-12-21 10:48:27 +01:00
Guilherme Amadio
50a795610f Match declarations of at_quick_exit and __cxa_atexit symbols for libc++ and C++17
On Linux, the same adjustments are needed as for libstdc++ and libc++,
so turn the condition into just #ifdef __linux__. However, since the
__cxa_atexit function is declared as extern "C" in libc++, we cannot
add "noexcept" to it, as is done for libstdc++.
2017-12-09 11:59:37 +01:00
Axel Naumann
9168e7d9ab Move enum attributes after "enum class X: int" (ROOT-9114).
With the attribute after "enum" and before the name, the name itself gets annotated
and subsequent lookups fail to identify the front-end token.
By moving the attribute behind the decl, the identifier is unmodified.
2017-12-07 17:00:35 +01:00
Axel Naumann
1193463c6f Revert "Address ROOT-9114 (Issues with dictionary's enum forward decl)"
This reverts commit 59c69dc2ce449eff8cabcf73405b04b07aaf9eb3.
Let's try to find the underlying issue...
2017-12-07 17:00:35 +01:00