Commit Graph

3451 Commits

Author SHA1 Message Date
Jonas Hahnfeld
a6f2255dc7 Fix lifetime of ClingMMapper
The ClingMMapper must remain available until all ClingMemoryManagers
are destructed, which is typically during shutdown of IncrementalJIT.
This was not the case for the global object MMapperInstance that was
introduced during the upgrade to LLVM 13 because libCling variables
are destructed before running TROOT atexit handlers that shut down
the JIT. In practice, it happened to work but this will change with
the upgrade to LLVM 18 where we see crashes in some tests, potentially
because of upstream commit
47f5c54f99

See also commits e0f6c04660 ("Prevent static destruction from ending
DefaultMMapper too early") and 80c14bb948 ("Extend lifetime of
SectionMemoryManager::DefaultMMapper, again") for the same problem
that we previously patched in our copy of LLVM.
2024-08-27 13:59:05 +02:00
Jonas Hahnfeld
6b83c2c0a5 Always apply SetClingCustomLangOpts
It enables IncrementalExtensions, which is required for Cling to work.
This fixes test/CodeUnloading/PCH/VTables.C which loads a PCH.
2024-08-23 09:14:07 +02:00
Jonas Hahnfeld
dbe8b058ee Fix DelegateGenerator on macOS
Commit 785c9df34d ("Restore symbol lookup in child interpreters")
added a DefinitionGenerator to allow symbol lookup in the parent
IncrementalJIT after the upgrade to LLVM 13. It appears that instead
of the unmangled name, we need to lookup already linker mangled names.

This fixes the tests CodeUnloading/AtExit.C and
MultipleInterpreters/MultipleInterpreters.C on macOS, which adds an
underscore during linker mangling. No change on Linux because there
is no additional linker name mangling.
2024-08-20 08:14:05 +02:00
Jonas Hahnfeld
7695c7302c Turn off delayed template parsing on Windows
It is "a deprecated technique".

Co-authored-by: Bertrand Bellenot <Bertrand.Bellenot@cern.ch>
2024-08-14 13:14:06 +02:00
Jonas Hahnfeld
52df1a551a Globally enable incremental extensions
We are relying on this since a while, for example for reemission of
template symbols. At the moment, we get the incremental extensions
because Preprocessor::enableIncrementalProcessing() turns them on
internally, but this will change with LLVM 18 where this method only
controls incremental processing of a single Preprocessor object.
2024-08-09 08:59:03 +02:00
Jonas Hahnfeld
afd3692787 Forcefully clean up TemplateIdAnnotations
Upstream Clang keeps TemplateIdAnnotations around "if they might
still be in the token stream." See upstream commit for more details:
6163aa9679
(included in Clang 11, in ROOT since the upgrade to LLVM 13)

This reasoning doesn't apply when we fully reset the Parser state in
ParserStateRAII's destructor, and we expect the swapped out vector of
TemplateIdAnnotations to be empty in order to not leak.

Fixes #16121
2024-08-02 08:29:05 +02:00
Jonas Hahnfeld
3e59d62c9c Simplify addOrReplaceDefinition
Calling getSymbolAddress will force symbol emission, which is not
needed if the intent is to replace it.
2024-07-03 08:29:06 +02:00
Jonas Hahnfeld
c201269a09 Simplify symbol overrides
There is no need to force symbol emission, get the address from the
JIT, and then replace the symbol once more.
2024-07-03 08:29:06 +02:00
Devajith Valaparambil Sreeramaswamy
900be1d0e8 Simplify mangling by using mangleAndIntern 2024-06-26 09:29:06 +02:00
Danilo Piparo
2f17f4b4eb Propagate the sized-deallocation to the compiler instance
explicitly if the compiler enables it.
2024-06-07 14:29:06 +02:00
Bertrand Bellenot
3cc2a4dd8d Add support for Visual Studio >= v17.10 2024-05-08 10:44:03 +02:00
Jonas Hahnfeld
65a2a778d1 Fix build with assertions
Fixes commit 68769cd980 ("[cling] Move parts of Parse to another
function").
2024-05-07 11:59:05 +02:00
Devajith Valaparambil Sreeramaswamy
4f2c339d5c Remove m_MemoryBuffers completely 2024-05-06 16:59:09 +02:00
Devajith Valaparambil Sreeramaswamy
ab2f942c8e Remove usage of DiagnosticErrorTrap 2024-05-06 16:59:09 +02:00
Devajith Valaparambil Sreeramaswamy
db76f2a502 Move closer to upstream 2024-05-06 16:59:09 +02:00
Devajith Valaparambil Sreeramaswamy
a943f62f14 Remove unneeded ifdefs 2024-05-06 16:59:09 +02:00
Devajith Valaparambil Sreeramaswamy
517ba1c546 Move processing of TopLevelDecls to the function 2024-05-06 16:59:09 +02:00
Devajith Valaparambil Sreeramaswamy
35b1b01abe Remove CrashRecoveryContextCleanupRegistrar 2024-05-06 16:59:09 +02:00
Devajith Valaparambil Sreeramaswamy
f4471da415 Move parts of Parse to another function 2024-05-06 16:59:09 +02:00
Devajith Valaparambil Sreeramaswamy
419c25e5f2 Use ThreadSafeContext 2024-05-06 16:59:09 +02:00
Vassil Vassilev
6e171ffe93 Remove never used code from the callbacks.
This will allow us to simplify our ASTConsumer model instead of creating many
multiplexers that are not needed. That should simplify adoption of latest
versions of clad.
2024-05-02 10:59:05 +02:00
Devajith
f9b7ba1430 Add plugin support (#15169)
Add plugin support and pass LLVM arguments after plugins have been loaded.
2024-04-12 15:59:08 +02:00
Vassil Vassilev
3750135c31 Allow for changing the modulemap name to match the overlay.
Fixes #14964
2024-03-25 14:59:08 +01:00
Kai Luo
abeda742aa Backport jitlink ppc64 (#13850)
* Backport JITLink ppc64 backend to LLVM-16

* Backport ELF part

* Backport PCREL relocations

* Use jitlink::Section::blocks::empty instead

* Backport TLS PCREL relocation

* [llvm-project] Synchronize with LLVM monorepo fork

---------

Co-authored-by: Jonas Hahnfeld <jonas.hahnfeld@cern.ch>
2024-03-21 15:59:05 +01:00
Vassil Vassilev
eac26aa98e Do not overlay on top of the unix modulemaps.
We should have separate cases for unix and apple, otherwise the modulemaps go
on top of each other.
2024-03-21 13:59:06 +01:00
Vassil Vassilev
ccc4b87fe7 Fix libcxx on osx15.3 2024-03-12 10:59:08 +01:00
Devajith Valaparambil Sreeramaswamy
c917ab56f3 Add TableGen-based generator for command line arguments
Upstream moved away from manually declaring `*def` and `*inc` files. These
are now auto-generated with tablegen. This patch does the same for cling,
making it easier to rebase and maintain.
2024-02-23 09:59:07 +01:00
Devajith Valaparambil Sreeramaswamy
c5692e71f1 Use StringRef::{starts,ends}_with
Follows the changes introduced in https://reviews.llvm.org/D136030
2024-02-23 09:44:06 +01:00
Jonas Hahnfeld
fa648e8fa5 Fix disabling optimizations with CLING_DEBUG
As noted in #14593, the build fails during a rootcling execution when
setting CLING_DEBUG=1 in the environment with
error: invalid integral value '0 -fno-omit-frame-pointer' in '-O0 -fno-omit-frame-pointer'

Upon investigation, it only works in the ROOT prompt because TCling
turns on basic -O1 unless in rootcling. This overrides the (misformed)
"-O0 -fno-omit-frame-pointer". Split the argument in two entries and
move it after inserting the user-provided arguments to properly apply
also on the prompt by now taking precedence over -O1.

Closes #14593
2024-02-14 08:44:06 +01:00
Devajith Valaparambil Sreeramaswamy
1c6031a02a Explicitly disable RelLookupTableConvertedPass
Before the passmanager update, the function `populateModulePassManager`
was called instead of `buildPerModuleDefaultPipeline` to set the default
passes. But the former did not have `RelLookupTableConverterPass` turned on
by default.
2024-02-08 13:29:21 +01:00
Devajth Valaparambil Sreeramaswamy
1b5103e180 Manually call buildO0DefaultPipeline for the new pass manager
Revert this commit once we have https://reviews.llvm.org/D146200
2024-01-30 09:44:04 +01:00
Devajth Valaparambil Sreeramaswamy
c444493f27 Add callback to not run inliner passes for OptLevel <= 1
Inliner passes disabled with the callback:

- ModuleInlinerWrapperPass
- InlineAdvisorAnalysisPrinterPass
- PartialInlinerPass
- buildInlinerPipeline
- ModuleInlinerPass
- InlinerPass
- InlineAdvisorAnalysis
- PartiallyInlineLibCallsPass
- InlineCostAnnotationPrinterPass
- InlineSizeEstimatorAnalysisPrinterPass
- InlineSizeEstimatorAnalysis
2024-01-30 09:44:04 +01:00
Devajith Valaparambil Sreeramaswamy
80b69f0737 Move from legacy to new pass manager
It is recommended to use a new instance of analysis managers every time
we perform codegen as the analyses might not be cleared. Upstream does
not have any instance where populating pass/analysis managers and
running passes are separated.
2024-01-30 09:44:04 +01:00
Axel Naumann
e5b63c66a6 Support bare # in input line: (#14109)
fixes #11190.

Co-authored-by: Devajith Valaparambil Sreeramaswamy <devajith.valaparambil.sreeramaswamy@cern.ch>
2024-01-25 15:29:08 +01:00
Devajith Valaparambil Sreeramaswamy
254f3d57ad Implement value printing for std::source_location 2024-01-17 16:29:04 +01:00
Devajith Valaparambil Sreeramaswamy
a085ccebac Use deduction guides for llvm::ArrayRef 2023-12-13 13:29:07 +01:00
Devajith Valaparambil Sreeramaswamy
879eed2564 Replace llvm::Optional, llvm::None with their std equivalents 2023-12-13 13:29:06 +01:00
Jonas Hahnfeld
908728f3b0 Expect normalized alias option offload_device_only
See also commit de84bfc508 during the previous LLVM upgrade...
2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
444a841163 Fix preprocessor option parsing
Exclude options::DXCOption to avoid confusing the parser with the
second -E option.
2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
8c369bf487 Avoid unloading Decls not found in DeclContext
This fixes roottest/root/meta/tuple/exec_configtype_unload.C on Windows.

Co-authored-by: Bertrand Bellenot <Bertrand.Bellenot@cern.ch>
2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
3d5ba159c6 Desugar UnaryTransformType
This fixes PyROOT's handling of smart pointers, such as shared_ptr,
with the new macOS SDK 14.0 resulting in a remove_extent transform.
2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
f636e21faa Handle UsingType in GetPartiallyDesugaredType
According to https://github.com/llvm/llvm-project/commit/af27466c50,
it is used to represent types pulled in with a using declaration, for
example `using std::error_code; error_code x;`.

This fixes the build of the ROOTTMVASofie module on macOS where this
was causing `std::size_t` not be fully desugared to `unsigned long`
at first to later end up with two identical classes in a list that
must not have duplicates.
2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
78f9595644 Update registration of atexit handlers
GenericLLVMIRPlatformSupport now declares atexit, which leads to a
duplicate symbol error during startup and fails the transaction.
Completely switch to the provided infrastructure and just override
the helpers to register the functions with our Interpreter.
2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
a1598cba14 Update handling of ElaboratedType in GetFullyQualifiedType
In LLVM 16, we now get ElaboratedType far more often, but they don't
have all namespace qualifiers we need. This fixes the build of the
RooFitCore module, but many other places are likely affected as well.
2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
f62bbfff85 Remove extension of legacy pass manager
adjustPassManager was only used for a few backends, such as AMDGPU
and NVPTX, but not on the CPU architectures we care about.
The DiscriminatorsPass was also removed upstream Clang, see commit
https://github.com/llvm/llvm-project/commit/2978d02681.
2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
6960639412 Adapt to updated forgetDecl signature
The GlobalDecl parameter wasn't used since quite some time.
2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
826478d826 Don't print name of EnumDecl if there is none
The function overload without PrintingPolicy is not available in
LLVM 16, see https://reviews.llvm.org/D134813.
2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
6bfe4c2213 Misc adaptations for updated APIs 2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
3b4ec36268 Set MSVolatile in LangOpts 2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
733c2eadfa Remove PMBuilder members
These two fields don't exist anymore in LLVM 16.
2023-12-11 08:59:21 +01:00