Skip to content

Commit de611e6

Browse files
Keyhan VakilV8 LUCI CQ
authored andcommitted
[maglev] fix non-ptr-compr compilation on old compilers
When pointer compression is disabled, the preprocessor expands some static asserts to static_assert(false), which doesn't compile on compilers not implementing the C++ defect report CWG2518, notably clang before version 17 and gcc before version 13. Adding in part of the template parameter to the static assert prevents it from being evaluated immediately which fixes the compilation. Test: compiled with gcc-11 and clang-14 without pointer compression. Change-Id: I95ce29bdb1278e6dad9e592d6f9476395f8aeb59 Fixed: v8:14355 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5022760 Reviewed-by: Leszek Swirski <[email protected]> Commit-Queue: Leszek Swirski <[email protected]> Cr-Commit-Position: refs/heads/main@{#91553}
1 parent 235d5bd commit de611e6

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/maglev/maglev-code-generator.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,11 @@ class ParallelMoveResolver {
420420
void EmitMovesFromSource(RegisterT source_reg, GapMoveTargets&& targets) {
421421
DCHECK(moves_from_register_[source_reg.code()].is_empty());
422422
if constexpr (DecompressIfNeeded) {
423-
static_assert(COMPRESS_POINTERS_BOOL);
423+
// The DecompressIfNeeded clause is redundant with the if-constexpr above,
424+
// but otherwise this code cannot be compiled by compilers not yet
425+
// implementing CWG2518.
426+
static_assert(DecompressIfNeeded && COMPRESS_POINTERS_BOOL);
427+
424428
if (targets.needs_decompression == kNeedsDecompression) {
425429
__ DecompressTagged(source_reg, source_reg);
426430
}
@@ -463,7 +467,11 @@ class ParallelMoveResolver {
463467
// Decompress after the first move, subsequent moves reuse this register so
464468
// they're guaranteed to be decompressed.
465469
if constexpr (DecompressIfNeeded) {
466-
static_assert(COMPRESS_POINTERS_BOOL);
470+
// The DecompressIfNeeded clause is redundant with the if-constexpr above,
471+
// but otherwise this code cannot be compiled by compilers not yet
472+
// implementing CWG2518.
473+
static_assert(DecompressIfNeeded && COMPRESS_POINTERS_BOOL);
474+
467475
if (targets.needs_decompression == kNeedsDecompression) {
468476
__ DecompressTagged(register_with_slot_value, register_with_slot_value);
469477
targets.needs_decompression = kDoesNotNeedDecompression;

0 commit comments

Comments
 (0)