14 Commits

Author SHA1 Message Date
Timm Baeder
8d26252eec
[clang][bytecode][NFC] Dead blocks are always uninitialized (#152699)
We always call the descriptor dtor before, so they are never
initialized.
2025-08-08 14:57:38 +02:00
Timm Baeder
fde9ee1ac2
[clang][bytecode] Don't deallocate dynamic blocks with pointers (#152672)
This fixes the edge case we had with variables pointing to dynamic
blocks, which forced us to convert basically *all* dynamic blocks to
DeadBlock when deallocating them.

We now don't run dynamic blocks through InterpState::deallocate() but
instead add them to a DeadAllocations list when they are deallocated but
still have pointers.

As a consequence, not all blocks with Block::IsDead = true are
DeadBlocks.
2025-08-08 13:02:01 +02:00
Timm Baeder
3b5cc2dc63
[clang][bytecode][NFC] Refactor DynamicAllocator a bit (#152510)
Use empty()-style functions instead of exposing the size if we don't
need it.
2025-08-07 17:03:53 +02:00
Timm Baeder
4784585747
[clang][bytecode][NFC] Remove unnecessary local variable (#152468)
Desc is only used once and we can get that information from the Block as
well.
2025-08-07 12:39:32 +02:00
Timm Baeder
8259be65c7
[clang][bytecode] Remove unused includes (#151848)
UnsignedOrNone.h from PrimType.h and ASTLambda.h from Function.h.
2025-08-03 08:52:03 +02:00
Timm Baeder
41803a2414
[clang][bytecode] Replace MoveFn With DtorFn + memcpy (#151717)
First, the old MoveFn was rather inefficient, since the dead data cannot
ever be accessed anyway.

Second, there was a problem where the only reason a block still had a
pointer to it (and thus was made into a DeadBlock instead of simply
being deallocated) as that a nested field in the block pointed to the
block itself.

Fix this by calling the dtor function unconditionally. If the block
*still* has pointers after that, we really need to create a DeadBlock
for it.
2025-08-02 14:47:49 +02:00
Timm Baeder
fb49c6784a
[clang][bytecode] Move Pointer::{Prev,Next} into BlockPointer (#151097)
They are only relevant for block pointers.
2025-07-30 10:17:21 +02:00
Timm Baeder
4eb66f7462
[clang][bytecode] Allow memory leaks before C++20 (#137445)
The expression allocating the memory wasn't valid in the first place.
This matches the diagnostic behavior of the current interpreter.
2025-04-26 07:13:44 +02:00
Timm Baeder
1a78ef9a9e
[clang][bytecode] Allow casts from void* only in std::allocator calls (#136714)
Otherwise, add the missing diagnostic.
2025-04-23 08:00:57 +02:00
Timm Baeder
06130ed341
Reapply "[clang][bytecode] Stack-allocate bottom function frame" (#12… (#125349)
…5325)

Move the BottomFrame to InterpState instead.
2025-02-01 18:12:35 +01:00
Jorge Gorbe Moya
386af4a5c6
Revert "[clang][bytecode] Stack-allocate bottom function frame" (#125325)
Reverts llvm/llvm-project#125253

It introduced an msan failure. Caught by a buildbot here:
https://lab.llvm.org/buildbot/#/builders/164/builds/6922/steps/17/logs/stdio
2025-01-31 20:09:14 -08:00
Timm Baeder
f3549814f8
[clang][bytecode] Stack-allocate bottom function frame (#125253)
Instead of heap-allocating it. This is similar to what the current
interpeter does. In C, we have no function calls, so the extra heap
allocation never makes sense.
2025-01-31 20:08:58 +01:00
Timm Baeder
a024a0ceed
[clang][bytecode] Override InConstantContext flag for immediate calls (#109967)
And fix the diagnostics for __builtin_is_constant_evaluated(). We can be
in a non-constant context, but calling an immediate function always
makes the context constant for the duration of that call.
2024-09-25 16:46:46 +02:00
Timm Baeder
a07aba5d44
[clang] Rename all AST/Interp stuff to AST/ByteCode (#104552)
"Interp" clashes with the clang interpreter and people often confuse
this.
2024-08-16 17:13:12 +02:00