BarrierSet::make_* should be static

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 11
    • Affects Version/s: 11
    • Component/s: hotspot
    • None
    • b18

        In Epsilon GC, we have the call like:

        EpsilonBarrierSet::EpsilonBarrierSet() : BarrierSet(
                  make_barrier_set_assembler<BarrierSetAssembler>(),
                  make_barrier_set_c1<BarrierSetC1>(),
                  make_barrier_set_c2<BarrierSetC2>(),
                  BarrierSet::FakeRtti(BarrierSet::EpsilonBarrierSet)) {};

        ...and some compilers (notably Mac OS builds) complain that:

        /Users/yosemite/jdk-sandbox/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp:40:11: error: base class 'BarrierSet' is uninitialized when used here to access 'BarrierSet::make_barrier_set_assembler<BarrierSetAssembler>' [-Werror,-Wuninitialized]
                  make_barrier_set_assembler<BarrierSetAssembler>(),
                  ^
        /Users/yosemite/jdk-sandbox/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp:41:11: error: base class 'BarrierSet' is uninitialized when used here to access 'BarrierSet::make_barrier_set_c1<BarrierSetC1>' [-Werror,-Wuninitialized]
                  make_barrier_set_c1<BarrierSetC1>(),
                  ^
        /Users/yosemite/jdk-sandbox/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp:42:11: error: base class 'BarrierSet' is uninitialized when used here to access 'BarrierSet::make_barrier_set_c2<BarrierSetC2>' [-Werror,-Wuninitialized]
                  make_barrier_set_c2<BarrierSetC2>(),

        This warning is legit: we are calling instance method of BarrierSet before initializing it. But, those methods are just factory methods, and they could be static, resolving the warning.

              Assignee:
              Aleksey Shipilev
              Reporter:
              Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: