Skip to content

Commit fed4744

Browse files
abmusseV8 LUCI CQ
authored andcommitted
Fix build on gcc
This commit fixes two issues 1. ``` In file included from ../../src/compiler/turboshaft/assembler.h:37, from ../../src/wasm/turboshaft-graph-interface.h:13, from ../../src/wasm/function-compiler.cc:20: ../../src/compiler/turboshaft/builtin-call-descriptors.h:26:55: error: declaration of 'static constexpr v8::internal::compiler::turboshaft::detail::IndexTag<1> v8::internal::compiler::turboshaft::builtin::BigIntAdd::Arguments::index_counter(v8::internal::compiler::turboshaft::detail::IndexTag<1>)' changes meaning of 'index_counter' [-fpermissive] ``` GCC is more strict on accessing the fields from a inner struct. The fix was to wrap the base declarations in a struct and have Arguments struct inheirt from the base. 2. In maglev-ir.h and maglev-range-analysis.h fixed up `error: call to non-'constexpr'` issues. Change-Id: I175700665c7bbb4f07588e9cac3d55d9afce44d0 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6987408 Reviewed-by: Jakob Linke <[email protected]> Commit-Queue: Jakob Linke <[email protected]> Reviewed-by: Milad Farazmand <[email protected]> Reviewed-by: Nico Hartmann <[email protected]> Cr-Commit-Position: refs/heads/main@{#103041}
1 parent 3793c0b commit fed4744

3 files changed

Lines changed: 46 additions & 44 deletions

File tree

src/compiler/turboshaft/builtin-call-descriptors.h

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,14 @@ struct builtin {
6666
// if necessary.
6767
static constexpr std::size_t kMaxArgumentCount = 8;
6868
using arguments_vector_t = base::SmallVector<OpIndex, kMaxArgumentCount>;
69-
static constexpr inline detail::IndexTag<0> index_counter(
70-
detail::IndexTag<0>);
71-
static constexpr base::tmp::list<> make_args_type_list_n(detail::IndexTag<0>);
72-
69+
// TODO(abmusse): use ArgumentsBase (until we can use GCC 13 or better)
70+
struct ArgumentsBase {
71+
static constexpr inline detail::IndexTag<0> index_counter(
72+
detail::IndexTag<0>);
73+
static constexpr base::tmp::list<> make_args_type_list_n(
74+
detail::IndexTag<0>);
75+
};
7376
static constexpr OpEffects base_effects = OpEffects().CanDependOnChecks();
74-
7577
template <typename A>
7678
static arguments_vector_t ArgumentsToVector(const A& args) {
7779
arguments_vector_t result;
@@ -169,7 +171,7 @@ struct builtin {
169171

170172
struct BigIntAdd : public Descriptor<BigIntAdd> {
171173
static constexpr auto kFunction = Builtin::kBigIntAdd;
172-
struct Arguments {
174+
struct Arguments : ArgumentsBase {
173175
ARG(V<Numeric>, left)
174176
ARG(V<Numeric>, right)
175177
};
@@ -183,7 +185,7 @@ struct builtin {
183185

184186
struct CheckTurbofanType : public Descriptor<CheckTurbofanType> {
185187
static constexpr auto kFunction = Builtin::kCheckTurbofanType;
186-
struct Arguments {
188+
struct Arguments : ArgumentsBase {
187189
ARG(V<Object>, value)
188190
ARG(V<TurbofanType>, expected_type)
189191
ARG(V<Smi>, node_id)
@@ -201,7 +203,7 @@ struct builtin {
201203
#define DECL_GENERIC_BINOP(Name) \
202204
struct Name : public Descriptor<Name> { \
203205
static constexpr auto kFunction = Builtin::k##Name; \
204-
struct Arguments { \
206+
struct Arguments : ArgumentsBase { \
205207
ARG(V<Object>, left) \
206208
ARG(V<Object>, right) \
207209
}; \
@@ -219,7 +221,7 @@ struct builtin {
219221
#define DECL_GENERIC_UNOP(Name) \
220222
struct Name : public Descriptor<Name> { \
221223
static constexpr auto kFunction = Builtin::k##Name; \
222-
struct Arguments { \
224+
struct Arguments : ArgumentsBase { \
223225
ARG(V<Object>, input) \
224226
}; \
225227
using returns_t = std::tuple<V<Object>>; \
@@ -235,7 +237,7 @@ struct builtin {
235237

236238
struct DetachContextCell : public Descriptor<DetachContextCell> {
237239
static constexpr auto kFunction = Builtin::kDetachContextCell;
238-
struct Arguments {
240+
struct Arguments : ArgumentsBase {
239241
ARG(V<Context>, the_context)
240242
ARG(V<Object>, new_value)
241243
ARG(V<WordPtr>, i)
@@ -251,7 +253,7 @@ struct builtin {
251253

252254
struct ToNumber : public Descriptor<ToNumber> {
253255
static constexpr auto kFunction = Builtin::kToNumber;
254-
struct Arguments {
256+
struct Arguments : ArgumentsBase {
255257
ARG(V<Object>, input)
256258
};
257259
using returns_t = std::tuple<V<Number>>;
@@ -264,7 +266,7 @@ struct builtin {
264266

265267
struct NonNumberToNumber : public Descriptor<NonNumberToNumber> {
266268
static constexpr auto kFunction = Builtin::kNonNumberToNumber;
267-
struct Arguments {
269+
struct Arguments : ArgumentsBase {
268270
ARG(V<JSAnyNotNumber>, input)
269271
};
270272
using returns_t = std::tuple<V<Number>>;
@@ -277,7 +279,7 @@ struct builtin {
277279

278280
struct ToNumeric : public Descriptor<ToNumeric> {
279281
static constexpr auto kFunction = Builtin::kToNumeric;
280-
struct Arguments {
282+
struct Arguments : ArgumentsBase {
281283
ARG(V<Object>, input)
282284
};
283285
using returns_t = std::tuple<V<Numeric>>;
@@ -290,7 +292,7 @@ struct builtin {
290292

291293
struct NonNumberToNumeric : public Descriptor<NonNumberToNumeric> {
292294
static constexpr auto kFunction = Builtin::kNonNumberToNumeric;
293-
struct Arguments {
295+
struct Arguments : ArgumentsBase {
294296
ARG(V<JSAnyNotNumber>, input)
295297
};
296298
using returns_t = std::tuple<V<Numeric>>;
@@ -304,7 +306,7 @@ struct builtin {
304306
struct CopyFastSmiOrObjectElements
305307
: public Descriptor<CopyFastSmiOrObjectElements> {
306308
static constexpr auto kFunction = Builtin::kCopyFastSmiOrObjectElements;
307-
struct Arguments {
309+
struct Arguments : ArgumentsBase {
308310
ARG(V<Object>, object)
309311
};
310312
using returns_t = std::tuple<V<Object>>;
@@ -321,7 +323,7 @@ struct builtin {
321323
static constexpr auto kFunction = B;
322324
using StringOrSmi = Union<String, Smi>;
323325
// We use smi:0 for an empty label.
324-
struct Arguments {
326+
struct Arguments : ArgumentsBase {
325327
ARG(V<StringOrSmi>, label_or_0)
326328
ARG(V<Input>, value)
327329
};
@@ -343,7 +345,7 @@ struct builtin {
343345
template <Builtin B>
344346
struct FindOrderedHashEntry : public Descriptor<FindOrderedHashEntry<B>> {
345347
static constexpr auto kFunction = B;
346-
struct Arguments {
348+
struct Arguments : ArgumentsBase {
347349
ARG(V<Object>, table)
348350
ARG(V<Smi>, key)
349351
};
@@ -363,7 +365,7 @@ struct builtin {
363365
template <Builtin B>
364366
struct GrowFastElements : public Descriptor<GrowFastElements<B>> {
365367
static constexpr auto kFunction = B;
366-
struct Arguments {
368+
struct Arguments : ArgumentsBase {
367369
ARG(V<Object>, object)
368370
ARG(V<Smi>, size)
369371
};
@@ -383,7 +385,7 @@ struct builtin {
383385
template <Builtin B>
384386
struct NewArgumentsElements : public Descriptor<NewArgumentsElements<B>> {
385387
static constexpr auto kFunction = B;
386-
struct Arguments {
388+
struct Arguments : ArgumentsBase {
387389
// TODO(nicohartmann@): First argument should be replaced by a proper
388390
// RawPtr.
389391
ARG(V<WordPtr>, frame)
@@ -406,7 +408,7 @@ struct builtin {
406408

407409
struct NumberToString : public Descriptor<NumberToString> {
408410
static constexpr auto kFunction = Builtin::kNumberToString;
409-
struct Arguments {
411+
struct Arguments : ArgumentsBase {
410412
ARG(V<Number>, input)
411413
};
412414
using returns_t = std::tuple<V<String>>;
@@ -420,7 +422,7 @@ struct builtin {
420422

421423
struct ToString : public Descriptor<ToString> {
422424
static constexpr auto kFunction = Builtin::kToString;
423-
struct Arguments {
425+
struct Arguments : ArgumentsBase {
424426
ARG(V<Object>, o)
425427
};
426428
using returns_t = std::tuple<V<String>>;
@@ -433,7 +435,7 @@ struct builtin {
433435

434436
struct PlainPrimitiveToNumber : public Descriptor<PlainPrimitiveToNumber> {
435437
static constexpr auto kFunction = Builtin::kPlainPrimitiveToNumber;
436-
struct Arguments {
438+
struct Arguments : ArgumentsBase {
437439
ARG(V<PlainPrimitive>, input)
438440
};
439441
using returns_t = std::tuple<V<Number>>;
@@ -447,7 +449,7 @@ struct builtin {
447449

448450
struct SameValue : public Descriptor<SameValue> {
449451
static constexpr auto kFunction = Builtin::kSameValue;
450-
struct Arguments {
452+
struct Arguments : ArgumentsBase {
451453
ARG(V<Object>, left)
452454
ARG(V<Object>, right)
453455
};
@@ -462,7 +464,7 @@ struct builtin {
462464

463465
struct SameValueNumbersOnly : public Descriptor<SameValueNumbersOnly> {
464466
static constexpr auto kFunction = Builtin::kSameValueNumbersOnly;
465-
struct Arguments {
467+
struct Arguments : ArgumentsBase {
466468
ARG(V<Object>, left)
467469
ARG(V<Object>, right)
468470
};
@@ -476,7 +478,7 @@ struct builtin {
476478

477479
struct StringAdd_CheckNone : public Descriptor<StringAdd_CheckNone> {
478480
static constexpr auto kFunction = Builtin::kStringAdd_CheckNone;
479-
struct Arguments {
481+
struct Arguments : ArgumentsBase {
480482
ARG(V<String>, left)
481483
ARG(V<String>, right)
482484
};
@@ -494,7 +496,7 @@ struct builtin {
494496

495497
struct StringEqual : public Descriptor<StringEqual> {
496498
static constexpr auto kFunction = Builtin::kStringEqual;
497-
struct Arguments {
499+
struct Arguments : ArgumentsBase {
498500
ARG(V<String>, left)
499501
ARG(V<String>, right)
500502
ARG(V<WordPtr>, length)
@@ -512,7 +514,7 @@ struct builtin {
512514

513515
struct StringFromCodePointAt : public Descriptor<StringFromCodePointAt> {
514516
static constexpr auto kFunction = Builtin::kStringFromCodePointAt;
515-
struct Arguments {
517+
struct Arguments : ArgumentsBase {
516518
ARG(V<String>, receiver)
517519
ARG(V<WordPtr>, position)
518520
};
@@ -527,7 +529,7 @@ struct builtin {
527529

528530
struct StringIndexOf : public Descriptor<StringIndexOf> {
529531
static constexpr auto kFunction = Builtin::kStringIndexOf;
530-
struct Arguments {
532+
struct Arguments : ArgumentsBase {
531533
ARG(V<String>, s)
532534
ARG(V<String>, search_string)
533535
ARG(V<Smi>, start)
@@ -545,7 +547,7 @@ struct builtin {
545547

546548
struct StringCompare : public Descriptor<StringCompare> {
547549
static constexpr auto kFunction = Builtin::kStringCompare;
548-
struct Arguments {
550+
struct Arguments : ArgumentsBase {
549551
ARG(V<String>, left)
550552
ARG(V<String>, right)
551553
};
@@ -561,7 +563,7 @@ struct builtin {
561563
template <Builtin B>
562564
struct StringComparison : public Descriptor<StringComparison<B>> {
563565
static constexpr auto kFunction = B;
564-
struct Arguments {
566+
struct Arguments : ArgumentsBase {
565567
ARG(V<String>, left)
566568
ARG(V<String>, right)
567569
};
@@ -579,7 +581,7 @@ struct builtin {
579581

580582
struct StringSubstring : public Descriptor<StringSubstring> {
581583
static constexpr auto kFunction = Builtin::kStringSubstring;
582-
struct Arguments {
584+
struct Arguments : ArgumentsBase {
583585
ARG(V<String>, string)
584586
ARG(V<WordPtr>, from)
585587
ARG(V<WordPtr>, to)
@@ -596,7 +598,7 @@ struct builtin {
596598
#ifdef V8_INTL_SUPPORT
597599
struct StringToLowerCaseIntl : public Descriptor<StringToLowerCaseIntl> {
598600
static constexpr auto kFunction = Builtin::kStringToLowerCaseIntl;
599-
struct Arguments {
601+
struct Arguments : ArgumentsBase {
600602
ARG(V<String>, string)
601603
};
602604
using returns_t = std::tuple<V<String>>;
@@ -612,7 +614,7 @@ struct builtin {
612614

613615
struct StringToNumber : public Descriptor<StringToNumber> {
614616
static constexpr auto kFunction = Builtin::kStringToNumber;
615-
struct Arguments {
617+
struct Arguments : ArgumentsBase {
616618
ARG(V<String>, input)
617619
};
618620
using returns_t = std::tuple<V<Number>>;
@@ -626,7 +628,7 @@ struct builtin {
626628

627629
struct ToBoolean : public Descriptor<ToBoolean> {
628630
static constexpr auto kFunction = Builtin::kToBoolean;
629-
struct Arguments {
631+
struct Arguments : ArgumentsBase {
630632
ARG(V<Object>, input)
631633
};
632634
using returns_t = std::tuple<V<Boolean>>;
@@ -639,7 +641,7 @@ struct builtin {
639641

640642
struct ToObject : public Descriptor<ToObject> {
641643
static constexpr auto kFunction = Builtin::kToObject;
642-
struct Arguments {
644+
struct Arguments : ArgumentsBase {
643645
ARG(V<Object>, input)
644646
};
645647
using returns_t = std::tuple<V<JSReceiver>>;
@@ -654,7 +656,7 @@ struct builtin {
654656
template <Builtin B>
655657
struct CreateFunctionContext : public Descriptor<CreateFunctionContext<B>> {
656658
static constexpr auto kFunction = B;
657-
struct Arguments {
659+
struct Arguments : ArgumentsBase {
658660
ARG(V<ScopeInfo>, scope_info)
659661
ARG(V<Word32>, slots)
660662
};
@@ -674,7 +676,7 @@ struct builtin {
674676

675677
struct FastNewClosure : public Descriptor<FastNewClosure> {
676678
static constexpr auto kFunction = Builtin::kFastNewClosure;
677-
struct Arguments {
679+
struct Arguments : ArgumentsBase {
678680
ARG(V<SharedFunctionInfo>, shared_function_info)
679681
ARG(V<FeedbackCell>, feedback_cell)
680682
};
@@ -690,7 +692,7 @@ struct builtin {
690692

691693
struct Typeof : public Descriptor<Typeof> {
692694
static constexpr auto kFunction = Builtin::kTypeof;
693-
struct Arguments {
695+
struct Arguments : ArgumentsBase {
694696
ARG(V<Object>, object)
695697
};
696698
using returns_t = std::tuple<V<String>>;
@@ -704,7 +706,7 @@ struct builtin {
704706
struct CheckTurboshaftWord32Type
705707
: public Descriptor<CheckTurboshaftWord32Type> {
706708
static constexpr auto kFunction = Builtin::kCheckTurboshaftWord32Type;
707-
struct Arguments {
709+
struct Arguments : ArgumentsBase {
708710
ARG(V<Word32>, value)
709711
ARG(V<TurboshaftWord32Type>, expected_type)
710712
ARG(V<Smi>, node_id)
@@ -720,7 +722,7 @@ struct builtin {
720722
struct CheckTurboshaftWord64Type
721723
: public Descriptor<CheckTurboshaftWord64Type> {
722724
static constexpr auto kFunction = Builtin::kCheckTurboshaftWord64Type;
723-
struct Arguments {
725+
struct Arguments : ArgumentsBase {
724726
ARG(V<Word32>, value_high)
725727
ARG(V<Word32>, value_low)
726728
ARG(V<TurboshaftWord64Type>, expected_type)
@@ -737,7 +739,7 @@ struct builtin {
737739
struct CheckTurboshaftFloat32Type
738740
: public Descriptor<CheckTurboshaftFloat32Type> {
739741
static constexpr auto kFunction = Builtin::kCheckTurboshaftFloat32Type;
740-
struct Arguments {
742+
struct Arguments : ArgumentsBase {
741743
ARG(V<Float32>, value)
742744
ARG(V<TurboshaftFloat64Type>, expected_type)
743745
ARG(V<Smi>, node_id)
@@ -753,7 +755,7 @@ struct builtin {
753755
struct CheckTurboshaftFloat64Type
754756
: public Descriptor<CheckTurboshaftFloat64Type> {
755757
static constexpr auto kFunction = Builtin::kCheckTurboshaftFloat64Type;
756-
struct Arguments {
758+
struct Arguments : ArgumentsBase {
757759
ARG(V<Float64>, value)
758760
ARG(V<TurboshaftFloat64Type>, expected_type)
759761
ARG(V<Smi>, node_id)

src/maglev/maglev-ir.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6553,7 +6553,7 @@ class VirtualObject : public FixedInputValueNodeT<0, VirtualObject> {
65536553

65546554
int slot_count() const { return slots_.length(); }
65556555

6556-
vobj::ObjectType object_type() const {
6556+
constexpr vobj::ObjectType object_type() const {
65576557
return object_layout_->object_type;
65586558
}
65596559

src/maglev/maglev-range-analysis.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class Range {
9191
#undef KNOWN_RANGES
9292

9393
bool is_all() const { return min_ == kInfMin && max_ == kInfMax; }
94-
bool is_empty() const { return max_ < min_; }
94+
constexpr bool is_empty() const { return max_ < min_; }
9595

9696
bool is_constant() const { return max_ == min_ && max_ != kInfMax; }
9797

0 commit comments

Comments
 (0)