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

BarrierSet::make_* should be static

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 11
    • 11
    • 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.

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

                Created:
                Updated:
                Resolved: