Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8204850

BarrierSet::make_* should be static

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b18

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: